Commit graph

1190 commits

Author SHA1 Message Date
Max Romanov
ad518ae6c4 Python: fixing Python 3.8 build with clang.
Python 3.8 has 'tp_print' field in PyTypeObject struct.  This field is
attributed as deprecated.  So, clang generates warning (which is turned to
error) as a result of initializing this field.  From the other hand, it is
impossible to omit this field in positional initialization.  The solution
is to use designated initializer.

Silencing usage message during configure python.

This is related to #331 issue on GitHub.
2019-10-23 14:04:29 +03:00
Tiago Natel
23b94fde83 Improved error logging when uid/gid map is not properly set.
When using "credential: true", the new namespace starts with a completely
empty uid and gid ranges.  Then, any setuid/setgid/setgroups calls using ids
not properly mapped with uidmap and gidmap fields return EINVAL, meaning
the id is not valid inside the new namespace.
2019-10-22 14:46:15 +00:00
Max Romanov
2dbfd7c35e Fixing process crash in case of module load error.
This is related to #330 issue on GitHub.
2019-10-22 16:14:02 +03:00
Max Romanov
8df4468014 Fixing idle connection close function.
There was a typo: nxt_queue_head() used instead of nxt_queue_first() in
connection iteration loop.  This prevents idle connection close on quit.

This closes #334 issue on GitHub.
Thanks to 洪志道 (Hong Zhi Dao).
2019-10-22 16:04:56 +03:00
Max Romanov
e54f5f3dc8 Python: fixing build for Python 3.8.
Thanks to tonyafanasyev.
This is related to #331 issue on GitHub.
2019-10-22 16:04:30 +03:00
Tiago Natel
0beb8ea5e1 Fixed passing false in namespace flags.
This patch closes #328 in github.
2019-10-11 10:00:06 +00:00
Igor Sysoev
09e7357b08 Style fixes. 2019-10-10 19:42:41 +03:00
Igor Sysoev
ec0d5c928e Changed nxt_memcasecmp() interface to avoid casts. 2019-10-10 19:37:40 +03:00
Valentin Bartenev
75453479f3 Configuration: added check for mandatory options of "action". 2019-10-09 15:26:59 +03:00
Andrey Zelenkov
486b202cc1 Tests: default port number used. 2019-10-08 00:28:40 +03:00
Andrey Zelenkov
faf4ad5478 Tests: increased subprocess timeout on Unit exit.
Also changed order of subprocess status checks.
_terminate_process() method removed.
2019-10-08 00:28:40 +03:00
Valentin Bartenev
1b4c96f265 Version bump. 2019-10-07 18:38:41 +03:00
Valentin Bartenev
59db9a3887 Added tag 1.12.0 for changeset b391df5f0102 2019-10-03 17:34:58 +03:00
Valentin Bartenev
946cbd1f10 Generated Dockerfiles for Unit 1.12.0. 2019-10-03 17:08:32 +03:00
Valentin Bartenev
b1cb78ef8e Added version 1.12.0 CHANGES. 2019-10-03 16:30:31 +03:00
Igor Sysoev
aa910b276e Ignoring EINTR error in kqueue. 2019-10-03 16:13:13 +03:00
Konstantin Pavlov
f5e86ad8fc Regenerated Dockerfiles. 2019-10-03 15:08:50 +03:00
Konstantin Pavlov
c6df631bcc Docker: added an entrypoint to make configuration easier.
Docker images now accept shell scripts, json files and certificate chain
bundles to provide configuration on a container start by placing them
into /docker-entrypoint.d/ directory.
2019-10-03 15:08:44 +03:00
Valentin Bartenev
73f096f796 Added response status code to error page body.
Also the error page markup is now valid according to HTML5 specification.
All optional tags were omitted.
2019-10-02 20:04:52 +03:00
Max Romanov
9b4e45cafc Fixed "make tests" build without preceding "make".
Currently almost all Unit object files depends on generated nxt_version.h.
This patch adds missing dependence and fixes running make with multiple
jobs.

This closes #318 issue on GitHub.
2019-10-02 19:11:10 +03:00
Max Romanov
2eb6f35ef5 Go: fixing header buffer size calculation.
Header names and values are stored 0-terminated for ease of use in different
languages, so magic number 2 should be added to each name-value pair size.
2019-10-01 19:53:18 +03:00
Valentin Bartenev
f8ff71b917 HTTP: corrected allocation size for tail chunk. 2019-09-30 19:11:17 +03:00
Valentin Bartenev
f7d3db314d HTTP parser: removed unused "exten" field.
This field was intended for MIME type lookup by file extension when serving
static files, but this use case is too narrow; only a fraction of requests
targets static content, and the URI presumably isn't rewritten.  Moreover,
current implementation uses the entire filename for MIME type lookup if the
file has no extension.

Instead of extracting filenames and extensions when parsing requests, it's
easier to obtain them right before serving static content; this behavior is
already implemented.  Thus, we can drop excessive logic from parser.
2019-09-30 19:11:17 +03:00
Valentin Bartenev
2dbda125db HTTP parser: normalization of paths ending with "." or "..".
Earlier, the paths were normalized only if there was a "/" at the end, which
is wrong according to section 5.2.4 of RFC 3986 and hypothetically may allow
to the directory above the document root.
2019-09-30 19:11:17 +03:00
Igor Sysoev
2791c00cf2 Fixed error processing in SSL operations.
Before this fix EWOULDBLOCK error was fatal for SSL write operation.

This closes #325 issue on GitHub.
2019-09-30 17:17:31 +03:00
Max Romanov
f2b280aa0c Fixed exiting if a signal arrives during discovery.
When Unit starts, the main process waits for module discovery message for a
while.  If a QUIT signal arrives at this time, the router and controller
processes created by main and Unit stay running.  Also, the main process
doesn't stop them after the second QUIT signal is received in this case.
2019-09-30 16:39:08 +03:00
Valentin Bartenev
f2c0f2899a Refactored nxt_process_create() for more explicit pipe closing. 2019-09-26 16:03:02 +03:00
Valentin Bartenev
9c06bfdf2c Fixed descriptors leak on process creation.
The leak has been introduced in 325b315e48c4.
This closes #322 issue in GitHub.
2019-09-26 16:03:01 +03:00
Andrey Zelenkov
d82f125368 Tests: fixed hanging of Go tests.
This closes #319 issue on GitHub.
2019-09-25 19:21:42 +03:00
Konstantin Pavlov
5c6b01d76c Packaging: debian: drop a surplus line from init script 2019-09-25 16:19:31 +03:00
Konstantin Pavlov
919230a21e Packaging: debian: changed NAME in the init script
This fixes the following issues:
 - inability to stop unit daemon
 - default configuration from /etc/default/unit are not propagated to the daemon
2019-09-25 16:18:19 +03:00
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