Commit Graph

1259 Commits

Author SHA1 Message Date
Andrei Belov
3644883aa8 Packages: added logrotate configuration for Debian packages.
While here, made logrotate configuration consistent between rpm and deb.

This closes #323 issue on GitHub.
2019-09-25 15:28:20 +03:00
Andrey Zelenkov
702ca2b853 Tests: static tests with file system objects. 2019-09-24 16:13:20 +03:00
Tiago Natel
93ead87810 Removed linux/sched.h include.
The <sched.h> is already included by nxt_unix.h.

This closes #314 PR on GitHub.
2019-09-20 13:08:04 +00:00
Tiago Natel
20628c74fa Releasing init struct in case of errors.
Found by Coverity (CID 349485).
2019-09-20 13:12:04 +00:00
Tiago Natel
7f389c814a Closing leaking file descriptor.
Found by Coverity (CID 349484).
2019-09-20 13:16:33 +00:00
Valentin Bartenev
514f34144a Static: returning 404 for Unix domain sockets.
It's now similar to how attempts to access other non-regular files are handled.
2019-09-24 15:33:42 +03:00
Sergey Kandaurov
c416933171 PHP: zeroing the whole file_handle structure.
Fixes segfaults with PHP 7.4.
2019-09-23 11:56:31 +00:00
Valentin Bartenev
5c50329f8e Fixed segfault if an inappropriate file system object is requested.
Found by Coverity (CID 349483).
2019-09-20 14:31:19 +03:00
Valentin Bartenev
8853dece44 Version bump. 2019-09-20 14:29:11 +03:00
Valentin Bartenev
db777d1e7f Added tag 1.11.0 for changeset 3b1601ac0f2f 2019-09-19 17:38:16 +03:00
Valentin Bartenev
7d53cc7029 Generated Dockerfiles for Unit 1.11.0. 2019-09-19 17:36:09 +03:00
Valentin Bartenev
2281d9f02c Added version 1.11.0 CHANGES. 2019-09-19 17:28:55 +03:00
Andrey Zelenkov
2503226729 Tests: serving static files. 2019-09-19 17:11:37 +03:00
Valentin Bartenev
08a8d1510d Basic support for serving static files. 2019-09-19 02:47:09 +03:00
Tiago de Bem Natel de Moura
c554941b4f Initial applications isolation support using Linux namespaces. 2019-09-19 15:25:23 +03:00
Max Romanov
6346e641ee Releasing WebSocket frame in case of buffer allocation failure.
Found by Coverity (CID 349456).
2019-09-19 16:28:03 +03:00
Max Romanov
1fac43eebe Fixing master process crash after failed fork.
This closes #312 issue on GitHub.
2019-09-18 22:45:30 +03:00
Max Romanov
ab40ce3757 Go: removing nxt_main.h usage.
One small step to Go modules support.
2019-09-18 18:31:29 +03:00
Max Romanov
a216b15e99 Fixing request release order to avoid crashes on exit.
Each request references the router process structure that owns all memory
maps.  The process structure has a reference counter; each request increases
the counter to lock the structure in memory until request processing ends.
Incoming and outgoing buffers reference memory maps that the process owns,
so the process structure should be released only when all buffers are
released to avoid invalid memory access and a crash.

This describes the libunit library mechanism used for application processes.

The background of this issue is as follows:

The issue was found on buildbot when the router crashed during Java
websocket tests.  The Java application receives a notification from the
master process; when the notification is processed, libunit deletes the
process structure from its process hash and decrements the use counter;
however, active websocket connections maintain their use counts on the
process structure.  After that, when the master process is stopping the
application, libunit releases active websocket connections.  At this point,
it's important to release the connections' memory buffers before the
corresponding process structure and all shared memory segments are released.
2019-09-18 18:31:22 +03:00
Max Romanov
84e4a6437f Go: do not store pointer to Go object.
To pass Go object references to C and back we use hack with casting to
unsafe and then to uintptr.  However, we should not store such references
because Go not guaratnee it will be available by the same address.
Introducing map with integer key helps to avoid dereference stored address.

This closes #253 and #309 issues on GitHub.
2019-09-18 18:31:14 +03:00
Max Romanov
4ea9ed309e Reducing number of warning messages.
One alert per failed allocation is enough.
2019-09-18 18:31:06 +03:00
Max Romanov
9bacd21405 Protecting context structures with mutex.
By design, Unit context is created for the thread which reads messages from
the router.  However, Go request handlers are called in a separate goroutine
that may be executed in a different thread.  To avoid a racing condition,
access to lists of free structures in the context should be serialized.  This
patch should fix random crashes in Go applications under high load.

This is related to #253 and #309 issues on GitHub.
2019-09-18 18:30:58 +03:00
Valentin Bartenev
ca01845d89 Configuration: added ability to modify object members with slashes.
Example:

  PUT/POST/DELETE /config/listeners/unix:%2Fpath%2Fto%2Fsocket

This follows a49ee872e83d.
2019-09-18 16:03:28 +03:00
Andrey Zelenkov
26fcb46137 Tests: added read_buffer_size option in http(). 2019-09-18 00:25:57 +03:00
Andrey Zelenkov
23215c839f Tests: head() method introduced. 2019-09-17 21:15:15 +03:00
Valentin Bartenev
6352c21a58 HTTP parser: fixed parsing of target after literal space character.
In theory, all space characters in request target must be encoded; however,
some clients may violate the specification.  For the sake of interoperability,
Unit supports unencoded space characters.

Previously, if there was a space character before the extension or arguments
parts, those parts weren't recognized.  Also, quoted symbols and complex
target weren't detected after a space character.
2019-09-17 18:40:21 +03:00
Valentin Bartenev
3b77e402a9 HTTP parser: removed unused "plus_in_target" flag. 2019-09-16 20:17:42 +03:00
Valentin Bartenev
56f4085b9d HTTP parser: removed unused "offset" field.
Thanks to 洪志道 (Hong Zhi Dao).
2019-09-16 20:17:42 +03:00
Valentin Bartenev
2fb7a1bfb9 HTTP parser: removed unused "exten_start" and "args_start" fields. 2019-09-16 20:17:42 +03:00
Valentin Bartenev
64be8717bd Configuration: added ability to access object members with slashes.
Now URI encoding can be used to escape "/" in the request path:

  GET /config/listeners/unix:%2Fpath%2Fto%2Fsocket/
2019-09-16 20:17:42 +03:00
Andrey Zelenkov
b5394c3956 Tests: fixed features check. 2019-09-16 17:49:49 +03:00
Andrey Zelenkov
65ca2d7b19 Tests: refactored prerequisites model. 2019-09-14 14:44:35 +03:00
Andrey Zelenkov
962cdb6659 Tests: prepare_env() introduced. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
13ecbe333a Tests: style and minor fixes in java.py. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
a5b9c9241e Tests: more comments. 2019-09-16 15:37:32 +03:00
Andrey Zelenkov
7152162886 Tests: set default "unsafe" value. 2019-09-16 15:37:32 +03:00
Andrei Belov
6f1f3b48b2 Packages: added explicit library path for Java on RPM based distros.
This helps to avoid using excessive strictness in RPATH of Java modules.
2019-09-16 13:28:06 +03:00
Max Romanov
2a6af1d214 Added "extern" to nxt_http_fields_hash_proto to avoid link issues. 2019-09-09 17:39:24 +03:00
Andrey Zelenkov
f10a8a03a1 Tests: Java websockets tests. 2019-09-05 15:30:09 +03:00
Max Romanov
2b8cab1e24 Java: introducing websocket support. 2019-09-05 15:27:32 +03:00
Andrey Zelenkov
3e23afb0d2 Tests: increased read_timeout for websockets tests. 2019-09-03 21:23:32 +03:00
Max Romanov
daadc2e00b Making request state handler calls more consistent. 2019-09-02 18:27:08 +03:00
Andrey Zelenkov
1cfd329b3d Tests: fixed recv_bytes() in websockets.py. 2019-09-02 18:03:33 +03:00
Andrey Zelenkov
790b4f8f00 Tests: removed duplicate websocket tests. 2019-09-02 18:03:17 +03:00
Andrey Zelenkov
70e808040d Tests: prevented writing non-chopped frames to the closed socket. 2019-09-02 14:55:00 +03:00
Andrey Zelenkov
cb36616132 Tests: prevented writing to the closed socket for websocket tests. 2019-08-30 16:59:35 +03:00
Andrey Zelenkov
ccd6c0dc05 Tests: websockets style fixes. 2019-08-30 15:37:44 +03:00
Max Romanov
7053a35a60 Fixed WebSocket implementation that was broken on some systems.
The "nxt_http_websocket" request state, defined in "nxt_http_websocket.c",
is used in "nxt_router.c" and must be linked with external symbol declared
in "nxt_router.c".

Due to the missing "extern" keyword, building Unit with some linkers
(notably gold and LLD) caused WebSocket connections to get stuck or even
crash the router process.
2019-08-30 00:07:54 +03:00
Igor Sysoev
e2abfaf381 Adding body handler to nxt_http_request_header_send(). 2019-08-26 18:29:00 +03:00
Valentin Bartenev
1298824130 Version bump. 2019-08-26 18:06:03 +03:00