Revision tags: 1.32.1-1, 1.32.0-1, 1.32.0 |
|
2673:08b48a5ad55d | 30-Jan-2024 |
Andrei Zeliankou |
Updated copyright notice. |
Revision tags: 1.31.1-1, 1.31.1, 1.31.0-1, 1.31.0 |
|
2476:cb8c2da2afd9 | 22-May-2023 |
Alejandro Colomar |
Tests: fixed incorrect pointer assignment.
If we don't update the pointer before copying the request body, then we get the behavior shown below. After this patch, "foo\n" is rightly appended at the
Tests: fixed incorrect pointer assignment.
If we don't update the pointer before copying the request body, then we get the behavior shown below. After this patch, "foo\n" is rightly appended at the end of the response body.
Request:
"GET / HTTP/1.1\r\nHost: _\nContent-Length: 4\n\nfoo\n"
Response body:
""" Hello world! foo est data: Method: GET Protocol: HTTP/1.1 Remote addr: 127.0.0.1 Local addr: 127.0.0.1 Target: / Path: / Fields: Host: _ Content-Length: 4 Body: """
Fixes: 1bb22d1e922c ("Unit application library.") Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
show more ...
|
Revision tags: 1.30.0-1, 1.30.0, 1.29.1-1, 1.29.1, 1.29.0-1, 1.29.0 |
|
2231:5b3a69fd47a7 | 02-Nov-2022 |
Alejandro Colomar |
Removed the unsafe nxt_memcmp() wrapper for memcmp(3).
The casts are unnecessary, since memcmp(3)'s arguments are 'void *'. It might have been necessary in the times of K&R, where 'void *' didn't ex
Removed the unsafe nxt_memcmp() wrapper for memcmp(3).
The casts are unnecessary, since memcmp(3)'s arguments are 'void *'. It might have been necessary in the times of K&R, where 'void *' didn't exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can hide all classes of bugs by silencing most compiler warnings.
The changes from nxt_memcmp() to memcmp(3) were scripted:
$ find src/ -type f \ | grep '\.[ch]$' \ | xargs sed -i 's/nxt_memcmp/memcmp/'
Reviewed-by: Andrew Clayton <a.clayton@nginx.com> Signed-off-by: Alejandro Colomar <alx@nginx.com>
show more ...
|
2229:3a230013e58a | 27-Oct-2022 |
Andrew Clayton |
Fixed some function definitions.
Future releases of GCC will render function definitions like
func()
invalid by default. See the previous commit 09f88c9 ("Fixed main() prototypes in auto tests."
Fixed some function definitions.
Future releases of GCC will render function definitions like
func()
invalid by default. See the previous commit 09f88c9 ("Fixed main() prototypes in auto tests.") for details.
Such functions should be defined like
func(void)
This is a good thing to do regardless of the upcoming GCC changes.
Reviewed-by: Alejandro Colomar <alx@nginx.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
show more ...
|
2208:26af8eadc943 | 29-Sep-2022 |
Andrew Clayton |
Renamed a couple of members of nxt_unit_request_t.
This is a preparatory patch that renames the 'local' and 'local_length' members of the nxt_unit_request_t structure to 'local_addr' and 'local_addr
Renamed a couple of members of nxt_unit_request_t.
This is a preparatory patch that renames the 'local' and 'local_length' members of the nxt_unit_request_t structure to 'local_addr' and 'local_addr_length' in preparation for the adding of 'local_port' and 'local_port_length' members.
Suggested-by: Zhidao HONG <z.hong@f5.com> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
show more ...
|
Revision tags: 1.28.0-1, 1.28.0, 1.27.0-1, 1.27.0 |
|
2084:7d479274f334 | 30-Apr-2022 |
Alejandro Colomar |
Fixed #define style.
We had a mix of styles for declaring function-like macros:
Style A: #define \ foo() \ do { \ ...
Fixed #define style.
We had a mix of styles for declaring function-like macros:
Style A: #define \ foo() \ do { \ ... \ } while (0)
Style B: #define foo() \ do { \ ... \ } while (0)
We had a similar number of occurences of each style:
$ grep -rnI '^\w*(.*\\' | wc -l 244 $ grep -rn 'define.*(.*)' | wc -l 239
(Those regexes aren't perfect, but a very decent approximation.)
Real examples:
$ find src -type f | xargs sed -n '/^nxt_double_is_zero/,/^$/p' nxt_double_is_zero(f) \ (fabs(f) <= FLT_EPSILON)
$ find src -type f | xargs sed -n '/define nxt_http_field_set/,/^$/p' #define nxt_http_field_set(_field, _name, _value) \ do { \ (_field)->name_length = nxt_length(_name); \ (_field)->value_length = nxt_length(_value); \ (_field)->name = (u_char *) _name; \ (_field)->value = (u_char *) _value; \ } while (0)
I'd like to standardize on a single style for them, and IMO, having the identifier in the same line as #define is a better option for the following reasons:
- Programmers are used to `#define foo() ...` (readability). - One less line of code. - The program for finding them is really simple (see below).
function grep_ngx_func() { if (($# != 1)); then >&2 echo "Usage: ${FUNCNAME[0]} <func>"; return 1; fi;
find src -type f \ | grep '\.[ch]$' \ | xargs grep -l "$1" \ | sort \ | xargs pcregrep -Mn "(?s)^\$[\w\s*]+?^$1\(.*?^}";
find src -type f \ | grep '\.[ch]$' \ | xargs grep -l "$1" \ | sort \ | xargs pcregrep -Mn "(?s)define $1\(.*?^$" \ | sed -E '1s/^[^:]+:[0-9]+:/&\n\n/'; }
$ grep_ngx_func Usage: grep_ngx_func <func>
$ grep_ngx_func nxt_http_field_set src/nxt_http.h:98:
#define nxt_http_field_set(_field, _name, _value) \ do { \ (_field)->name_length = nxt_length(_name); \ (_field)->value_length = nxt_length(_value); \ (_field)->name = (u_char *) _name; \ (_field)->value = (u_char *) _value; \ } while (0)
$ grep_ngx_func nxt_sprintf src/nxt_sprintf.c:56:
u_char * nxt_cdecl nxt_sprintf(u_char *buf, u_char *end, const char *fmt, ...) { u_char *p; va_list args;
va_start(args, fmt); p = nxt_vsprintf(buf, end, fmt, args); va_end(args);
return p; }
................ Scripted change: ................
$ find src -type f \ | grep '\.[ch]$' \ | xargs sed -i '/define *\\$/{N;s/ *\\\n/ /;s/ //}'
show more ...
|
Revision tags: 1.26.1-1, 1.26.1, 1.26.0-1, 1.26.0 |
|
1980:43553aa72111 | 28-Oct-2021 |
Max Romanov |
Moving request limit control to libunit.
Introducting application graceful stop. For now only used when application process reach request limit value.
This closes #585 issue on GitHub. |
1975:6a47cab8f271 | 26-Oct-2021 |
Valentin Bartenev |
Custom implementation of Base64 decoding function.
Compared to the previous implementation based on OpenSSL, the new implementation has these advantages:
1. Strict and reliable detection of invali
Custom implementation of Base64 decoding function.
Compared to the previous implementation based on OpenSSL, the new implementation has these advantages:
1. Strict and reliable detection of invalid strings, including strings with less than 4 bytes of garbage at the end;
2. Allows to use Base64 strings without '=' padding.
show more ...
|
Revision tags: 1.25.0-1, 1.25.0, 1.24.0-1, 1.24.0, 1.23.0-1, 1.23.0, 1.22.0-1, 1.22.0, 1.21.0-1, 1.21.0 |
|
1710:e598cd15bd91 | 18-Nov-2020 |
Max Romanov |
Libunit: improving logging consistency.
Debug logging depends on macros defined in nxt_auto_config.h. |
1709:1fe93c17d23f | 17-Nov-2020 |
Valentin Bartenev |
HTTP parser: allowed more characters in header field names.
Previously, all requests that contained in header field names characters other than alphanumeric, or "-", or "_" were rejected with a 400
HTTP parser: allowed more characters in header field names.
Previously, all requests that contained in header field names characters other than alphanumeric, or "-", or "_" were rejected with a 400 "Bad Request" error response.
Now, the parser allows the same set of characters as specified in RFC 7230, including: "!", "#", "$", "%", "&", "'", "*", "+", ".", "^", "`", "|", and "~". Header field names that contain only these characters are considered valid.
Also, there's a new option introduced: "discard_unsafe_fields". It accepts boolean value and it is set to "true" by default.
When this option is "true", all header field names that contain characters in valid range, but other than alphanumeric or "-" are skipped during parsing. When the option is "false", these header fields aren't skipped.
Requests with non-valid characters in header field names according to RFC 7230 are rejected regardless of "discard_unsafe_fields" setting.
This closes #422 issue on GitHub.
show more ...
|
1676:54d88fe4e8b1 | 01-Nov-2020 |
Valentin Bartenev |
Fixed building test app without debug.
Compilers complained about unused variables after 37e2a3ea1bf1. |
1669:37e2a3ea1bf1 | 27-Oct-2020 |
Max Romanov |
Added threading to the libunit test app. |
Revision tags: 1.20.0-1, 1.20.0, 1.19.0-1, 1.19.0 |
|
1563:d32bc428f46b | 12-Aug-2020 |
Valentin Bartenev |
Basic variables support. |
1554:8f22edff911d | 11-Aug-2020 |
Max Romanov |
Circular queues implementations and a test.
- naive circular queue, described in the article "A Scalable, Portable, and Memory-Efficient Lock-Free FIFO Queue" by Ruslan Nikolaev: https://drops.dags
Circular queues implementations and a test.
- naive circular queue, described in the article "A Scalable, Portable, and Memory-Efficient Lock-Free FIFO Queue" by Ruslan Nikolaev: https://drops.dagstuhl.de/opus/volltexte/2019/11335/pdf/LIPIcs-DISC-2019-28.pdf - circular queue, proposed by Valentin Bartenev in the "Unit router application IPC" design draft
show more ...
|
Revision tags: 1.18.0-1, 1.18.0, 1.17.0-1, 1.17.0 |
|
1459:358b957ca294 | 16-Apr-2020 |
Max Romanov |
Using malloc/free for the http fields hash.
This is required due to lack of a graceful shutdown: there is a small gap between the runtime's memory pool release and router process's exit. Thus, a wor
Using malloc/free for the http fields hash.
This is required due to lack of a graceful shutdown: there is a small gap between the runtime's memory pool release and router process's exit. Thus, a worker thread may start processing a request between these two operations, which may result in an http fields hash access and subsequent crash.
To simplify issue reproduction, it makes sense to add a 2 sec sleep before exit() in nxt_runtime_exit().
show more ...
|
1439:32578e837322 | 30-Mar-2020 |
Valentin Bartenev |
Configuration: support for rational numbers. |
Revision tags: 1.16.0-1, 1.16.0, 1.15.0-1, 1.15.0, 1.14.0-1, 1.14.0 |
|
1306:3604d05e48be | 06-Dec-2019 |
Tiago Natel |
Isolation: allowed the use of credentials with unpriv userns.
The setuid/setgid syscalls requires root capabilities but if the kernel supports unprivileged user namespace then the child process has
Isolation: allowed the use of credentials with unpriv userns.
The setuid/setgid syscalls requires root capabilities but if the kernel supports unprivileged user namespace then the child process has the full set of capabilities in the new namespace, then we can allow setting "user" and "group" in such cases (this is a common security use case).
Tests were added to ensure user gets meaningful error messages for uid/gid mapping misconfigurations.
show more ...
|
Revision tags: 1.13.0-1, 1.13.0 |
|
1257:00eea530513c | 11-Nov-2019 |
Max Romanov |
Fixing libunit 'off by 2' issue in library.
Name and value in each header are 0-terminated, so additional 2 bytes should be allocated for them. There were several attempts to add these 2 bytes to h
Fixing libunit 'off by 2' issue in library.
Name and value in each header are 0-terminated, so additional 2 bytes should be allocated for them. There were several attempts to add these 2 bytes to headers in language modules, but some modules weren't updated. Also, adding these 2 bytes is specific to the implementation which may be changed later, so extending this mechanics to modules may cause errors.
show more ...
|
Revision tags: 1.12.0-1, 1.12.0 |
|
1214:c3666b232602 | 30-Sep-2019 |
Valentin Bartenev |
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 targ
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.
show more ...
|
Revision tags: 1.11.0-2, 1.11.0-1, 1.11.0 |
|
1171:968424f2804c | 17-Sep-2019 |
Valentin Bartenev |
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 s
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.
show more ...
|
1170:830d6af7d24c | 16-Sep-2019 |
Valentin Bartenev |
HTTP parser: removed unused "plus_in_target" flag. |
1168:d4b329089cca | 16-Sep-2019 |
Valentin Bartenev |
HTTP parser: removed unused "exten_start" and "args_start" fields. |
Revision tags: 1.10.0-2, 1.10.0-1, 1.10.0 |
|
1131:ec7d924d8dfb | 20-Aug-2019 |
Max Romanov |
Introducing websocket support in router and libunit. |
Revision tags: 1.9.0-1, 1.9.0, 1.8.0-1, 1.8.0, 1.7.1-1, 1.7.1, 1.7-1, 1.7, 1.6-1, 1.6 |
|
840:500c3525e10e | 15-Nov-2018 |
Valentin Bartenev |
Fixed lvlhsh test on 64-bit big-endian systems.
The nxt_murmur_hash2() generated 4-byte hash that was stored in uintptr_t, which was 8 bytes long on 64-bit systems. At each iteration, it took the p
Fixed lvlhsh test on 64-bit big-endian systems.
The nxt_murmur_hash2() generated 4-byte hash that was stored in uintptr_t, which was 8 bytes long on 64-bit systems. At each iteration, it took the previous key and hashed it again.
The problem was that it took only the first 4 bytes of the key, and these 4 bytes were always zero on 64-bit big-endian system. That resulted in equal keys at each iteration.
The bug was discovered on IBM/S390x.
show more ...
|
Revision tags: 1.5-1, 1.5, 1.4-2, 1.4 |
|
743:e0f0cd7d244a | 06-Aug-2018 |
Max Romanov |
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. |