| Age | Commit message (Collapse) | Author | Files | Lines |
|
This is similar to atoi(3) in usage, except that:
- It's safe (doesn't have Undefined Behavior).
- It receives a nxt_str_t instead of a string.
- The base is 0, not 10.
Errors are reported with the same error codes as in strtou(3bsd), but
they are reported via errno, instead of passing a pointer to an int.
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
This function is like strtoul(3), but it rejects negative numbers,
instead of silently converting them into unsigned, which strtoul(3)
does.
Link: <https://blog.habets.se/2022/10/No-way-to-parse-integers-in-C.html>
Link: <https://softwareengineering.stackexchange.com/a/449060/332848>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
|
|
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>
|
|
As was pointed out by the cppcheck[0] static code analysis utility we
can mark numerous function parameters as 'const'. This acts as a hint to
the compiler about our intentions and the compiler will tell us when we
deviate from them.
[0]: https://cppcheck.sourceforge.io/
|
|
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.
|
|
|
|
|
|
|
|
Now '>', '<', '"', '^', '\', '}', '|', '{', and '`' are also escaped.
|
|
|
|
|
|
Now URI encoding can be used to escape "/" in the request path:
GET /config/listeners/unix:%2Fpath%2Fto%2Fsocket/
|
|
|
|
|
|
|
|
|
|
|
|
Configuration and building example:
./configure
./configure python
./configure php
./configure go
make all
or
./configure
make nginext
./configure python
make python
./configure php
make php
./configure go
make go
Modules configuration options and building examples:
./configure python --module=python2 --config=python2.7-config
make python2
./configure php --module=php7 --config=php7.0-config
--lib-path=/usr/local/php7.0
make php7
./configure go --go=go1.6 --go-path=${HOME}/go1.6
make go1.6
|
|
|
|
|
|
|
|
|
|
|