History log of /unit/src/nxt_http_static.c (Results 1 – 25 of 32)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 2247:baa6b9879267 20-Nov-2022 Zhidao HONG

Basic njs support.


# 2246:5f4056478375 20-Nov-2022 Zhidao HONG

Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template

Var: separating nxt_tstr_t from nxt_var_t.

It's for the introduction of njs support.
For each option that supports native variable and JS template literals introduced next,
it's unified as template string.

No functional changes.

show more ...


Revision tags: 1.28.0-1, 1.28.0
# 2166:64a3527f65ad 28-Jul-2022 Zhidao HONG

Log: customizable access log format.


# 2147:7bf58b1b18c4 13-Jul-2022 Zhidao HONG

Var: dynamic variables support.

This commit adds the variables $arg_NAME, $header_NAME, and $cookie_NAME.


# 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 ...


# 2137:96f3ac16391b 06-Jun-2022 Alejandro Colomar

Static: Fixed finding the file extension.

The code for finding the extension made a few assumptions that are
no longer true. It didn't account for pathnames that didn't
contain '/', including the e

Static: Fixed finding the file extension.

The code for finding the extension made a few assumptions that are
no longer true. It didn't account for pathnames that didn't
contain '/', including the empty string, or the NULL string. That
code was used with "share", which always had a '/', but now it's
also used with "index", which should not have a '/' in it.

This fix works by limiting the search to the beginning of the
string, so that if no '/' is found in it, it doesn't continue
searching before the beginning of the string.

This also happens to work for NULL. It is technically Undefined
Behavior, as we rely on `NULL + 0 == NULL` and `NULL - NULL == 0`.
But that is the only sane behavior for an implementation, and all
existing POSIX implementations will Just Work for this code.

Relying on this UB is useful, because we don't need to add an
explicit check for NULL, and therefore we have faster code.
Although the current code can't have a NULL, I expect that when we
add support for variables in the index, it will be NULL in some
cases.

Link: <https://stackoverflow.com/q/67291052/6872717>

The same code seems to be defined behavior in C++, which normally
will share implementation in the compiler for these cases, and
therefore it is really unlikely to be in trouble.

Link: <https://stackoverflow.com/q/59409034/6872717>

show more ...


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 ...


# 2106:593408956b69 14-Feb-2022 Alejandro Colomar

Static: returning 404 when "index" is a non-regular file.

Before this patch, if "index" was a file, but not a regular file
nor a directory, so it may have been for example a FIFO, Unit
returned 404.

Static: returning 404 when "index" is a non-regular file.

Before this patch, if "index" was a file, but not a regular file
nor a directory, so it may have been for example a FIFO, Unit
returned 404. But if "index" was a directory, Unit returned 301.

For consistency, this patch makes Unit return 404 for every
non-regular file, including directories.

show more ...


# 2096:02c01e609dc9 09-Dec-2021 Alejandro Colomar

Renamed nxt_http_static_ctx_t field 'index' to 'share_idx'.

Having a configurable index filename will require adding an index
field to this structure. The most natural name for that field is
'index

Renamed nxt_http_static_ctx_t field 'index' to 'share_idx'.

Having a configurable index filename will require adding an index
field to this structure. The most natural name for that field is
'index', so the current index field should be renamed to allow for
that. A sensible name is 'share_idx', since it's the index of the
shares array in 'nxt_http_static_conf_t'.

Instead of 'share_index' I opted for the shorter 'share_idx'.
Also, when 'index' allows an array of filenames in a following
commit, another similar variable 'index_idx' should be created,
and having a different prefix and suffix seems more readable than
for example 'index_index'.

show more ...


# 2077:624e51cfe97a 18-Dec-2021 Alejandro Colomar

Removed special cases for non-NXT_CONF_VALUE_ARRAY.

The previous commit added more generic APIs for handling
NXT_CONF_VALUE_ARRAY and non-NXT_CONF_VALUE_ARRAY together.
Modify calling code to remove

Removed special cases for non-NXT_CONF_VALUE_ARRAY.

The previous commit added more generic APIs for handling
NXT_CONF_VALUE_ARRAY and non-NXT_CONF_VALUE_ARRAY together.
Modify calling code to remove special cases for arrays and
non-arrays, taking special care that the path for non arrays is
logically equivalent to the previous special cased code.
Use the now-generic array code only.

show more ...


Revision tags: 1.26.1-1, 1.26.1, 1.26.0-1, 1.26.0
# 1963:9045a8bb896a 04-Oct-2021 Valentin Bartenev

Static: removed surplus assignment.

It's not needed after 69d823e5710a.
Found by Clang Static Analyzer.


# 1962:13542e2a30e3 04-Oct-2021 Valentin Bartenev

Static: fixed possible descriptor leak introduced in a946d8cd7f8c.


# 1961:69d823e5710a 01-Oct-2021 Zhidao HONG

Static: multiple paths in the "share" option.


# 1960:a5c08e4a9946 30-Sep-2021 Zhidao HONG

Static: variables in the "share" option.

This commit supports variable in the "share" option, the finding path to
file serve is the value from "share". An example:
{
"share": "/www/data/static$u

Static: variables in the "share" option.

This commit supports variable in the "share" option, the finding path to
file serve is the value from "share". An example:
{
"share": "/www/data/static$uri"
}

show more ...


# 1959:45b25ffb2e8c 28-Sep-2021 Zhidao HONG

Static: variables in the "chroot" option.


Revision tags: 1.25.0-1, 1.25.0
# 1923:9f268a8a1a2f 23-Jul-2021 Zhidao HONG

Router: split nxt_http_static_conf_t from nxt_http_action_t.

No functional changes.


Revision tags: 1.24.0-1, 1.24.0
# 1883:b075f32408a1 26-May-2021 Oisin Canty

Static: handled unknown MIME types when MIME-filtering active.


# 1882:65e7dcdd7be4 26-May-2021 Oisin Canty

MIME: added PHP.


# 1859:970f9f72c29d 06-May-2021 Oisin Canty

Static: implemented MIME filtering


# 1857:265d1d735a4e 05-May-2021 Zhidao HONG

Fixed format and arguments mismatches in error log messages.


# 1856:d7f5e641dffd 05-May-2021 Zhidao HONG

Fixed building without openat2().


# 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
# 1760:e1dd32f17a18 23-Dec-2020 Max Romanov

Static: fixing request memory pool leakage in router.

When a static file larger than NXT_HTTP_STATIC_BUF_SIZE (128K) is served, two
buffers are allocated and chained; each retains the whole request

Static: fixing request memory pool leakage in router.

When a static file larger than NXT_HTTP_STATIC_BUF_SIZE (128K) is served, two
buffers are allocated and chained; each retains the whole request memory pool.

Starting from 41331471eee7, the completion handler was called once for a linked
buffer chain, but the second buffer got lost.

This patch improves the completion handler's treatment of static buffers to
handle all linked buffers.

show more ...


Revision tags: 1.21.0-1, 1.21.0, 1.20.0-1, 1.20.0
# 1617:c1f6f719cf1d 29-Sep-2020 Valentin Bartenev

MIME: added AVIF and APNG image formats.

AVIF is a modern image format based on the AV1 video codec. It generally has
better compression than other widely used formats (WebP, JPEG, PNG, and GIF)
an

MIME: added AVIF and APNG image formats.

AVIF is a modern image format based on the AV1 video codec. It generally has
better compression than other widely used formats (WebP, JPEG, PNG, and GIF)
and is designed to supersede them. Support was already added to the latest
version of Chrome.

APNG extends PNG to permit animated images that work similarly to animated GIF.
It's supported by most modern browsers.

Also removed duplicated ".svg" entry.

show more ...


12