Commit graph

747 commits

Author SHA1 Message Date
Max Romanov
257283cc38 Fixed unit library mutex usage.
For the optimization purpose, function nxt_unit_remove_process() expects
lib->mutex to be locked.  The function then moves ports queue into temporary
queue and releases mutex.  In nxt_unit_done() there were two errors: mutex was
not locked before nxt_unit_remove_process() call and mutex was not destroyed.
It is hard to tell what was possible negative impact of this errors.

Found by Coverity (CID 308517).
2018-08-07 15:52:11 +03:00
Andrey Zelenkov
09268676ef Tests: remove unused function.
This function was accidentally added in e0f0cd7d244a.
2018-08-06 19:40:37 +03:00
Max Romanov
b021188e95 Python: decoding unicode strings as Latin1.
According to PEP 3333, header names and values should be decoded as Latin1.
2018-08-06 19:16:45 +03:00
Max Romanov
1bb22d1e92 Unit application library.
Library now used in all language modules.
Old 'nxt_app_*' code removed.

See src/test/nxt_unit_app_test.c for usage sample.
2018-08-06 17:27:33 +03:00
Andrey Zelenkov
b6ce2da65c Tests: expectedFailure removed from test_settings_idle_timeout.
Fix committed in f04b28aa6e02.
2018-07-30 20:07:31 +03:00
Igor Sysoev
8654372842 Fixed segfault on listening socket close.
Now keep-alive connection sends 408 response if listening
socket was closed while reconfiguration.
2018-07-30 17:05:49 +03:00
Igor Sysoev
69a1169cae Sending 408 response on idle connection timeout. 2018-07-30 17:05:48 +03:00
Andrey Zelenkov
7f57b6d984 Tests: fixed test_settings_idle_timeout. 2018-07-30 17:01:14 +03:00
Andrey Zelenkov
a458f50d59 Tests: fixed header value char tests.
Use byte strings to avoid problems with encoding.
2018-07-30 16:40:52 +03:00
Valentin Bartenev
4b67de4bbb Removed implicit call of nxt_thread() in nxt_thread_tid().
Explicit is better than implicit © The Zen of Python.

The nxt_thread_tid(NULL) call was used only twice in the code
and such behaviour was specific to nxt_thread_tid() function.
2018-07-27 17:52:21 +03:00
Igor Sysoev
12c890c1ca Added OpenBSD 3.9 getthrid().
Prodded by David Carlier.
2018-07-27 16:57:45 +03:00
Igor Sysoev
7e41f9d108 Refactored thread ID functions.
nxt_thread_tid() was moved to src/nxt_thread.c
nxt_thread_get_tid() was moved to src/nxt_thread_id.h.
src/nxt_thread_id.c was removed.
2018-07-27 16:53:26 +03:00
Valentin Bartenev
de885e10cb Fixed configure process with non-default locale.
Overriding LANG might not work, since it has less precedence than LC_* settings.
LC_ALL has the highest precedence.

This should resolve issue #121 on GitHub.
2018-07-23 19:21:33 +03:00
Sergey Kandaurov
7c5a710c55 Added getentropy() support.
Prodded by David Carlier.
2018-07-16 13:30:11 +03:00
Sergey Kandaurov
bf1cb8f399 Supplied getrandom() test with commentary about supported OSes. 2018-07-16 13:17:49 +03:00
Valentin Bartenev
7bdbb2cf2a Version bump. 2018-07-16 16:33:06 +03:00
Andrey Zelenkov
cfe91315eb Tests: HTTP settings. 2018-07-13 20:15:50 +03:00
Valentin Bartenev
92a7d9f0c6 Added tag 1.3 for changeset b3cf22b8a17e 2018-07-13 15:15:22 +03:00
Valentin Bartenev
604a904a47 Generated Dockerfiles for Unit 1.3. 2018-07-13 14:45:08 +03:00
Valentin Bartenev
a1bf265d52 Added version 1.3 CHANGES. 2018-07-13 14:45:08 +03:00
Igor Sysoev
bd8eacf52d Fixed socket write error handling. 2018-07-12 18:29:22 +03:00
Igor Sysoev
5de582f6db Disabling keep-alive connection on errors. 2018-07-12 18:29:22 +03:00
Igor Sysoev
071412a9ae Fixed bug in "send_timeout" handling. 2018-07-12 18:29:22 +03:00
Max Romanov
4d818a6f23 Enabled body buffer shared memory segmentation.
Changeset #699 fixes shared memory allocation: continous buffer with
requested size should be allocated or function failed.  For body longer
than 10 Mb, this allocation will definitely fails.

For body buffer it is not required to send it in a single continous buffer,
so, need to request minimum reasonable amount of shared memory and try to
extend it, if possible or allocate next buffer.
2018-07-12 16:06:36 +03:00
Max Romanov
e6cd1c4257 Go: http.Flusher implemented by unit.response.
This closes #133 issue on GitHub.
2018-07-12 15:50:43 +03:00
Andrey Zelenkov
96a4f9f032 Tests: more php.ini options tests. 2018-07-11 19:35:46 +03:00
Andrey Zelenkov
223ba37ab5 Tests: more chars in header values tests. 2018-07-11 19:35:36 +03:00
Andrey Zelenkov
b82954a5af Tests: empty configuration. 2018-07-11 19:35:23 +03:00
Valentin Bartenev
8fd32c9394 Removed unused "nxt_app_header_field_t" structure.
It's not used since 3b77edf46701.
2018-07-11 16:53:11 +03:00
Alexander Borisov
a27e76779f Ruby: added "require('bundler/setup')".
This closes #93 PR on GitHub.
2018-07-10 15:43:59 +03:00
Valentin Bartenev
1abdcfb2d8 Controller: added "settings" configuration object.
It has the following structure and default values:

  {
      "http": {
          "header_read_timeout": 30,
          "body_read_timeout": 30,
          "send_timeout": 30,
          "idle_timeout": 180,
          "max_body_size": 8388608
      }
  }
2018-07-09 20:34:51 +03:00
Valentin Bartenev
5a05f569b7 Router: increased HTTP connection related limits. 2018-07-09 20:34:51 +03:00
Valentin Bartenev
7e3de003c7 PHP: fixed request body processing.
The implementation of module was based on the assumption that PHP reads request
body and headers in the particular order.  For the POST request the body goes
before headers and vice versa for all other requests.

But as it appeared later, this order is unspecified and depends on many factors,
including the particular code of PHP application.  Among other factors those
can affect ordering:

 - presence of "Content-Type" header;
 - "variables_order" php.ini setting;
 - "enable_post_data_reading" php.ini setting;
 - reading php://input by application;

and this list can be incomplete.

As a temporary workaround, request body now is always put before headers and it
is gracefully skipped whenever PHP wants to get headers.

This closes #144 issue on GitHub.
2018-07-05 16:43:45 +03:00
Valentin Bartenev
234deb51f4 PHP: fixed setting of individual configuration options.
The previous method changed PHP options only for the first request.
On the request completion the options were rolled back.

This closes #145 issue on GitHub.
2018-07-03 17:12:47 +03:00
Valentin Bartenev
11cecce114 HTTP parser: relaxed checking of fields values.
Allowing characters up to 0xFF doesn't conflict with RFC 7230.
Particularly, this make it possible to pass unencoded UTF-8 data
through HTTP headers, which can be useful.
2018-07-03 15:18:16 +03:00
Valentin Bartenev
0366bfad6d Fixed error message about "spare" value. 2018-07-02 18:19:00 +03:00
Valentin Bartenev
145d895430 Controller: fixed handling of zero Content-Length. 2018-07-02 16:36:59 +03:00
Igor Sysoev
313da403a5 Removed -mmacosx-version-min option. 2018-06-28 18:31:27 +03:00
Igor Sysoev
50228b35b6 Removed usage of nxt_thread_context in loadable modules.
This change allows to use __thread class storage on MacOSX.
2018-06-28 18:31:13 +03:00
Igor Sysoev
51b37f0693 Using appropriate default modules and state directories. 2018-06-28 17:36:48 +03:00
Igor Sysoev
61df281464 Added check of "make install" ability.
This closes #136 issue on GitHub.
2018-06-28 17:36:42 +03:00
Valentin Bartenev
42e1d8e3b2 Packages: tar building functionality moved into pkg/Makefile. 2018-06-27 18:30:49 +03:00
Igor Sysoev
606eda045b Removed '\r' and '\n' artifact macros. 2018-06-25 16:56:45 +03:00
Valentin Bartenev
1a52d876f7 Introduced nxt_length() macro. 2018-06-25 16:51:47 +03:00
Valentin Bartenev
af31012815 More effective implementation of nxt_popcount().
This method requires as many iterations as there are set bits,
while the previous one has to shift up to the position of the
highest bit.
2018-06-21 16:40:02 +03:00
Sergey Kandaurov
14bc401394 Using own popcount where the compiler builtin is not available. 2018-06-20 19:34:06 +03:00
Sergey Kandaurov
50d4587961 Using portable grep features. 2018-06-20 19:33:49 +03:00
Max Romanov
b1d7844449 Fixed allocation of multiple shared memory chunks.
Previously, one shared memory chunk was allocated under mutex and other
chunks (if required) were allocated using atomic operations.  So such
allocation is not guaranteed and the result buffer can be less than
requested.

This commit moves multiple chunks allocation under mutex and guarantees
the result buffer is large enough.
2018-06-20 19:11:27 +03:00
Max Romanov
6157a599f2 Using 'all' as default target in Makefile. 2018-06-19 17:23:01 +03:00
Igor Sysoev
3ad1acca12 Fixed exit status on start failure.
This and previous commit close #131 issue on GitHub.
2018-06-18 17:14:32 +03:00