History log of /unit/src/nxt_http.h (Results 1 – 25 of 62)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2139:99d792169ffb 16-Jun-2022 Andrew Clayton

Constified numerous function parameters.

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 a

Constified numerous function parameters.

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/

show more ...


# 2133:46433e3cef45 20-Jun-2022 Zhidao HONG

Router: forwared header replacement.


# 2132:34d63ed988dc 20-Jun-2022 Zhidao HONG

Router: introduced nxt_http_forward_t.

This makes the replacement of forwarded request header
like client_ip and protocol more generic.
It's a prerequirement for protocol replacement.

No functional

Router: introduced nxt_http_forward_t.

This makes the replacement of forwarded request header
like client_ip and protocol more generic.
It's a prerequirement for protocol replacement.

No functional changes.

show more ...


# 2123:36000da0aa5b 19-May-2022 Zhidao HONG

HTTP: generalized uri encoding.

No functional changes.


Revision tags: 1.27.0-1, 1.27.0
# 2108:6e059f15e713 09-Dec-2021 Alejandro Colomar

Static: supporting new "index" option.

This supports a new option "index" that configures a custom index
file name to be served when a directory is requested. This
initial support only allows a sin

Static: supporting new "index" option.

This supports a new option "index" that configures a custom index
file name to be served when a directory is requested. This
initial support only allows a single fixed string. An example:

{
"share": "/www/data/static/$uri",
"index": "lookatthis.htm"
}

When <example.com/foo/bar/> is requested,
</www/data/static/foo/bar/lookatthis.html> is served.

Default is "index.html".

===

nxt_conf_validator.c:

Accept "index" as a member of "share", and make sure it's a string.

===

I tried this feature in my own computer, where I tried the
following:

- Setting "index" to "lookatthis.htm", and check that the correct
file is being served (check both a different name and a
different extension).
- Not setting "index", and check that <index.html> is being
served.
- Settind "index" to an array of strings, and check that the
configuration fails:

{
"error": "Invalid configuration.",
"detail": "The \"index\" value must be a string, but not an array."
}

show more ...


# 2104:2ae3c205fcad 18-May-2022 Zhidao HONG

HTTP: generalized argument and cookie parsing.

No functional changes.


# 2098:9a890f0c56aa 09-Apr-2022 Alejandro Colomar

Supporting empty Location URIs.

An empty string in Location was being handled specially by not sending a
Location header. This may occur after variable resolution, so we need to
consider this scena

Supporting empty Location URIs.

An empty string in Location was being handled specially by not sending a
Location header. This may occur after variable resolution, so we need to
consider this scenario.

The obsolete RFC 2616 defined the Location header as consisting of an absolute
URI <https://www.rfc-editor.org/rfc/rfc2616#section-14.30>, which cannot be an
empty string. However, the current RFC 7231 allows the Location to be a
relative URI <https://www.rfc-editor.org/rfc/rfc7231#section-7.1.2>, and a
relative URI may be an empty string <https://stackoverflow.com/a/43338457>.

Due to these considerations, this patch allows sending an empty Location header
without handling this case specially. This behavior will probably be more
straightforward to users, too. It also simplifies the code, which is now more
readable, fast, and conformant to the current RFC. We're skipping an
allocation at request time in a common case such as "action": {"return": 404}

show more ...


# 2078:0996dd223cdd 18-Dec-2021 Alejandro Colomar

Fixed indentation.

Some lines (incorrectly) had an indentation of 3 or 5, or 7 or 9,
or 11 or 13, or 15 or 17 spaces instead of 4, 8, 12, or 16. Fix them.

Found with:

$ find src -type f | xargs g

Fixed indentation.

Some lines (incorrectly) had an indentation of 3 or 5, or 7 or 9,
or 11 or 13, or 15 or 17 spaces instead of 4, 8, 12, or 16. Fix them.

Found with:

$ find src -type f | xargs grep -n '^ [^ ]';
$ find src -type f | xargs grep -n '^ [^ *]';
$ find src -type f | xargs grep -n '^ [^ ]';
$ find src -type f | xargs grep -n '^ [^ *]';
$ find src -type f | xargs grep -n '^ [^ +]';
$ find src -type f | xargs grep -n '^ [^ *+]';
$ find src -type f | xargs grep -n '^ [^ +]';
$ find src -type f | xargs grep -n '^ [^ *+]';

show more ...


Revision tags: 1.26.1-1, 1.26.1, 1.26.0-1, 1.26.0
# 1991:61155eb41a96 05-Nov-2021 Zhidao HONG

Router: matching query string support.

The "query" option matches decoded arguments, including plus ('+') to
space (' '). Like "uri", it can be a string or an array of strings.


# 1954:8f18a05d4c58 07-Sep-2021 Zhidao HONG

Router: refactored variable pass.

Since the "pass" option supports both strings and variables, a generic
nxt_var_t structure can be used in the configuration phase, and the "name"
field in actions i

Router: refactored variable pass.

Since the "pass" option supports both strings and variables, a generic
nxt_var_t structure can be used in the configuration phase, and the "name"
field in actions is redundant.

No functional changes.

show more ...


Revision tags: 1.25.0-1, 1.25.0
# 1936:953434450ea9 12-Aug-2021 Oisin Canty

Router: client IP address replacement.

This commit introduces the replacement of the client address based on the value
of a specified HTTP header. This is intended for use when Unit is placed
behin

Router: client IP address replacement.

This commit introduces the replacement of the client address based on the value
of a specified HTTP header. This is intended for use when Unit is placed
behind a reverse proxy like nginx or a CDN.

You must specify the source addresses of the trusted proxies. This can be
accomplished with any valid IP pattern supported by Unit's match block:

["10.0.0.1", "10.4.0.0/16", "!192.168.1.1"]

The feature is configured per listener.

The client address replacement functionality only operates when there is a
source IP match and the specified header is present. Typically this would be
an 'X-Forwarded-For' header.

{
"listeners": {
"127.0.0.1:8080": {
"client_ip": {
"header": "X-Forwarded-For",
"source": [
"10.0.0.0/8"
]
},
"pass": "applications/my_app"
},
}
}

If a request occurs and Unit receives a header like below:

"X-Forwarded-For: 84.123.23.23"

By default, Unit trusts the last rightmost IP in the header, so REMOTE_ADDR
will be set to 84.123.23.23 if the connection originated from 10.0.0.0/8.

If Unit runs behind consecutive reverse proxies and receives a header similar
to the following:

"X-Forwarded-For: 84.123.23.23, 10.0.0.254"

You will need to enable "recursive" checking, which walks the header from
last address to first and chooses the first non-trusted address it finds.

{
"listeners": {
"127.0.0.1:8080": {
"client_ip": {
"header": "X-Forwarded-For",
"source": [
"10.0.0.0/8"
]
"recursive": true,
},
"pass": "applications/my_app"
},
}
}

If a connection from 10.0.0.0/8 occurs, the chain is walked. Here, 10.0.0.254
is also a trusted address so the client address will be replaced with
84.123.23.23.

If all IP addresses in the header are trusted, the client address is set to
the first address in the header:

If 10.0.0.0/8 is trusted and "X-Forwarded-For: 10.0.0.3, 10.0.0.2, 10.0.0.1",
the client address will be replaced with 10.0.0.3.

show more ...


# 1925:b8a2ac618950 24-Jul-2021 Zhidao HONG

Router: split nxt_http_app_conf_t from nxt_http_action_t.

No functional changes.


# 1924:96d090de7534 26-Jul-2021 Zhidao HONG

Router: renamed nxt_http_proxy_create() as nxt_http_proxy_init().

No functional changes.


# 1923:9f268a8a1a2f 23-Jul-2021 Zhidao HONG

Router: split nxt_http_static_conf_t from nxt_http_action_t.

No functional changes.


# 1903:f17827e75e25 24-May-2021 Zhidao HONG

Router: split nxt_http_return_conf_t from nxt_http_action_t.

No functional changes.


Revision tags: 1.24.0-1, 1.24.0
# 1859:970f9f72c29d 06-May-2021 Oisin Canty

Static: implemented MIME filtering


# 1855:a946d8cd7f8c 29-Apr-2021 Zhidao HONG

Static: support for openat2() features.

Support for chrooting, rejecting symlinks, and rejecting crossing mounting
points on a per-request basis during static file serving.


# 1854:aebe76640568 22-Apr-2021 Zhidao HONG

Router: grouped app and share fields in nxt_http_action_t.

This is a prerequisite for further introduction of openat2() features.
No functional changes.


Revision tags: 1.23.0-1, 1.23.0, 1.22.0-1, 1.22.0
# 1733:dab8544b5440 07-Dec-2020 Valentin Bartenev

PHP: populating PHP_AUTH_* server variables.

This closes #498 issue on GitHub.


Revision tags: 1.21.0-1, 1.21.0
# 1721:53b6ab9b324b 17-Nov-2020 Axel Duch

Router: matching regular expressions support.


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.


# 1561:4dae2fd8e02a 12-Aug-2020 Max Romanov

Responding with error in case of first process start failure.

After shared application port introducing, request queue in router was
removed and requests may stuck forever waiting for another proces

Responding with error in case of first process start failure.

After shared application port introducing, request queue in router was
removed and requests may stuck forever waiting for another process start.

show more ...


# 1505:d18f2b38596b 23-Jun-2020 Igor Sysoev

Upstream chunked transfer encoding support.


Revision tags: 1.18.0-1, 1.18.0
# 1473:e07d5b451423 14-May-2020 Valentin Bartenev

PHP: implemented "targets" option.

This allows to specify multiple subsequent targets inside PHP applications.
For example:

{
"listeners": {
"*:80": {
"pass": "route

PHP: implemented "targets" option.

This allows to specify multiple subsequent targets inside PHP applications.
For example:

{
"listeners": {
"*:80": {
"pass": "routes"
}
},

"routes": [
{
"match": {
"uri": "/info"
},

"action": {
"pass": "applications/my_app/phpinfo"
}
},
{
"match": {
"uri": "/hello"
},

"action": {
"pass": "applications/my_app/hello"
}
},
{
"action": {
"pass": "applications/my_app/rest"
}
}
],

"applications": {
"my_app": {
"type": "php",
"targets": {
"phpinfo": {
"script": "phpinfo.php",
"root": "/www/data/admin",
},

"hello": {
"script": "hello.php",
"root": "/www/data/test",
},

"rest": {
"root": "/www/data/example.com",
"index": "index.php"
},
}
}
}
}

show more ...


# 1472:88536f5bd13f 14-May-2020 Valentin Bartenev

Configuration: URI encoding in the "pass" option.

This is useful to escape "/" in path fragments. For example, in order
to reference the application named "foo/bar":

{
"pass": "application

Configuration: URI encoding in the "pass" option.

This is useful to escape "/" in path fragments. For example, in order
to reference the application named "foo/bar":

{
"pass": "applications/foo%2Fbar"
}

show more ...


123