Compare commits

..

46 Commits

Author SHA1 Message Date
Maxim Dounin 00a034ce37 release-1.10.3 tag 2017-01-31 18:01:10 +03:00
Maxim Dounin 05dbd1fe03 nginx-1.10.3-RELEASE 2017-01-31 18:01:10 +03:00
Maxim Dounin 9fe5995705 Updated OpenSSL used for win32 builds. 2017-01-27 19:06:35 +03:00
Maxim Dounin 03e74aacb3 Updated zlib and PCRE used for win32 builds. 2017-01-24 16:41:29 +03:00
Maxim Dounin 33385cf1e4 Upstream: fixed cache corruption and socket leaks with aio_write.
The ngx_event_pipe() function wasn't called on write events with
wev->delayed set.  As a result, threaded writing results weren't
properly collected in ngx_event_pipe_write_to_downstream() when a
write event was triggered for a completed write.

Further, this wasn't detected, as p->aio was reset by a thread completion
handler, and results were later collected in ngx_event_pipe_read_upstream()
instead of scheduling a new write of additional data.  If this happened
on the last reading from an upstream, last part of the response was never
written to the cache file.

Similar problems might also happen in case of timeouts when writing to
client, as this also results in ngx_event_pipe() not being called on write
events.  In this scenario socket leaks were observed.

Fix is to check if p->writing is set in ngx_event_pipe_read_upstream(), and
therefore collect results of previous write operations in case of read events
as well, similar to how we do so in ngx_event_pipe_write_downstream().
This is enough to fix the wev->delayed case.  Additionally, we now call
ngx_event_pipe() from ngx_http_upstream_process_request() if there are
uncollected write operations (p->writing and !p->aio).  This also fixes
the wev->timedout case.
2017-01-20 21:14:19 +03:00
Maxim Dounin 0e9f489735 Fixed trailer construction with limit on FreeBSD and macOS.
The ngx_chain_coalesce_file() function may produce more bytes to send then
requested in the limit passed, as it aligns the last file position
to send to memory page boundary.  As a result, (limit - send) may become
negative.  This resulted in big positive number when converted to size_t
while calling ngx_output_chain_to_iovec().

Another part of the problem is in ngx_chain_coalesce_file(): it changes cl
to the next chain link even if the current buffer is only partially sent
due to limit.

Therefore, if a file buffer was not expected to be fully sent due to limit,
and was followed by a memory buffer, nginx called sendfile() with a part
of the file buffer, and the memory buffer in trailer.  If there were enough
room in the socket buffer, this resulted in a part of the file buffer being
skipped, and corresponding part of the memory buffer sent instead.

The bug was introduced in 8e903522c17a (1.7.8).  Configurations affected
are ones using limits, that is, limit_rate and/or sendfile_max_chunk, and
memory buffers after file ones (may happen when using subrequests or
with proxying with disk buffering).

Fix is to explicitly check if (send < limit) before constructing trailer
with ngx_output_chain_to_iovec().  Additionally, ngx_chain_coalesce_file()
was modified to preserve unfinished file buffers in cl.
2017-01-20 21:12:48 +03:00
Valentin Bartenev 1cce6c190a HTTP/2: prevented creating temp files for requests without body.
The problem was introduced by 52bd8cc17f34.
2016-12-10 13:23:38 +03:00
Valentin Bartenev 0766c0922c HTTP/2: fixed posted streams handling.
A bug was introduced by 82efcedb310b that could lead to timing out of
responses or segmentation fault, when accept_mutex was enabled.

The output queue in HTTP/2 can contain frames from different streams.
When the queue is sent, all related write handlers need to be called.
In order to do so, the streams were added to the h2c->posted queue
after handling sent frames.  Then this queue was processed in
ngx_http_v2_write_handler().

If accept_mutex is enabled, the event's "ready" flag is set but its
handler is not called immediately.  Instead, the event is added to
the ngx_posted_events queue.  At the same time in this queue can be
events from upstream connections.  Such events can result in sending
output queue before ngx_http_v2_write_handler() is triggered.  And
at the time ngx_http_v2_write_handler() is called, the output queue
can be already empty with some streams added to h2c->posted.

But after 82efcedb310b, these streams weren't processed if all frames
have already been sent and the output queue was empty.  This might lead
to a situation when a number of streams were get stuck in h2c->posted
queue for a long time.  Eventually these streams might get closed by
the send timeout.

In the worst case this might also lead to a segmentation fault, if
already freed stream was left in the h2c->posted queue.  This could
happen if one of the streams was terminated but wasn't closed, due to
the HEADERS frame or a partially sent DATA frame left in the output
queue.  If this happened the ngx_http_v2_filter_cleanup() handler
removed the stream from the h2c->waiting or h2c->posted queue on
termination stage, before the frame has been sent, and the stream
was again added to the h2c->posted queue after the frame was sent.

In order to fix all these problems and simplify the code, write
events of fake stream connections are now added to ngx_posted_events
instead of using a custom h2c->posted queue.
2016-11-28 20:58:14 +03:00
Valentin Bartenev 45c8e9a64d HTTP/2: fixed saving preread buffer to temp file (ticket #1143).
Previously, a request body bigger than "client_body_buffer_size" wasn't written
into a temporary file if it has been pre-read entirely.  The preread buffer
is freed after processing, thus subsequent use of it might result in sending
corrupted body or cause a segfault.
2016-11-28 19:19:21 +03:00
Valentin Bartenev 825c0fbd2c HTTP/2: graceful shutdown of active connections (closes #1106).
Previously, while shutting down gracefully, the HTTP/2 connections were
closed in transition to idle state after all active streams have been
processed.  That might never happen if the client continued opening new
streams.

Now, nginx sends GOAWAY to all HTTP/2 connections and ignores further
attempts to open new streams.  A worker process will quit as soon as
processing of already opened streams is finished.
2016-10-20 16:15:03 +03:00
Maxim Dounin 15a95ba306 Core: sockaddr lengths now respected by ngx_cmp_sockaddr().
Linux can return AF_UNIX sockaddrs with partially filled sun_path,
resulting in spurious comparison failures and failed binary upgrades.
Added proper checking of the lengths provided.

Reported by Jan Seda,
http://mailman.nginx.org/pipermail/nginx-devel/2016-September/008832.html.
2016-10-10 16:15:41 +03:00
Roman Arutyunyan cf35a0cfb1 Addition filter: set last_in_chain flag when clearing last_buf.
When the last_buf flag is cleared for add_after_body to append more data from a
subrequest, other filters may still have buffered data, which should be flushed
at this point.  For example, the sub_filter may have a partial match buffered,
which will only be flushed after the subrequest is done, ending up with
interleaved data in output.

Setting last_in_chain instead of last_buf flushes the data and fixes the order
of output buffers.
2016-10-03 21:03:27 +03:00
Maxim Dounin 2f5d9e205b Version bump. 2017-01-31 16:15:31 +03:00
Maxim Dounin 947a477636 release-1.10.2 tag 2016-10-18 18:03:13 +03:00
Maxim Dounin 08d0ab04c2 nginx-1.10.2-RELEASE 2016-10-18 18:03:12 +03:00
Maxim Dounin 4bf20e7512 SSL: default DH parameters compatible with OpenSSL 1.1.0.
This is a direct commit to stable as there is no corresponding code
in mainline, default DH parameters were removed in 1aa9650a8154.
2016-10-18 17:25:38 +03:00
Maxim Dounin 09acff05dd Updated OpenSSL used for win32 builds. 2016-10-11 16:52:48 +03:00
Maxim Dounin 8015fc1c8a Event pipe: do not set file's thread_handler if not needed.
This fixes a problem with aio threads and sendfile with aio_write switched
off, as observed with range requests after fc72784b1f52 (1.9.13).  Potential
problems with sendfile in threads were previously described in 9fd738b85fad,
and this seems to be one of them.

The problem occurred as file's thread_handler was set to NULL by event pipe
code after a sendfile thread task was scheduled.  As a result, no sendfile
completion code was executed, and the same buffer was additionally sent
using non-threaded sendfile.  Fix is to avoid modifying file's thread_handler
if aio_write is switched off.

Note that with "aio_write on" it is still possible that sendfile will use
thread_handler as set by event pipe.  This is believed to be safe though,
as handlers used are compatible.
2016-09-01 20:05:23 +03:00
Sergey Kandaurov d8419d7728 SSL: adopted session ticket handling for OpenSSL 1.1.0.
Return 1 in the SSL_CTX_set_tlsext_ticket_key_cb() callback function
to indicate that a new session ticket is created, as per documentation.
Until 1.1.0, OpenSSL didn't make a distinction between non-negative
return values.

See https://git.openssl.org/?p=openssl.git;a=commitdiff;h=5c753de for details.
2016-08-22 18:53:21 +03:00
Sergey Kandaurov bce014aa05 SSL: guarded SSL_R_NO_CIPHERS_PASSED not present in OpenSSL 1.1.0.
It was removed in OpenSSL 1.1.0 Beta 3 (pre-release 6).  It was
not used since OpenSSL 1.0.1n and 1.0.2b.
2016-08-08 13:44:49 +03:00
Valentin Bartenev 264b89563e HTTP/2: flushing of the SSL buffer in transition to the idle state.
It fixes potential connection leak if some unsent data was left in the SSL
buffer.  Particularly, that could happen when a client canceled the stream
after the HEADERS frame has already been created.  In this case no other
frames might be produced and the HEADERS frame alone didn't flush the buffer.
2016-07-19 20:34:17 +03:00
Valentin Bartenev 52340fac51 HTTP/2: refactored ngx_http_v2_send_output_queue().
Now it returns NGX_AGAIN if there's still data to be sent.
2016-07-19 20:34:02 +03:00
Valentin Bartenev 5a66aa321b HTTP/2: fixed send timer handling.
Checking for return value of c->send_chain() isn't sufficient since there
are data can be left in the SSL buffer.  Now the wew->ready flag is used
instead.

In particular, this fixed a connection leak in cases when all streams were
closed, but there's still some data to be sent in the SSL buffer and the
client forgot about the connection.
2016-07-19 20:31:09 +03:00
Valentin Bartenev ae4580e28e HTTP/2: avoid sending output queue if there's nothing to send.
Particularly this fixes alerts on OS X and NetBSD systems when HTTP/2 is
configured over plain TCP sockets.

On these systems calling writev() with no data leads to EINVAL errors
being logged as "writev() failed (22: Invalid argument) while processing
HTTP/2 connection".
2016-07-19 20:30:21 +03:00
Valentin Bartenev 7d1859c37b HTTP/2: always handle streams in error state.
Previously, a stream could be closed by timeout if it was canceled
while its send window was exhausted.
2016-07-19 20:22:44 +03:00
Valentin Bartenev ddaedb6c20 HTTP/2: prevented output of the HEADERS frame for canceled streams.
It's useless to generate HEADERS if the stream has been canceled already.
2016-07-19 20:22:44 +03:00
Valentin Bartenev a010c05355 HTTP/2: always send GOAWAY while worker is shutting down.
Previously, if the worker process exited, GOAWAY was sent to connections in
idle state, but connections with active streams were closed without GOAWAY.
2016-07-19 20:22:44 +03:00
Maxim Dounin b2648441a3 Updated PCRE used for win32 builds. 2016-07-05 18:30:56 +03:00
Roman Arutyunyan e539d7b926 Sub filter: eliminate unnecessary buffering.
Previously, when a buffer was processed by the sub filter, its final bytes
could be buffered by the filter even if they don't match any pattern.
This happened because the Boyer-Moore algorithm, employed by the sub filter
since b9447fc457b4 (1.9.4), matches the last characters of patterns prior to
checking other characters.  If the last character is out of scope, initial
bytes of a potential match are buffered until the last character is available.

Now, after receiving a flush or recycled buffer, the filter performs
additional checks to reduce the number of buffered bytes.  The potential match
is checked against the initial parts of all patterns.  Non-matching bytes are
not buffered.  This improves processing of a chunked response from upstream
by sending the entire chunks without buffering unless a partial match is found
at the end of a chunk.
2016-07-02 15:59:53 +03:00
Roman Arutyunyan 8886b48a05 Sub filter: introduced the ngx_http_sub_match() function.
No functional changes.
2016-07-02 15:59:52 +03:00
Valentin Bartenev 5d7c5f6b8d HTTP/2: fixed the "http request count is zero" alert.
When the stream is terminated the HEADERS frame can still wait in the output
queue.  This frame can't be removed and must be sent to the client anyway,
since HTTP/2 uses stateful compression for headers.  So in order to postpone
closing and freeing memory of such stream the special close stream handler
is set to the write event.  After the HEADERS frame is sent the write event
is called and the stream will be finally closed.

Some events like receiving a RST_STREAM can trigger the read handler of such
stream in closing state and cause unexpected processing that can result in
another attempt to finalize the request.  To prevent it the read handler is
now set to ngx_http_empty_handler.

Thanks to Amazon.
2016-06-16 20:55:11 +03:00
Valentin Bartenev c2897b0028 HTTP/2: avoid adding Content-Length for requests without body.
There is no reason to add the "Content-Length: 0" header to a proxied request
without body if the header isn't presented in the original request.

Thanks to Amazon.
2016-06-16 20:55:11 +03:00
Valentin Bartenev 8b306c84a6 HTTP/2: prevented double termination of a stream.
According to RFC 7540, an endpoint should not send more than one RST_STREAM
frame for any stream.

Also, now all the data frames will be skipped while termination.
2016-06-16 20:55:11 +03:00
Valentin Bartenev a01ccaa262 HTTP/2: fixed a segfault while processing unbuffered upload.
The ngx_http_v2_finalize_connection() closes current stream, but that is an
invalid operation while processing unbuffered upload.  This results in access
to already freed memory, since the upstream module sets a cleanup handler that
also finalizes the request.
2016-06-16 20:55:11 +03:00
Valentin Bartenev 8d58d6a209 HTTP/2: unbreak build on MSVC. 2016-05-24 21:54:32 +03:00
Valentin Bartenev 1aa0c26ed7 HTTP/2: implemented preread buffer for request body (closes #959).
Previously, the stream's window was kept zero in order to prevent a client
from sending the request body before it was requested (see 887cca40ba6a for
details).  Until such initial window was acknowledged all requests with
data were rejected (see 0aa07850922f for details).

That approach revealed a number of problems:

 1. Some clients (notably MS IE/Edge, Safari, iOS applications) show an error
    or even crash if a stream is rejected;

 2. This requires at least one RTT for every request with body before the
    client receives window update and able to send data.

To overcome these problems the new directive "http2_body_preread_size" is
introduced.  It sets the initial window and configures a special per stream
preread buffer that is used to save all incoming data before the body is
requested and processed.

If the directive's value is lower than the default initial window (65535),
as previously, all streams with data will be rejected until the new window
is acknowledged.  Otherwise, no special processing is used and all requests
with data are welcome right from the connection start.

The default value is chosen to be 64k, which is bigger than the default
initial window.  Setting it to zero is fully complaint to the previous
behavior.
2016-05-24 17:37:52 +03:00
Valentin Bartenev bceba50d83 HTTP/2: the "421 Misdirected Request" response (closes #848).
Since 4fbef397c753 nginx rejects with the 400 error any attempts of
requesting different host over the same connection, if the relevant
virtual server requires verification of a client certificate.

While requesting hosts other than negotiated isn't something legal
in HTTP/1.x, the HTTP/2 specification explicitly permits such requests
for connection reuse and has introduced a special response code 421.

According to RFC 7540 Section 9.1.2 this code can be sent by a server
that is not configured to produce responses for the combination of
scheme and authority that are included in the request URI.  And the
client may retry the request over a different connection.

Now this code is used for requests that aren't authorized in current
connection.  After receiving the 421 response a client will be able
to open a new connection, provide the required certificate and retry
the request.

Unfortunately, not all clients currently are able to handle it well.
Notably Chrome just shows an error, while at least the latest version
of Firefox retries the request over a new connection.
2016-05-20 18:41:17 +03:00
Maxim Dounin bf9fb349cc Version bump. 2016-10-18 17:19:51 +03:00
Maxim Dounin 013bbc7229 release-1.10.1 tag 2016-05-31 16:47:01 +03:00
Maxim Dounin 3c32d7d704 nginx-1.10.1-RELEASE 2016-05-31 16:47:01 +03:00
Maxim Dounin f3918385a9 Core: skip special buffers on writing (ticket #981).
A special last buffer with cl->buf->pos set to NULL can be present in
a chain when writing request body if chunked encoding was used.  This
resulted in a NULL pointer dereference if it happened to be the only
buffer left after a do...while loop iteration in ngx_write_chain_to_file().

The problem originally appeared in nginx 1.3.9 with chunked encoding
support.  Additionally, rev. 3832b608dc8d (nginx 1.9.13) changed the
minimum number of buffers to trigger this from IOV_MAX (typically 1024)
to NGX_IOVS_PREALLOCATE (typically 64).

Fix is to skip such buffers in ngx_chain_to_iovec(), much like it is
done in other places.
2016-05-31 05:13:30 +03:00
Maxim Dounin 62c778b7ae Updated OpenSSL used for win32 builds. 2016-05-24 17:44:01 +03:00
Maxim Dounin 415727f942 Version bump. 2016-05-31 02:21:38 +03:00
Maxim Dounin 1c1ca5cf26 release-1.10.0 tag 2016-04-26 16:31:18 +03:00
Maxim Dounin d88e9a5471 nginx-1.10.0-RELEASE 2016-04-26 16:31:18 +03:00
Maxim Dounin 5084075df3 Stable branch. 2016-04-26 16:30:30 +03:00
378 changed files with 12564 additions and 79920 deletions

389
README
View File

@ -1,389 +0,0 @@
Experimental QUIC support for nginx
-----------------------------------
1. Introduction
2. Building from sources
3. Configuration
4. Directives
5. Clients
6. Troubleshooting
7. Contributing
8. Links
1. Introduction
This is an experimental QUIC [1] / HTTP/3 [2] support for nginx.
The code is developed in a separate "quic" branch available
at https://hg.nginx.org/nginx-quic. Currently it is based
on nginx mainline 1.23.x. We merge new nginx releases into
this branch regularly.
The project code base is under the same BSD license as nginx.
The code is currently at a beta level of quality, however
there are several production deployments with it.
NGINX Development Team is working on improving HTTP/3 support to
integrate it into the main NGINX codebase. Thus, expect further
updates of this code, including features, changes in behaviour,
bug fixes, and refactoring. NGINX Development team will be
grateful for any feedback and code submissions.
Please contact NGINX Development Team via nginx-devel mailing list [3].
What works now:
IETF QUIC version 1 is supported. Internet drafts are no longer supported.
nginx should be able to respond to HTTP/3 requests over QUIC and
it should be possible to upload and download big files without errors.
+ The handshake completes successfully
+ One endpoint can update keys and its peer responds correctly
+ 0-RTT data is being received and acted on
+ Connection is established using TLS Resume Ticket
+ A handshake that includes a Retry packet completes successfully
+ Stream data is being exchanged and ACK'ed
+ An H3 transaction succeeded
+ One or both endpoints insert entries into dynamic table and
subsequently reference them from header blocks
+ Version Negotiation packet is sent to client with unknown version
+ Lost packets are detected and retransmitted properly
+ Clients may migrate to new address
2. Building from sources
The build is configured using the configure command.
Refer to http://nginx.org/en/docs/configure.html for details.
When configuring nginx, it's possible to enable QUIC and HTTP/3
using the following new configuration options:
--with-http_v3_module - enable QUIC and HTTP/3
--with-stream_quic_module - enable QUIC in Stream
A library that provides QUIC support is recommended to build nginx, there
are several of those available on the market:
+ BoringSSL [4]
+ LibreSSL [5]
+ QuicTLS [6]
Alternatively, nginx can be configured with OpenSSL compatibility
layer, which emulates BoringSSL QUIC API for OpenSSL. This mode is
enabled by default if native QUIC support is not detected.
0-RTT is not supported in OpenSSL compatibility mode.
Clone the NGINX QUIC repository
$ hg clone -b quic https://hg.nginx.org/nginx-quic
$ cd nginx-quic
Use the following command to configure nginx with BoringSSL [4]
$ ./auto/configure --with-debug --with-http_v3_module \
--with-cc-opt="-I../boringssl/include" \
--with-ld-opt="-L../boringssl/build/ssl \
-L../boringssl/build/crypto"
$ make
Alternatively, nginx can be configured with QuicTLS [6]
$ ./auto/configure --with-debug --with-http_v3_module \
--with-cc-opt="-I../quictls/build/include" \
--with-ld-opt="-L../quictls/build/lib"
Alternatively, nginx can be configured with a modern version
of LibreSSL [7]
$ ./auto/configure --with-debug --with-http_v3_module \
--with-cc-opt="-I../libressl/build/include" \
--with-ld-opt="-L../libressl/build/lib"
3. Configuration
The HTTP "listen" directive got a new option "quic" which enables
QUIC as client transport protocol instead of TCP.
The Stream "listen" directive got a new option "quic" which enables
QUIC as client transport protocol instead of TCP or plain UDP.
Along with "quic", it's also possible to specify "reuseport"
option [8] to make it work properly with multiple workers.
To enable address validation:
quic_retry on;
To enable 0-RTT:
ssl_early_data on;
Make sure that TLS 1.3 is configured which is required for QUIC:
ssl_protocols TLSv1.3;
To enable GSO (Generic Segmentation Offloading):
quic_gso on;
To limit maximum UDP payload size on receive path:
quic_mtu <size>;
To set host key for various tokens:
quic_host_key <filename>;
By default, GSO Linux-specific optimization [10] is disabled.
Enable it in case a corresponding network interface is configured to
support GSO.
A number of directives were added that configure HTTP/3:
http3
http3_hq
http3_stream_buffer_size
http3_max_concurrent_pushes
http3_max_concurrent_streams
http3_push
http3_push_preload
In http, an additional variable is available: $http3.
The value of $http3 is "h3" for HTTP/3 connections,
"hq" for hq connections, or an empty string otherwise.
In stream, an additional variable is available: $quic.
The value of $quic is "quic" if QUIC connection is used,
or an empty string otherwise.
Example configuration:
http {
log_format quic '$remote_addr - $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent" "$http3"';
access_log logs/access.log quic;
server {
# for better compatibility it's recommended
# to use the same port for quic and https
listen 8443 quic reuseport;
listen 8443 ssl;
ssl_certificate certs/example.com.crt;
ssl_certificate_key certs/example.com.key;
ssl_protocols TLSv1.3;
location / {
# required for browsers to direct them into quic port
add_header Alt-Svc 'h3=":8443"; ma=86400';
}
}
}
4. Directives
Syntax: quic_bpf on | off;
Default: quic_bpf off;
Context: main
Enables routing of QUIC packets using eBPF.
When enabled, this allows to support QUIC connection migration.
The directive is only supported on Linux 5.7+.
Syntax: quic_retry on | off;
Default: quic_retry off;
Context: http | stream, server
Enables the QUIC Address Validation feature. This includes:
- sending a new token in a Retry packet or a NEW_TOKEN frame
- validating a token received in the Initial packet
Syntax: quic_gso on | off;
Default: quic_gso off;
Context: http | stream, server
Enables sending in optimized batch mode using segmentation offloading.
Optimized sending is only supported on Linux featuring UDP_SEGMENT.
Syntax: quic_mtu size;
Default: quic_mtu 65527;
Context: http | stream, server
Sets the QUIC max_udp_payload_size transport parameter value.
This is the maximum UDP payload that we are willing to receive.
Syntax: quic_host_key file;
Default: -
Context: http | stream, server
Specifies a file with the secret key used to encrypt stateless reset and
address validation tokens. By default, a randomly generated key is used.
Syntax: quic_active_connection_id_limit number;
Default: quic_active_connection_id_limit 2;
Context: http | stream, server
Sets the QUIC active_connection_id_limit transport parameter value.
This is the maximum number of connection IDs we are willing to store.
Syntax: quic_timeout time;
Default: quic_timeout 60s;
Context: stream, server
Defines a timeout used to negotiate the QUIC idle timeout.
In the http module, it is taken from the keepalive_timeout directive.
Syntax: quic_stream_buffer_size size;
Default: quic_stream_buffer_size 64k;
Context: stream, server
Syntax: http3_stream_buffer_size size;
Default: http3_stream_buffer_size 64k;
Context: http, server
Sets buffer size for reading and writing of the QUIC STREAM payload.
The buffer size is used to calculate initial flow control limits
in the following QUIC transport parameters:
- initial_max_data
- initial_max_stream_data_bidi_local
- initial_max_stream_data_bidi_remote
- initial_max_stream_data_uni
Syntax: http3_max_concurrent_pushes number;
Default: http3_max_concurrent_pushes 10;
Context: http, server
Limits the maximum number of concurrent push requests in a connection.
Syntax: http3_max_concurrent_streams number;
Default: http3_max_concurrent_streams 128;
Context: http, server
Sets the maximum number of concurrent HTTP/3 streams in a connection.
Syntax: http3_push uri | off;
Default: http3_push off;
Context: http, server, location
Pre-emptively sends (pushes) a request to the specified uri along with
the response to the original request. Only relative URIs with absolute
path will be processed, for example:
http3_push /static/css/main.css;
The uri value can contain variables.
Several http3_push directives can be specified on the same configuration
level. The off parameter cancels the effect of the http3_push directives
inherited from the previous configuration level.
Syntax: http3_push_preload on | off;
Default: http3_push_preload off;
Context: http, server, location
Enables automatic conversion of preload links specified in the “Link”
response header fields into push requests.
Syntax: http3 on | off;
Default: http3 on;
Context: http, server
Enables HTTP/3 protocol negotiation.
Syntax: http3_hq on | off;
Default: http3_hq off;
Context: http, server
Enables HTTP/0.9 protocol negotiation used in QUIC interoperability tests.
5. Clients
* Browsers
Known to work: Firefox 90+ and Chrome 92+ (QUIC version 1)
Beware of strange issues: sometimes browser may decide to ignore QUIC
Cache clearing/restart might help. Always check access.log and
error.log to make sure the browser is using HTTP/3 and not TCP https.
* Console clients
Known to work: ngtcp2, firefox's neqo and chromium's console clients:
$ examples/client 127.0.0.1 8443 https://example.com:8443/index.html
$ ./neqo-client https://127.0.0.1:8443/
$ chromium-build/out/my_build/quic_client http://example.com:8443
In case everyhing is right, the access log should show something like:
127.0.0.1 - - [24/Apr/2020:11:27:29 +0300] "GET / HTTP/3" 200 805 "-"
"nghttp3/ngtcp2 client" "quic"
6. Troubleshooting
Here are some tips that may help to identify problems:
+ Ensure nginx is built with proper SSL library that supports QUIC
+ Ensure nginx is using the proper SSL library in runtime
(`nginx -V` shows what it's using)
+ Ensure a client is actually sending requests over QUIC
(see "Clients" section about browsers and cache)
We recommend to start with simple console client like ngtcp2
to ensure the server is configured properly before trying
with real browsers that may be very picky with certificates,
for example.
+ Build nginx with debug support [9] and check the debug log.
It should contain all details about connection and why it
failed. All related messages contain "quic " prefix and can
be easily filtered out.
+ For a deeper investigation, please enable additional debugging
in src/event/quic/ngx_event_quic_connection.h:
#define NGX_QUIC_DEBUG_PACKETS
#define NGX_QUIC_DEBUG_FRAMES
#define NGX_QUIC_DEBUG_ALLOC
#define NGX_QUIC_DEBUG_CRYPTO
7. Contributing
Please refer to
http://nginx.org/en/docs/contributing_changes.html
8. Links
[1] https://datatracker.ietf.org/doc/html/rfc9000
[2] https://datatracker.ietf.org/doc/html/rfc9114
[3] https://mailman.nginx.org/mailman/listinfo/nginx-devel
[4] https://boringssl.googlesource.com/boringssl/
[5] https://www.libressl.org/
[6] https://github.com/quictls/openssl
[7] https://github.com/libressl-portable/portable/releases/tag/v3.6.0
[8] https://nginx.org/en/docs/http/ngx_http_core_module.html#listen
[9] https://nginx.org/en/docs/debugging_log.html
[10] http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf

View File

@ -12,3 +12,4 @@ CC_TEST_FLAGS="-Ae"
PCRE_OPT="$PCRE_OPT -Ae"
ZLIB_OPT="$ZLIB_OPT -Ae"
MD5_OPT="$MD5_OPT -Ae"

View File

@ -62,6 +62,7 @@ ngx_include_opt="-I"
ngx_objout="-o"
ngx_binout="-e"
ngx_objext="obj"
ngx_binext=".exe"
ngx_long_start='@&&|
'

View File

@ -5,9 +5,8 @@
# clang
NGX_CLANG_VER=`$CC -v 2>&1 | grep 'version' 2>&1 \
| sed -n -e 's/^.*clang version \(.*\)/\1/p' \
-e 's/^.*LLVM version \(.*\)/\1/p'`
NGX_CLANG_VER=`$CC -v 2>&1 | grep '\(clang\|LLVM\) version' 2>&1 \
| sed -e 's/^.* version \(.*\)/\1/'`
echo " + clang version: $NGX_CLANG_VER"
@ -67,6 +66,12 @@ else
PCRE_OPT="$PCRE_OPT -pipe"
fi
if [ ".$MD5_OPT" = "." ]; then
MD5_OPT="-O2 -pipe $CPU_OPT"
else
MD5_OPT="$MD5_OPT -pipe"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O2 -pipe $CPU_OPT"
else

View File

@ -117,7 +117,7 @@ else
. auto/cc/acc
;;
msvc)
msvc*)
# MSVC++ 6.0 SP2, MSVC++ Toolkit 2003
. auto/cc/msvc
@ -178,25 +178,21 @@ if [ "$NGX_PLATFORM" != win32 ]; then
fi
if [ "$NGX_CC_NAME" = "sunc" ]; then
echo "checking for gcc builtin atomic operations ... disabled"
else
ngx_feature="gcc builtin atomic operations"
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 1))
return 1;
if (__sync_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
__sync_synchronize();"
. auto/feature
fi
ngx_feature="gcc builtin atomic operations"
ngx_feature_name=NGX_HAVE_GCC_ATOMIC
ngx_feature_run=yes
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="long n = 0;
if (!__sync_bool_compare_and_swap(&n, 0, 1))
return 1;
if (__sync_fetch_and_add(&n, 1) != 1)
return 1;
if (n != 2)
return 1;
__sync_synchronize();"
. auto/feature
if [ "$NGX_CC_NAME" = "ccc" ]; then
@ -213,7 +209,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
var(0, buf, \"%d\", 1);
if (buf[0] != '1') return 1"
. auto/feature
fi
fi
ngx_feature="gcc variadic macros"
@ -235,7 +231,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="if (__builtin_bswap64(0)) return 1"
ngx_feature_test="__builtin_bswap64(0)"
. auto/feature

View File

@ -128,6 +128,12 @@ else
PCRE_OPT="$PCRE_OPT $PIPE"
fi
if [ ".$MD5_OPT" = "." ]; then
MD5_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
else
MD5_OPT="$MD5_OPT $PIPE"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O2 -fomit-frame-pointer $PIPE $CPU_OPT"
else
@ -145,13 +151,9 @@ CFLAGS="$CFLAGS -Wall -Wpointer-arith"
#CFLAGS="$CFLAGS -Winline"
#CFLAGS="$CFLAGS -Wmissing-prototypes"
case "$NGX_GCC_VER" in
2.*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused"
;;
*)
case "$NGX_GCC_VER" in
[3-5].*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused-parameter"
# 4.2.1 shows the warning in wrong places
@ -162,6 +164,11 @@ case "$NGX_GCC_VER" in
CFLAGS="$CFLAGS -Wno-deprecated-declarations"
fi
;;
*)
# we have a lot of the unused function arguments
CFLAGS="$CFLAGS -Wno-unused"
;;
esac

View File

@ -43,6 +43,10 @@ if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="-O $CPU_OPT"
fi
if [ ".$MD5_OPT" = "." ]; then
MD5_OPT="-O $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="-O $CPU_OPT"
fi

View File

@ -11,8 +11,8 @@
# MSVC 2015 (14.0) cl 19.00
NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'C/C++.* [0-9][0-9]*\.[0-9]' 2>&1 \
| sed -e 's/^.* \([0-9][0-9]*\.[0-9].*\)/\1/'`
NGX_MSVC_VER=`$NGX_WINE $CC 2>&1 | grep 'Compiler Version' 2>&1 \
| sed -e 's/^.* Version \(.*\)/\1/'`
echo " + cl version: $NGX_MSVC_VER"
@ -22,21 +22,6 @@ have=NGX_COMPILER value="\"cl $NGX_MSVC_VER\"" . auto/define
ngx_msvc_ver=`echo $NGX_MSVC_VER | sed -e 's/^\([0-9]*\).*/\1/'`
# detect x64 builds
case "$NGX_MSVC_VER" in
*x64)
NGX_MACHINE=amd64
;;
*)
NGX_MACHINE=i386
;;
esac
# optimizations
# maximize speed, equivalent to -Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy
@ -123,7 +108,7 @@ CORE_LIBS="$CORE_LIBS kernel32.lib user32.lib"
# msvc under Wine issues
# C1902: Program database manager mismatch; please check your installation
if [ -z "$NGX_WINE" ]; then
CFLAGS="$CFLAGS -Zi -Fd$NGX_OBJS/nginx.pdb"
CFLAGS="$CFLAGS -Zi"
CORE_LINK="$CORE_LINK -debug"
fi
@ -157,6 +142,7 @@ ngx_pic_opt=
ngx_objout="-Fo"
ngx_binout="-Fe"
ngx_objext="obj"
ngx_binext=".exe"
ngx_long_start='@<<
'

View File

@ -44,11 +44,7 @@ elif `$CC -v 2>&1 | grep 'gcc version' >/dev/null 2>&1`; then
NGX_CC_NAME=gcc
echo " + using GNU C compiler"
elif `$CC -v 2>&1 | grep 'clang version' >/dev/null 2>&1`; then
NGX_CC_NAME=clang
echo " + using Clang C compiler"
elif `$CC -v 2>&1 | grep 'LLVM version' >/dev/null 2>&1`; then
elif `$CC -v 2>&1 | grep '\(clang\|LLVM\) version' >/dev/null 2>&1`; then
NGX_CC_NAME=clang
echo " + using Clang C compiler"

View File

@ -84,6 +84,7 @@ ngx_include_opt="-i="
ngx_objout="-fo"
ngx_binout="-fe="
ngx_objext="obj"
ngx_binext=".exe"
ngx_regex_dirsep='\\'
ngx_dirsep="\\"

View File

@ -8,10 +8,7 @@
# Sun C 5.9 SunOS_i386 2007/05/03 Sun Studio 12
# Sun C 5.9 SunOS_sparc 2007/05/03
# Sun C 5.10 SunOS_i386 2009/06/03 Sun Studio 12.1
# Sun C 5.11 SunOS_i386 2010/08/13 Oracle Solaris Studio 12.2
# Sun C 5.12 SunOS_i386 2011/11/16 Oracle Solaris Studio 12.3
# Sun C 5.13 SunOS_i386 2014/10/20 Oracle Solaris Studio 12.4
# Sun C 5.14 SunOS_i386 2016/05/31 Oracle Developer Studio 12.5
# Sun C 5.11 SunOS_i386 2010/08/13 Sun Studio 12.2
NGX_SUNC_VER=`$CC -V 2>&1 | grep 'Sun C' 2>&1 \
| sed -e 's/^.* Sun C \(.*\)/\1/'`
@ -23,10 +20,7 @@ have=NGX_COMPILER value="\"Sun C $NGX_SUNC_VER\"" . auto/define
cat << END > $NGX_AUTOTEST.c
int main(void) {
printf("%d", __SUNPRO_C);
return 0;
}
int main() { printf("%d", __SUNPRO_C); }
END
@ -151,6 +145,10 @@ if [ ".$PCRE_OPT" = "." ]; then
PCRE_OPT="$ngx_fast $IPO $CPU_OPT"
fi
if [ ".$MD5_OPT" = "." ]; then
MD5_OPT="$ngx_fast $IPO $CPU_OPT"
fi
if [ ".$ZLIB_OPT" = "." ]; then
ZLIB_OPT="$ngx_fast $IPO $CPU_OPT"
fi

7
auto/configure vendored
View File

@ -36,7 +36,7 @@ if test -z "$NGX_PLATFORM"; then
NGX_PLATFORM="$NGX_SYSTEM:$NGX_RELEASE:$NGX_MACHINE";
case "$NGX_SYSTEM" in
MINGW32_* | MINGW64_* | MSYS_*)
MINGW32_*)
NGX_PLATFORM=win32
;;
esac
@ -44,7 +44,6 @@ if test -z "$NGX_PLATFORM"; then
else
echo "building for $NGX_PLATFORM"
NGX_SYSTEM=$NGX_PLATFORM
NGX_MACHINE=i386
fi
. auto/cc/conf
@ -88,10 +87,6 @@ have=NGX_PID_PATH value="\"$NGX_PID_PATH\"" . auto/define
have=NGX_LOCK_PATH value="\"$NGX_LOCK_PATH\"" . auto/define
have=NGX_ERROR_LOG_PATH value="\"$NGX_ERROR_LOG_PATH\"" . auto/define
if [ ".$NGX_ERROR_LOG_PATH" = "." ]; then
have=NGX_ERROR_LOG_STDERR . auto/have
fi
have=NGX_HTTP_LOG_PATH value="\"$NGX_HTTP_LOG_PATH\"" . auto/define
have=NGX_HTTP_CLIENT_TEMP_PATH value="\"$NGX_HTTP_CLIENT_TEMP_PATH\""
. auto/define

View File

@ -15,7 +15,7 @@ END
cat << END > $NGX_AUTOTEST.c
int main(void) {
int main() {
int i = 0x11223344;
char *p;

View File

@ -31,7 +31,7 @@ cat << END > $NGX_AUTOTEST.c
$NGX_INCLUDE_UNISTD_H
$ngx_feature_incs
int main(void) {
int main() {
$ngx_feature_test;
return 0;
}

View File

@ -20,7 +20,7 @@ cat << END > $NGX_AUTOTEST.c
$NGX_INCLUDE_SYS_PARAM_H
#include <$ngx_include>
int main(void) {
int main() {
return 0;
}
@ -45,6 +45,9 @@ if [ -x $NGX_AUTOTEST ]; then
eval "NGX_INCLUDE_$ngx_name='#include <$ngx_include>'"
#STUB
eval "NGX_$ngx_name='#include <$ngx_include>'"
else
echo " not found"

View File

@ -48,6 +48,4 @@ default: build
clean:
rm -rf Makefile $NGX_OBJS
.PHONY: default clean
END

View File

@ -215,6 +215,4 @@ upgrade:
test -f $NGX_PID_PATH.oldbin
kill -QUIT \`cat $NGX_PID_PATH.oldbin\`
.PHONY: build install modules upgrade
END

View File

@ -7,7 +7,7 @@ if [ $USE_PCRE = YES -o $PCRE != NONE ]; then
. auto/lib/pcre/conf
else
if [ $USE_PCRE = DISABLED -a $HTTP = YES -a $HTTP_REWRITE = YES ]; then
if [ $USE_PCRE = DISABLED -a $HTTP_REWRITE = YES ]; then
cat << END
@ -25,6 +25,35 @@ if [ $USE_OPENSSL = YES ]; then
. auto/lib/openssl/conf
fi
if [ $USE_MD5 = YES ]; then
if [ $USE_OPENSSL = YES ]; then
have=NGX_HAVE_OPENSSL_MD5_H . auto/have
have=NGX_OPENSSL_MD5 . auto/have
have=NGX_HAVE_MD5 . auto/have
MD5=YES
MD5_LIB=OpenSSL
else
. auto/lib/md5/conf
fi
fi
if [ $USE_SHA1 = YES ]; then
if [ $USE_OPENSSL = YES ]; then
have=NGX_HAVE_OPENSSL_SHA1_H . auto/have
have=NGX_HAVE_SHA1 . auto/have
SHA1=YES
SHA1_LIB=OpenSSL
else
. auto/lib/sha1/conf
fi
fi
if [ $USE_ZLIB = YES ]; then
. auto/lib/zlib/conf
fi

View File

@ -74,15 +74,17 @@ if [ $ngx_found = yes ]; then
NGX_LIB_GEOIP=$ngx_feature_libs
ngx_feature="GeoIP IPv6 support"
ngx_feature_name="NGX_HAVE_GEOIP_V6"
ngx_feature_run=no
ngx_feature_incs="#include <stdio.h>
#include <GeoIP.h>"
#ngx_feature_path=
#ngx_feature_libs=
ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);"
. auto/feature
if [ $NGX_IPV6 = YES ]; then
ngx_feature="GeoIP IPv6 support"
ngx_feature_name="NGX_HAVE_GEOIP_V6"
ngx_feature_run=no
ngx_feature_incs="#include <stdio.h>
#include <GeoIP.h>"
#ngx_feature_path=
#ngx_feature_libs=
ngx_feature_test="printf(\"%d\", GEOIP_CITY_EDITION_REV0_V6);"
. auto/feature
fi
else

View File

@ -9,8 +9,7 @@
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs="-lprofiler"
ngx_feature_test="void ProfilerStop(void);
ProfilerStop()"
ngx_feature_test="ProfilerStop()"
. auto/feature

View File

@ -9,8 +9,7 @@
ngx_feature_incs="#include <gd.h>"
ngx_feature_path=
ngx_feature_libs="-lgd"
ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL);
(void) img"
ngx_feature_test="gdImagePtr img = gdImageCreateFromGifPtr(1, NULL);"
. auto/feature
@ -75,12 +74,6 @@ if [ $ngx_found = yes ]; then
NGX_LIB_LIBGD=$ngx_feature_libs
ngx_feature="GD WebP support"
ngx_feature_name="NGX_HAVE_GD_WEBP"
ngx_feature_test="gdImagePtr img = gdImageCreateFromWebpPtr(1, NULL);
(void) img"
. auto/feature
else
cat << END

View File

@ -16,8 +16,8 @@
ngx_feature_libs="-lxml2 -lxslt"
ngx_feature_test="xmlParserCtxtPtr ctxt = NULL;
xsltStylesheetPtr sheet = NULL;
xmlDocPtr doc = NULL;
xmlParseChunk(ctxt, NULL, 0, 0);
xmlDocPtr doc;
doc = xmlParseChunk(ctxt, NULL, 0, 0);
xsltApplyStylesheet(sheet, doc, NULL);"
. auto/feature

View File

@ -7,6 +7,14 @@ if [ $PCRE != NONE -a $PCRE != NO -a $PCRE != YES ]; then
. auto/lib/pcre/make
fi
if [ $MD5 != NONE -a $MD5 != NO -a $MD5 != YES ]; then
. auto/lib/md5/make
fi
if [ $SHA1 != NONE -a $SHA1 != NO -a $SHA1 != YES ]; then
. auto/lib/sha1/make
fi
if [ $OPENSSL != NONE -a $OPENSSL != NO -a $OPENSSL != YES ]; then
. auto/lib/openssl/make
fi

103
auto/lib/md5/conf Normal file
View File

@ -0,0 +1,103 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $MD5 != NONE ]; then
if grep MD5_Init $MD5/md5.h 2>&1 >/dev/null; then
# OpenSSL md5
OPENSSL_MD5=YES
have=NGX_HAVE_OPENSSL_MD5 . auto/have
have=NGX_OPENSSL_MD5 . auto/have
else
# rsaref md5
OPENSSL_MD5=NO
fi
have=NGX_HAVE_MD5 . auto/have
CORE_INCS="$CORE_INCS $MD5"
case "$NGX_CC_NAME" in
msvc | owc | bcc)
LINK_DEPS="$LINK_DEPS $MD5/md5.lib"
CORE_LIBS="$CORE_LIBS $MD5/md5.lib"
;;
icc)
LINK_DEPS="$LINK_DEPS $MD5/libmd5.a"
# to allow -ipo optimization we link with the *.o but not library
CORE_LIBS="$CORE_LIBS $MD5/md5_dgst.o"
if [ $MD5_ASM = YES ]; then
CORE_LIBS="$CORE_LIBS $MD5/asm/mx86-elf.o"
fi
;;
*)
LINK_DEPS="$LINK_DEPS $MD5/libmd5.a"
CORE_LIBS="$CORE_LIBS $MD5/libmd5.a"
#CORE_LIBS="$CORE_LIBS -L $MD5 -lmd5"
;;
esac
else
if [ "$NGX_PLATFORM" != win32 ]; then
MD5=NO
# FreeBSD, Solaris 10
ngx_feature="md5 in system md library"
ngx_feature_name=NGX_HAVE_MD5
ngx_feature_run=no
ngx_feature_incs="#include <md5.h>"
ngx_feature_path=
ngx_feature_libs="-lmd"
ngx_feature_test="MD5_CTX md5; MD5Init(&md5)"
. auto/feature
ngx_md5_lib="system md"
if [ $ngx_found = no ]; then
# Solaris 8/9
ngx_feature="md5 in system md5 library"
ngx_feature_libs="-lmd5"
. auto/feature
ngx_md5_lib="system md5"
fi
if [ $ngx_found = no ]; then
# OpenSSL crypto library
ngx_feature="md5 in system OpenSSL crypto library"
ngx_feature_name="NGX_OPENSSL_MD5"
ngx_feature_incs="#include <openssl/md5.h>"
ngx_feature_libs="-lcrypto"
ngx_feature_test="MD5_CTX md5; MD5_Init(&md5)"
. auto/feature
ngx_md5_lib="system crypto"
if [ $ngx_found = yes ]; then
have=NGX_HAVE_OPENSSL_MD5_H . auto/have
have=NGX_HAVE_MD5 . auto/have
fi
fi
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
MD5=YES
MD5_LIB=$ngx_md5_lib
fi
fi
fi

96
auto/lib/md5/make Normal file
View File

@ -0,0 +1,96 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
case "$NGX_CC_NAME" in
msvc)
ngx_makefile=makefile.msvc
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC MD5_ASM=$MD5_ASM"
ngx_md5="MD5=\"$MD5\""
;;
owc)
ngx_makefile=makefile.owc
ngx_opt="CPU_OPT=\"$CPU_OPT\""
ngx_md5=`echo MD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
bcc)
ngx_makefile=makefile.bcc
ngx_opt="-DCPU_OPT=\"$CPU_OPT\" -DMD5_ASM=$MD5_ASM"
ngx_md5=`echo \-DMD5=\"$MD5\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
esac
done=NO
case "$NGX_PLATFORM" in
win32)
cat << END >> $NGX_MAKEFILE
`echo "$MD5/md5.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"`
\$(MAKE) -f auto/lib/md5/$ngx_makefile $ngx_opt $ngx_md5
END
done=YES
;;
SunOS:*:i86pc)
if [ $MD5_ASM = YES ]; then
cat << END >> $NGX_MAKEFILE
$MD5/libmd5.a: $NGX_MAKEFILE
cd $MD5 \\
&& \$(MAKE) CFLAGS="$MD5_OPT -DSOL -DMD5_ASM -DL_ENDIAN" \\
CC="\$(CC)" CPP="\$(CPP)" \\
MD5_ASM_OBJ=asm/mx86-sol.o clean libmd5.a
END
done=YES
fi
;;
# FreeBSD: i386
# Linux: i686
*:i386 | *:i686)
if [ $MD5_ASM = YES ]; then
cat << END >> $NGX_MAKEFILE
$MD5/libmd5.a: $NGX_MAKEFILE
cd $MD5 \\
&& \$(MAKE) CFLAGS="$MD5_OPT -DELF -DMD5_ASM -DL_ENDIAN" \\
CC="\$(CC)" CPP="\$(CPP)" \\
MD5_ASM_OBJ=asm/mx86-elf.o clean libmd5.a
END
done=YES
fi
;;
esac
if [ $done = NO ]; then
cat << END >> $NGX_MAKEFILE
$MD5/libmd5.a: $NGX_MAKEFILE
cd $MD5 \\
&& \$(MAKE) CFLAGS="$MD5_OPT" \\
CC="\$(CC)" MD5_ASM_OBJ= clean libmd5.a
END
fi

22
auto/lib/md5/makefile.bcc Normal file
View File

@ -0,0 +1,22 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN
!if "$(MD5_ASM)" == "YES"
md5.lib:
cd $(MD5)
bcc32 -c $(CFLAGS) -DMD5_ASM md5_dgst.c
tlib md5.lib +md5_dgst.obj +"asm\m-win32.obj"
!else
md5.lib:
cd $(MD5)
bcc32 -c $(CFLAGS) md5_dgst.c
tlib md5.lib +md5_dgst.obj
!endif

View File

@ -0,0 +1,22 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN
!IF "$(MD5_ASM)" == "YES"
md5.lib:
cd $(MD5)
cl -c $(CFLAGS) -D MD5_ASM md5_dgst.c
link -lib -out:md5.lib md5_dgst.obj asm/m-win32.obj
!ELSE
md5.lib:
cd $(MD5)
cl -c $(CFLAGS) md5_dgst.c
link -lib -out:md5.lib md5_dgst.obj
!ENDIF

11
auto/lib/md5/makefile.owc Normal file
View File

@ -0,0 +1,11 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT)
md5.lib:
cd $(MD5)
wcl386 -c $(CFLAGS) -dL_ENDIAN md5_dgst.c
wlib -n md5.lib md5_dgst.obj

View File

@ -5,31 +5,18 @@
if [ $OPENSSL != NONE ]; then
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
if [ $USE_OPENSSL_QUIC = YES ]; then
have=NGX_QUIC . auto/have
have=NGX_QUIC_OPENSSL_COMPAT . auto/have
fi
case "$CC" in
cl | bcc32)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
CFLAGS="$CFLAGS -DNO_SYS_TYPES_H"
CORE_INCS="$CORE_INCS $OPENSSL/openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/openssl/include/openssl/ssl.h"
if [ -f $OPENSSL/ms/do_ms.bat ]; then
# before OpenSSL 1.1.0
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib"
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib"
else
# OpenSSL 1.1.0+
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libssl.lib"
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libcrypto.lib"
fi
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/ssleay32.lib"
CORE_LIBS="$CORE_LIBS $OPENSSL/openssl/lib/libeay32.lib"
# libeay32.lib requires gdi32.lib
CORE_LIBS="$CORE_LIBS gdi32.lib"
@ -38,12 +25,14 @@ if [ $OPENSSL != NONE ]; then
;;
*)
have=NGX_OPENSSL . auto/have
have=NGX_SSL . auto/have
CORE_INCS="$CORE_INCS $OPENSSL/.openssl/include"
CORE_DEPS="$CORE_DEPS $OPENSSL/.openssl/include/openssl/ssl.h"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libssl.a"
CORE_LIBS="$CORE_LIBS $OPENSSL/.openssl/lib/libcrypto.a"
CORE_LIBS="$CORE_LIBS $NGX_LIBDL"
CORE_LIBS="$CORE_LIBS $NGX_LIBPTHREAD"
if [ "$NGX_PLATFORM" = win32 ]; then
CORE_LIBS="$CORE_LIBS -lgdi32 -lcrypt32 -lws2_32"
@ -62,7 +51,7 @@ else
ngx_feature_run=no
ngx_feature_incs="#include <openssl/ssl.h>"
ngx_feature_path=
ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL $NGX_LIBPTHREAD"
ngx_feature_libs="-lssl -lcrypto $NGX_LIBDL"
ngx_feature_test="SSL_CTX_set_options(NULL, 0)"
. auto/feature
@ -74,13 +63,11 @@ else
ngx_feature_path="/usr/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto"
ngx_feature_libs="-R/usr/local/lib -L/usr/local/lib -lssl -lcrypto $NGX_LIBDL"
else
ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto"
ngx_feature_libs="-L/usr/local/lib -lssl -lcrypto $NGX_LIBDL"
fi
ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
. auto/feature
fi
@ -92,13 +79,11 @@ else
ngx_feature_path="/usr/pkg/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto"
ngx_feature_libs="-R/usr/pkg/lib -L/usr/pkg/lib -lssl -lcrypto $NGX_LIBDL"
else
ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto"
ngx_feature_libs="-L/usr/pkg/lib -lssl -lcrypto $NGX_LIBDL"
fi
ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
. auto/feature
fi
@ -110,13 +95,11 @@ else
ngx_feature_path="/opt/local/include"
if [ $NGX_RPATH = YES ]; then
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto"
ngx_feature_libs="-R/opt/local/lib -L/opt/local/lib -lssl -lcrypto $NGX_LIBDL"
else
ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto"
ngx_feature_libs="-L/opt/local/lib -lssl -lcrypto $NGX_LIBDL"
fi
ngx_feature_libs="$ngx_feature_libs $NGX_LIBDL $NGX_LIBPTHREAD"
. auto/feature
fi
@ -125,35 +108,6 @@ else
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
OPENSSL=YES
if [ $USE_OPENSSL_QUIC = YES ]; then
ngx_feature="OpenSSL QUIC support"
ngx_feature_name="NGX_QUIC"
ngx_feature_test="SSL_set_quic_method(NULL, NULL)"
. auto/feature
if [ $ngx_found = no ]; then
have=NGX_QUIC_OPENSSL_COMPAT . auto/have
ngx_feature="OpenSSL QUIC compatibility"
ngx_feature_test="SSL_CTX_add_custom_ext(NULL, 0, 0,
NULL, NULL, NULL, NULL, NULL)"
. auto/feature
fi
if [ $ngx_found = no ]; then
cat << END
$0: error: certain modules require OpenSSL QUIC support.
You can either do not enable the modules, or install the OpenSSL library with
QUIC support into the system, or build the OpenSSL library with QUIC support
statically from the source with nginx by using --with-openssl=<path> option.
END
exit 1
fi
fi
fi
fi

View File

@ -7,24 +7,11 @@ case "$CC" in
cl)
case "$NGX_MACHINE" in
amd64)
OPENSSL_TARGET=VC-WIN64A
;;
*)
OPENSSL_TARGET=VC-WIN32
;;
esac
cat << END >> $NGX_MAKEFILE
$OPENSSL/openssl/include/openssl/ssl.h: $NGX_MAKEFILE
\$(MAKE) -f auto/lib/openssl/makefile.msvc \
OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT" \
OPENSSL_TARGET="$OPENSSL_TARGET"
OPENSSL="$OPENSSL" OPENSSL_OPT="$OPENSSL_OPT"
END
@ -64,7 +51,7 @@ END
$OPENSSL/.openssl/include/openssl/ssl.h: $NGX_MAKEFILE
cd $OPENSSL \\
&& if [ -f Makefile ]; then \$(MAKE) clean; fi \\
&& ./config --prefix=$ngx_prefix no-shared no-threads $OPENSSL_OPT \\
&& ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\
&& \$(MAKE) \\
&& \$(MAKE) install_sw LIBDIR=lib

View File

@ -6,16 +6,9 @@
all:
cd $(OPENSSL)
perl Configure $(OPENSSL_TARGET) no-shared no-threads \
--prefix="%cd%/openssl" \
--openssldir="%cd%/openssl/ssl" \
$(OPENSSL_OPT)
perl Configure VC-WIN32 no-shared --prefix=openssl $(OPENSSL_OPT)
if exist ms\do_ms.bat ( \
ms\do_ms \
&& $(MAKE) -f ms\nt.mak \
&& $(MAKE) -f ms\nt.mak install \
) else ( \
$(MAKE) \
&& $(MAKE) install_sw \
)
ms\do_ms
$(MAKE) -f ms\nt.mak
$(MAKE) -f ms\nt.mak install

View File

@ -4,62 +4,87 @@
if [ $PCRE != NONE ]; then
CORE_INCS="$CORE_INCS $PCRE"
if [ -f $PCRE/src/pcre2.h.generic ]; then
case "$NGX_CC_NAME" in
PCRE_LIBRARY=PCRE2
have=NGX_PCRE . auto/have
have=NGX_PCRE2 . auto/have
if [ "$NGX_PLATFORM" = win32 ]; then
have=PCRE2_STATIC . auto/have
fi
CORE_INCS="$CORE_INCS $PCRE/src/"
CORE_DEPS="$CORE_DEPS $PCRE/src/pcre2.h"
case "$NGX_CC_NAME" in
msvc)
LINK_DEPS="$LINK_DEPS $PCRE/src/pcre2-8.lib"
CORE_LIBS="$CORE_LIBS $PCRE/src/pcre2-8.lib"
;;
*)
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre2-8.a"
CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre2-8.a"
;;
esac
else
PCRE_LIBRARY=PCRE
have=NGX_PCRE . auto/have
if [ "$NGX_PLATFORM" = win32 ]; then
msvc | owc | bcc)
have=NGX_PCRE . auto/have
have=PCRE_STATIC . auto/have
fi
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
;;
CORE_INCS="$CORE_INCS $PCRE"
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
icc)
have=NGX_PCRE . auto/have
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
case "$NGX_CC_NAME" in
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
msvc | owc | bcc)
LINK_DEPS="$LINK_DEPS $PCRE/pcre.lib"
CORE_LIBS="$CORE_LIBS $PCRE/pcre.lib"
;;
echo $ngx_n "checking for PCRE library ...$ngx_c"
*)
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
;;
if [ -f $PCRE/pcre.h ]; then
ngx_pcre_ver=`grep PCRE_MAJOR $PCRE/pcre.h \
| sed -e 's/^.*PCRE_MAJOR.* \(.*\)$/\1/'`
else if [ -f $PCRE/configure.in ]; then
ngx_pcre_ver=`grep PCRE_MAJOR= $PCRE/configure.in \
| sed -e 's/^.*=\(.*\)$/\1/'`
else
ngx_pcre_ver=`grep pcre_major, $PCRE/configure.ac \
| sed -e 's/^.*pcre_major,.*\[\(.*\)\].*$/\1/'`
fi
fi
echo " $ngx_pcre_ver major version found"
# to allow -ipo optimization we link with the *.o but not library
case "$ngx_pcre_ver" in
4|5)
CORE_LIBS="$CORE_LIBS $PCRE/pcre.o"
;;
6)
CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
;;
*)
CORE_LIBS="$CORE_LIBS $PCRE/pcre_chartables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_compile.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_exec.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_fullinfo.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_globals.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_tables.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_try_flipped.o"
CORE_LIBS="$CORE_LIBS $PCRE/pcre_newline.o"
;;
esac
;;
*)
have=NGX_PCRE . auto/have
if [ "$NGX_PLATFORM" = win32 ]; then
have=PCRE_STATIC . auto/have
fi
CORE_DEPS="$CORE_DEPS $PCRE/pcre.h"
LINK_DEPS="$LINK_DEPS $PCRE/.libs/libpcre.a"
CORE_LIBS="$CORE_LIBS $PCRE/.libs/libpcre.a"
;;
esac
esac
fi
if [ $PCRE_JIT = YES ]; then
have=NGX_HAVE_PCRE_JIT . auto/have
@ -69,48 +94,8 @@ if [ $PCRE != NONE ]; then
else
if [ "$NGX_PLATFORM" != win32 ]; then
PCRE=NO
fi
if [ $PCRE = NO -a $PCRE2 != DISABLED ]; then
ngx_feature="PCRE2 library"
ngx_feature_name="NGX_PCRE2"
ngx_feature_run=no
ngx_feature_incs="#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>"
ngx_feature_path=
ngx_feature_libs="-lpcre2-8"
ngx_feature_test="pcre2_code *re;
re = pcre2_compile(NULL, 0, 0, NULL, NULL, NULL);
if (re == NULL) return 1"
. auto/feature
if [ $ngx_found = no ]; then
# pcre2-config
ngx_pcre2_prefix=`pcre2-config --prefix 2>/dev/null`
if [ -n "$ngx_pcre2_prefix" ]; then
ngx_feature="PCRE2 library in $ngx_pcre2_prefix"
ngx_feature_path=`pcre2-config --cflags \
| sed -n -e 's/.*-I *\([^ ][^ ]*\).*/\1/p'`
ngx_feature_libs=`pcre2-config --libs8`
. auto/feature
fi
fi
if [ $ngx_found = yes ]; then
have=NGX_PCRE . auto/have
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
PCRE_LIBRARY=PCRE2
fi
fi
if [ $PCRE = NO ]; then
ngx_feature="PCRE library"
ngx_feature_name="NGX_PCRE"
@ -186,7 +171,6 @@ else
CORE_INCS="$CORE_INCS $ngx_feature_path"
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
PCRE=YES
PCRE_LIBRARY=PCRE
fi
if [ $PCRE = YES ]; then

View File

@ -3,138 +3,36 @@
# Copyright (C) Nginx, Inc.
if [ $PCRE_LIBRARY = PCRE2 ]; then
case "$NGX_CC_NAME" in
# PCRE2
msvc)
ngx_makefile=makefile.msvc
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
ngx_pcre="PCRE=\"$PCRE\""
;;
if [ $NGX_CC_NAME = msvc ]; then
owc)
ngx_makefile=makefile.owc
ngx_opt="CPU_OPT=\"$CPU_OPT\""
ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
# With PCRE2, it is not possible to compile all sources.
# Since list of source files changes between versions, we
# test files which might not be present.
bcc)
ngx_makefile=makefile.bcc
ngx_opt="-DCPU_OPT=\"$CPU_OPT\""
ngx_pcre=`echo \-DPCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
ngx_pcre_srcs="pcre2_auto_possess.c \
pcre2_chartables.c \
pcre2_compile.c \
pcre2_config.c \
pcre2_context.c \
pcre2_dfa_match.c \
pcre2_error.c \
pcre2_jit_compile.c \
pcre2_maketables.c \
pcre2_match.c \
pcre2_match_data.c \
pcre2_newline.c \
pcre2_ord2utf.c \
pcre2_pattern_info.c \
pcre2_string_utils.c \
pcre2_study.c \
pcre2_substitute.c \
pcre2_substring.c \
pcre2_tables.c \
pcre2_ucd.c \
pcre2_valid_utf.c \
pcre2_xclass.c"
*)
ngx_makefile=
;;
ngx_pcre_test="pcre2_convert.c \
pcre2_extuni.c \
pcre2_find_bracket.c \
pcre2_script_run.c \
pcre2_serialize.c"
for ngx_src in $ngx_pcre_test
do
if [ -f $PCRE/src/$ngx_src ]; then
ngx_pcre_srcs="$ngx_pcre_srcs $ngx_src"
fi
done
ngx_pcre_objs=`echo $ngx_pcre_srcs \
| sed -e "s#\([^ ]*\.\)c#\1$ngx_objext#g"`
ngx_pcre_srcs=`echo $ngx_pcre_srcs \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"`
ngx_pcre_objs=`echo $ngx_pcre_objs \
| sed -e "s/ *\([^ ][^ ]*\)/$ngx_regex_cont\1/g"`
cat << END >> $NGX_MAKEFILE
PCRE_CFLAGS = -O2 -Ob1 -Oi -Gs $LIBC $CPU_OPT
PCRE_FLAGS = -DHAVE_CONFIG_H -DPCRE2_STATIC -DPCRE2_CODE_UNIT_WIDTH=8 \\
-DHAVE_MEMMOVE
PCRE_SRCS = $ngx_pcre_srcs
PCRE_OBJS = $ngx_pcre_objs
$PCRE/src/pcre2.h:
cd $PCRE/src \\
&& copy /y config.h.generic config.h \\
&& copy /y pcre2.h.generic pcre2.h \\
&& copy /y pcre2_chartables.c.dist pcre2_chartables.c
$PCRE/src/pcre2-8.lib: $PCRE/src/pcre2.h $NGX_MAKEFILE
cd $PCRE/src \\
&& cl -nologo -c \$(PCRE_CFLAGS) -I . \$(PCRE_FLAGS) \$(PCRE_SRCS) \\
&& link -lib -out:pcre2-8.lib -verbose:lib \$(PCRE_OBJS)
END
else
cat << END >> $NGX_MAKEFILE
$PCRE/src/pcre2.h: $PCRE/Makefile
$PCRE/Makefile: $NGX_MAKEFILE
cd $PCRE \\
&& if [ -f Makefile ]; then \$(MAKE) distclean; fi \\
&& CC="\$(CC)" CFLAGS="$PCRE_OPT" \\
./configure --disable-shared $PCRE_CONF_OPT
$PCRE/.libs/libpcre2-8.a: $PCRE/Makefile
cd $PCRE \\
&& \$(MAKE) libpcre2-8.la
END
fi
esac
else
if [ -n "$ngx_makefile" ]; then
# PCRE
case "$NGX_CC_NAME" in
msvc)
ngx_makefile=makefile.msvc
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC"
ngx_pcre="PCRE=\"$PCRE\""
;;
owc)
ngx_makefile=makefile.owc
ngx_opt="CPU_OPT=\"$CPU_OPT\""
ngx_pcre=`echo PCRE=\"$PCRE\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
bcc)
ngx_makefile=makefile.bcc
ngx_opt="-DCPU_OPT=\"$CPU_OPT\""
ngx_pcre=`echo \-DPCRE=\"$PCRE\" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
;;
*)
ngx_makefile=
;;
esac
if [ -n "$ngx_makefile" ]; then
cat << END >> $NGX_MAKEFILE
cat << END >> $NGX_MAKEFILE
`echo "$PCRE/pcre.lib: $PCRE/pcre.h $NGX_MAKEFILE" \
| sed -e "s/\//$ngx_regex_dirsep/g"`
@ -145,9 +43,9 @@ else
END
else
else
cat << END >> $NGX_MAKEFILE
cat << END >> $NGX_MAKEFILE
$PCRE/pcre.h: $PCRE/Makefile
@ -163,6 +61,4 @@ $PCRE/.libs/libpcre.a: $PCRE/Makefile
END
fi
fi

View File

@ -12,9 +12,9 @@ NGX_PERL_VER=`$NGX_PERL -v 2>&1 | grep '^This is perl' 2>&1 \
if test -n "$NGX_PERL_VER"; then
echo " + perl version: $NGX_PERL_VER"
if [ "`$NGX_PERL -e 'use 5.008006; print "OK"'`" != "OK" ]; then
if [ "`$NGX_PERL -e 'use 5.006001; print "OK"'`" != "OK" ]; then
echo
echo "$0: error: perl 5.8.6 or higher is required"
echo "$0: error: perl 5.6.1 or higher is required"
echo
exit 1;
@ -28,10 +28,8 @@ if test -n "$NGX_PERL_VER"; then
exit 1;
fi
NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts`
NGX_PM_LDFLAGS=`$NGX_PERL -MConfig -e 'print $Config{lddlflags}'`
NGX_PERL_CFLAGS="$CFLAGS `$NGX_PERL -MExtUtils::Embed -e ccopts`"
NGX_PM_CFLAGS=`$NGX_PERL -MExtUtils::Embed -e ccopts`
# gcc 4.1/4.2 warn about unused values in pTHX_
NGX_PERL_CFLAGS=`echo $NGX_PERL_CFLAGS \
@ -76,7 +74,7 @@ if test -n "$NGX_PERL_VER"; then
else
echo
echo "$0: error: perl 5.8.6 or higher is required"
echo "$0: error: perl 5.6.1 or higher is required"
echo
exit 1;

View File

@ -3,6 +3,9 @@
# Copyright (C) Nginx, Inc.
v=`grep 'define NGINX_VERSION' src/core/nginx.h | sed -e 's/^.*"\(.*\)".*/\1/'`
cat << END >> $NGX_MAKEFILE
$NGX_OBJS/src/http/modules/perl/ngx_http_perl_module.o: \\
@ -24,11 +27,7 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \\
src/http/modules/perl/nginx.pm \\
src/http/modules/perl/nginx.xs \\
src/http/modules/perl/typemap
grep 'define NGINX_VERSION' src/core/nginx.h \\
| sed -e 's/^.*"\(.*\)".*/\1/' > \\
$NGX_OBJS/src/http/modules/perl/version
sed "s/%%VERSION%%/\`cat $NGX_OBJS/src/http/modules/perl/version\`/" \\
src/http/modules/perl/nginx.pm > \\
sed "s/%%VERSION%%/$v/" src/http/modules/perl/nginx.pm > \\
$NGX_OBJS/src/http/modules/perl/nginx.pm
cp -p src/http/modules/perl/nginx.xs $NGX_OBJS/src/http/modules/perl/
cp -p src/http/modules/perl/typemap $NGX_OBJS/src/http/modules/perl/
@ -36,7 +35,6 @@ $NGX_OBJS/src/http/modules/perl/Makefile: \\
cd $NGX_OBJS/src/http/modules/perl \\
&& NGX_PM_CFLAGS="\$(NGX_PM_CFLAGS) -g $NGX_CC_OPT" \\
NGX_PM_LDFLAGS="$NGX_LD_OPT \$(NGX_PM_LDFLAGS)" \\
NGX_INCS="$CORE_INCS $NGX_OBJS $HTTP_INCS" \\
NGX_DEPS="\$(CORE_DEPS) \$(HTTP_DEPS)" \\
$NGX_PERL Makefile.PL \\

79
auto/lib/sha1/conf Normal file
View File

@ -0,0 +1,79 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
if [ $SHA1 != NONE ]; then
have=NGX_HAVE_SHA1 . auto/have
CORE_INCS="$CORE_INCS $SHA1"
case "$NGX_CC_NAME" in
msvc | owc | bcc)
LINK_DEPS="$LINK_DEPS $SHA1/sha1.lib"
CORE_LIBS="$CORE_LIBS $SHA1/sha1.lib"
;;
icc)
LINK_DEPS="$LINK_DEPS $SHA1/libsha.a"
# to allow -ipo optimization we link with the *.o but not library
CORE_LIBS="$CORE_LIBS $SHA1/sha1_dgst.o"
if [ $SHA1_ASM = YES ]; then
CORE_LIBS="$CORE_LIBS $SHA1/asm/sx86-elf.o"
fi
;;
*)
LINK_DEPS="$LINK_DEPS $SHA1/libsha.a"
CORE_LIBS="$CORE_LIBS $SHA1/libsha.a"
#CORE_LIBS="$CORE_LIBS -L $SHA1 -lsha"
;;
esac
else
if [ "$NGX_PLATFORM" != win32 ]; then
SHA1=NO
# FreeBSD
ngx_feature="sha1 in system md library"
ngx_feature_name=NGX_HAVE_SHA1
ngx_feature_run=no
ngx_feature_incs="#include <sha.h>"
ngx_feature_path=
ngx_feature_libs="-lmd"
ngx_feature_test="SHA_CTX sha1; SHA1_Init(&sha1)"
. auto/feature
ngx_sha1_lib="system md"
if [ $ngx_found = no ]; then
# OpenSSL crypto library
ngx_feature="sha1 in system OpenSSL crypto library"
ngx_feature_incs="#include <openssl/sha.h>"
ngx_feature_libs="-lcrypto"
. auto/feature
ngx_sha1_lib="system crypto"
if [ $ngx_found = yes ]; then
have=NGX_HAVE_OPENSSL_SHA1_H . auto/have
fi
fi
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS $ngx_feature_libs"
SHA1=YES
SHA1_LIB=$ngx_sha1_lib
fi
fi
fi

96
auto/lib/sha1/make Normal file
View File

@ -0,0 +1,96 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
case "$NGX_CC_NAME" in
msvc)
ngx_makefile=makefile.msvc
ngx_opt="CPU_OPT=\"$CPU_OPT\" LIBC=$LIBC SHA1_ASM=$SHA1_ASM"
ngx_sha1="SHA1=\"$SHA1\""
;;
owc)
ngx_makefile=makefile.owc
ngx_opt="CPU_OPT=\"$CPU_OPT\""
ngx_sha1=`echo SHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
bcc)
ngx_makefile=makefile.bcc
ngx_opt="-DCPU_OPT=\"$CPU_OPT\" -DSHA1_ASM=$SHA1_ASM"
ngx_sha1=`echo \-DSHA1=\"$SHA1\" | sed -e "s/\//$ngx_regex_dirsep/g"`
;;
esac
done=NO
case "$NGX_PLATFORM" in
win32)
cat << END >> $NGX_MAKEFILE
`echo "$SHA1/sha1.lib: $NGX_MAKEFILE" | sed -e "s/\//$ngx_regex_dirsep/g"`
\$(MAKE) -f auto/lib/sha1/$ngx_makefile $ngx_opt $ngx_sha1
END
done=YES
;;
SunOS:*:i86pc)
if [ $SHA1_ASM = YES ]; then
cat << END >> $NGX_MAKEFILE
$SHA1/libsha.a: $NGX_MAKEFILE
cd $SHA1 \\
&& \$(MAKE) CFLAGS="$SHA1_OPT -DSOL -DSHA1_ASM -DL_ENDIAN" \\
CC="\$(CC)" CPP="\$(CPP)" \\
SHA_ASM_OBJ=asm/sx86-sol.o clean libsha.a
END
done=YES
fi
;;
# FreeBSD: i386
# Linux: i686
*:i386 | *:i686)
if [ $SHA1_ASM = YES ]; then
cat << END >> $NGX_MAKEFILE
$SHA1/libsha.a: $NGX_MAKEFILE
cd $SHA1 \\
&& \$(MAKE) CFLAGS="$SHA1_OPT -DELF -DSHA1_ASM -DL_ENDIAN" \\
CC="\$(CC)" CPP="\$(CPP)" \\
SHA_ASM_OBJ=asm/sx86-elf.o clean libsha.a
END
done=YES
fi
;;
esac
if [ $done = NO ]; then
cat << END >> $NGX_MAKEFILE
$SHA1/libsha.a: $NGX_MAKEFILE
cd $SHA1 \\
&& \$(MAKE) CFLAGS="$SHA1_OPT" \\
CC="\$(CC)" SHA_ASM_OBJ= clean libsha.a
END
fi

View File

@ -0,0 +1,22 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
CFLAGS = -q -O2 -tWM $(CPU_OPT) -DL_ENDIAN
!if "$(SHA1_ASM)" == "YES"
sha1.lib:
cd $(SHA1)
bcc32 -c $(CFLAGS) -DSHA1_ASM sha1dgst.c
tlib sha1.lib +sha1dgst.obj +"asm\s-win32.obj"
!else
sha1.lib:
cd $(SHA1)
bcc32 -c $(CFLAGS) sha1dgst.c
tlib sha1.lib +sha1dgst.obj
!endif

View File

@ -0,0 +1,22 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
CFLAGS = -nologo -O2 -Ob1 -Oi -Gs $(LIBC) $(CPU_OPT) -D L_ENDIAN
!IF "$(SHA1_ASM)" == "YES"
sha1.lib:
cd $(SHA1)
cl -c $(CFLAGS) -D SHA1_ASM sha1dgst.c
link -lib -out:sha1.lib sha1dgst.obj asm/s-win32.obj
!ELSE
sha1.lib:
cd $(SHA1)
cl -c $(CFLAGS) sha1dgst.c
link -lib -out:sha1.lib sha1dgst.obj
!ENDIF

View File

@ -0,0 +1,11 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
CFLAGS = -zq -bt=nt -bm -ot -op -oi -oe -s $(CPU_OPT)
sha1.lib:
cd $(SHA1)
wcl386 -c $(CFLAGS) -dL_ENDIAN sha1dgst.c
wlib -n sha1.lib sha1dgst.obj

40
auto/lib/test Normal file
View File

@ -0,0 +1,40 @@
# Copyright (C) Igor Sysoev
# Copyright (C) Nginx, Inc.
echo $ngx_n "checking for $ngx_lib ...$ngx_c"
cat << END >> $NGX_AUTOCONF_ERR
----------------------------------------
checking for $ngx_lib
END
ngx_found=no
cat << END > $NGX_AUTOTEST.c
$ngx_lib_incs
int main() {
$ngx_lib_test;
return 0;
}
eval "$CC $cc_test_flags $ngx_lib_cflags \
-o $NGX_AUTOTEST $NGX_AUTOTEST.c $ngx_libs \
>> $NGX_ERR 2>&1"
if [ -x $NGX_AUTOTEST ]; then
echo " found"
ngx_found=yes
else
echo " not found"
fi
rm -rf $NGX_AUTOTEST*

View File

@ -6,10 +6,9 @@
echo "creating $NGX_MAKEFILE"
mkdir -p $NGX_OBJS/src/core $NGX_OBJS/src/event $NGX_OBJS/src/event/modules \
$NGX_OBJS/src/event/quic \
$NGX_OBJS/src/os/unix $NGX_OBJS/src/os/win32 \
$NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/v3 \
$NGX_OBJS/src/http/modules $NGX_OBJS/src/http/modules/perl \
$NGX_OBJS/src/http $NGX_OBJS/src/http/v2 $NGX_OBJS/src/http/modules \
$NGX_OBJS/src/http/modules/perl \
$NGX_OBJS/src/mail \
$NGX_OBJS/src/stream \
$NGX_OBJS/src/misc
@ -32,7 +31,6 @@ END
if test -n "$NGX_PERL_CFLAGS"; then
echo NGX_PERL_CFLAGS = $NGX_PERL_CFLAGS >> $NGX_MAKEFILE
echo NGX_PM_CFLAGS = $NGX_PM_CFLAGS >> $NGX_MAKEFILE
echo NGX_PM_LDFLAGS = $NGX_PM_LDFLAGS >> $NGX_MAKEFILE
fi
@ -157,7 +155,7 @@ fi
ngx_all_srcs="$ngx_all_srcs $MISC_SRCS"
if test -n "$NGX_ADDON_SRCS$DYNAMIC_MODULES"; then
if test -n "$NGX_ADDON_SRCS"; then
cat << END >> $NGX_MAKEFILE
@ -230,7 +228,7 @@ build: binary modules manpage
binary: $NGX_OBJS${ngx_dirsep}nginx$ngx_binext
$NGX_OBJS${ngx_dirsep}nginx$ngx_binext: $ngx_deps$ngx_spacer
\$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_binext$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link
\$(LINK) $ngx_long_start$ngx_binout$NGX_OBJS${ngx_dirsep}nginx$ngx_long_cont$ngx_objs$ngx_libs$ngx_link$ngx_main_link
$ngx_rcc
$ngx_long_end
@ -314,7 +312,7 @@ $ngx_obj: \$(CORE_DEPS) \$(HTTP_DEPS)$ngx_cont$ngx_src
END
fi
done
done
fi
@ -344,7 +342,7 @@ $ngx_obj: \$(CORE_DEPS) \$(MAIL_DEPS)$ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
END
done
done
fi
@ -374,7 +372,7 @@ $ngx_obj: \$(CORE_DEPS) \$(STREAM_DEPS)$ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
END
done
done
fi
@ -400,7 +398,7 @@ $ngx_obj: \$(CORE_DEPS) $ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
END
done
done
fi
@ -432,7 +430,7 @@ $ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
END
done
done
fi
@ -500,10 +498,20 @@ else
ngx_perl_cc="$ngx_perl_cc \$(ALL_INCS)"
fi
ngx_obj_deps="\$(CORE_DEPS)"
if [ $HTTP != NO ]; then
ngx_obj_deps="$ngx_obj_deps \$(HTTP_DEPS)"
fi
if [ $MAIL != NO ]; then
ngx_obj_deps="$ngx_obj_deps \$(MAIL_DEPS)"
fi
if [ $STREAM != NO ]; then
ngx_obj_deps="$ngx_obj_deps \$(STREAM_DEPS)"
fi
for ngx_module in $DYNAMIC_MODULES
do
eval ngx_module_srcs="\$${ngx_module}_SRCS"
eval ngx_module_shrd="\$${ngx_module}_SHRD"
eval eval ngx_module_libs="\\\"\$${ngx_module}_LIBS\\\""
eval ngx_module_modules="\$${ngx_module}_MODULES"
@ -569,7 +577,7 @@ END
| sed -e "s/\(.*\.\)c/\1$ngx_objext/"`
ngx_module_objs=
for ngx_src in $ngx_module_srcs $ngx_module_shrd
for ngx_src in $ngx_module_srcs
do
case "$ngx_src" in
src/*)
@ -656,7 +664,7 @@ END
cat << END >> $NGX_MAKEFILE
$ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src
$ngx_obj: $ngx_obj_deps$ngx_cont$ngx_src
$ngx_perl_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
END
@ -664,7 +672,7 @@ END
cat << END >> $NGX_MAKEFILE
$ngx_obj: \$(ADDON_DEPS)$ngx_cont$ngx_src
$ngx_obj: $ngx_obj_deps$ngx_cont$ngx_src
$ngx_cc$ngx_tab$ngx_objout$ngx_obj$ngx_tab$ngx_src$NGX_AUX
END

View File

@ -17,6 +17,7 @@ if [ "$ngx_module_link" = DYNAMIC ]; then
done
DYNAMIC_MODULES="$DYNAMIC_MODULES $ngx_module"
eval ${ngx_module}_SRCS=\"$ngx_module_srcs\"
eval ${ngx_module}_MODULES=\"$ngx_module_name\"
@ -30,38 +31,10 @@ if [ "$ngx_module_link" = DYNAMIC ]; then
eval ${ngx_module}_ORDER=\"$ngx_module_order\"
fi
srcs=
shrd=
for src in $ngx_module_srcs
do
found=no
for old in $DYNAMIC_MODULES_SRCS
do
if [ $src = $old ]; then
found=yes
break
fi
done
if [ $found = no ]; then
srcs="$srcs $src"
else
shrd="$shrd $src"
fi
done
eval ${ngx_module}_SRCS=\"$srcs\"
eval ${ngx_module}_SHRD=\"$shrd\"
DYNAMIC_MODULES_SRCS="$DYNAMIC_MODULES_SRCS $srcs"
if test -n "$ngx_module_incs"; then
CORE_INCS="$CORE_INCS $ngx_module_incs"
fi
if test -n "$ngx_module_deps"; then
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_module_deps"
fi
libs=
for lib in $ngx_module_libs
do
@ -75,14 +48,10 @@ if [ "$ngx_module_link" = DYNAMIC ]; then
fi
;;
PCRE | OPENSSL | ZLIB)
PCRE | OPENSSL | MD5 | SHA1 | ZLIB)
eval USE_${lib}=YES
;;
MD5 | SHA1)
# obsolete
;;
*)
libs="$libs $lib"
;;
@ -110,14 +79,10 @@ elif [ "$ngx_module_link" = YES ]; then
do
case $lib in
PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
eval USE_${lib}=YES
;;
MD5 | SHA1)
# obsolete
;;
*)
CORE_LIBS="$CORE_LIBS $lib"
;;
@ -130,24 +95,7 @@ elif [ "$ngx_module_link" = ADDON ]; then
eval ${ngx_module_type}_MODULES=\"\$${ngx_module_type}_MODULES \
$ngx_module_name\"
srcs=
for src in $ngx_module_srcs
do
found=no
for old in $NGX_ADDON_SRCS
do
if [ $src = $old ]; then
found=yes
break
fi
done
if [ $found = no ]; then
srcs="$srcs $src"
fi
done
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $srcs"
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_module_srcs"
if test -n "$ngx_module_incs"; then
eval ${ngx_var}_INCS=\"\$${ngx_var}_INCS $ngx_module_incs\"
@ -161,14 +109,10 @@ elif [ "$ngx_module_link" = ADDON ]; then
do
case $lib in
PCRE | OPENSSL | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
PCRE | OPENSSL | MD5 | SHA1 | ZLIB | LIBXSLT | LIBGD | PERL | GEOIP)
eval USE_${lib}=YES
;;
MD5 | SHA1)
# obsolete
;;
*)
CORE_LIBS="$CORE_LIBS $lib"
;;

File diff suppressed because it is too large Load Diff

View File

@ -44,8 +44,7 @@ EVENT_POLL=NO
USE_THREADS=NO
NGX_FILE_AIO=NO
QUIC_BPF=NO
NGX_IPV6=NO
HTTP=YES
@ -61,8 +60,8 @@ HTTP_CHARSET=YES
HTTP_GZIP=YES
HTTP_SSL=NO
HTTP_V2=NO
HTTP_V3=NO
HTTP_SSI=YES
HTTP_POSTPONE=NO
HTTP_REALIP=NO
HTTP_XSLT=NO
HTTP_IMAGE_FILTER=NO
@ -72,7 +71,6 @@ HTTP_DAV=NO
HTTP_ACCESS=YES
HTTP_AUTH_BASIC=YES
HTTP_AUTH_REQUEST=NO
HTTP_MIRROR=YES
HTTP_USERID=YES
HTTP_SLICE=NO
HTTP_AUTOINDEX=YES
@ -88,7 +86,6 @@ HTTP_PROXY=YES
HTTP_FASTCGI=YES
HTTP_UWSGI=YES
HTTP_SCGI=YES
HTTP_GRPC=YES
HTTP_PERL=NO
HTTP_MEMCACHED=YES
HTTP_LIMIT_CONN=YES
@ -104,7 +101,6 @@ HTTP_GZIP_STATIC=NO
HTTP_UPSTREAM_HASH=YES
HTTP_UPSTREAM_IP_HASH=YES
HTTP_UPSTREAM_LEAST_CONN=YES
HTTP_UPSTREAM_RANDOM=YES
HTTP_UPSTREAM_KEEPALIVE=YES
HTTP_UPSTREAM_ZONE=YES
@ -119,43 +115,37 @@ MAIL_SMTP=YES
STREAM=NO
STREAM_SSL=NO
STREAM_QUIC=NO
STREAM_REALIP=NO
STREAM_LIMIT_CONN=YES
STREAM_ACCESS=YES
STREAM_GEO=YES
STREAM_GEOIP=NO
STREAM_MAP=YES
STREAM_SPLIT_CLIENTS=YES
STREAM_RETURN=YES
STREAM_SET=YES
STREAM_UPSTREAM_HASH=YES
STREAM_UPSTREAM_LEAST_CONN=YES
STREAM_UPSTREAM_RANDOM=YES
STREAM_UPSTREAM_ZONE=YES
STREAM_SSL_PREREAD=NO
DYNAMIC_MODULES=
DYNAMIC_MODULES_SRCS=
NGX_ADDONS=
NGX_ADDON_SRCS=
NGX_ADDON_DEPS=
DYNAMIC_ADDONS=
NGX_COMPAT=NO
USE_PCRE=NO
PCRE=NONE
PCRE_OPT=
PCRE_CONF_OPT=
PCRE_JIT=NO
PCRE2=YES
USE_OPENSSL=NO
USE_OPENSSL_QUIC=NO
OPENSSL=NONE
USE_MD5=NO
MD5=NONE
MD5_OPT=
MD5_ASM=NO
USE_SHA1=NO
SHA1=NONE
SHA1_OPT=
SHA1_ASM=NO
USE_ZLIB=NO
ZLIB=NONE
ZLIB_OPT=
@ -171,8 +161,6 @@ USE_GEOIP=NO
NGX_GOOGLE_PERFTOOLS=NO
NGX_CPP_TEST=NO
SO_COOKIE_FOUND=NO
NGX_LIBATOMIC=NO
NGX_CPU_CACHE_LINE=
@ -217,13 +205,7 @@ do
--with-threads) USE_THREADS=YES ;;
--with-file-aio) NGX_FILE_AIO=YES ;;
--without-quic_bpf_module) QUIC_BPF=NONE ;;
--with-ipv6)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-ipv6\" option is deprecated"
;;
--with-ipv6) NGX_IPV6=YES ;;
--without-http) HTTP=NO ;;
--without-http-cache) HTTP_CACHE=NO ;;
@ -237,7 +219,6 @@ $0: warning: the \"--with-ipv6\" option is deprecated"
--with-http_ssl_module) HTTP_SSL=YES ;;
--with-http_v2_module) HTTP_V2=YES ;;
--with-http_v3_module) HTTP_V3=YES ;;
--with-http_realip_module) HTTP_REALIP=YES ;;
--with-http_addition_module) HTTP_ADDITION=YES ;;
--with-http_xslt_module) HTTP_XSLT=YES ;;
@ -266,7 +247,6 @@ $0: warning: the \"--with-ipv6\" option is deprecated"
--without-http_userid_module) HTTP_USERID=NO ;;
--without-http_access_module) HTTP_ACCESS=NO ;;
--without-http_auth_basic_module) HTTP_AUTH_BASIC=NO ;;
--without-http_mirror_module) HTTP_MIRROR=NO ;;
--without-http_autoindex_module) HTTP_AUTOINDEX=NO ;;
--without-http_status_module) HTTP_STATUS=NO ;;
--without-http_geo_module) HTTP_GEO=NO ;;
@ -278,7 +258,6 @@ $0: warning: the \"--with-ipv6\" option is deprecated"
--without-http_fastcgi_module) HTTP_FASTCGI=NO ;;
--without-http_uwsgi_module) HTTP_UWSGI=NO ;;
--without-http_scgi_module) HTTP_SCGI=NO ;;
--without-http_grpc_module) HTTP_GRPC=NO ;;
--without-http_memcached_module) HTTP_MEMCACHED=NO ;;
--without-http_limit_conn_module) HTTP_LIMIT_CONN=NO ;;
--without-http_limit_req_module) HTTP_LIMIT_REQ=NO ;;
@ -288,8 +267,6 @@ $0: warning: the \"--with-ipv6\" option is deprecated"
--without-http_upstream_ip_hash_module) HTTP_UPSTREAM_IP_HASH=NO ;;
--without-http_upstream_least_conn_module)
HTTP_UPSTREAM_LEAST_CONN=NO ;;
--without-http_upstream_random_module)
HTTP_UPSTREAM_RANDOM=NO ;;
--without-http_upstream_keepalive_module) HTTP_UPSTREAM_KEEPALIVE=NO ;;
--without-http_upstream_zone_module) HTTP_UPSTREAM_ZONE=NO ;;
@ -324,28 +301,13 @@ use the \"--with-mail_ssl_module\" option instead"
--with-stream) STREAM=YES ;;
--with-stream=dynamic) STREAM=DYNAMIC ;;
--with-stream_ssl_module) STREAM_SSL=YES ;;
--with-stream_quic_module) STREAM_QUIC=YES ;;
--with-stream_realip_module) STREAM_REALIP=YES ;;
--with-stream_geoip_module) STREAM_GEOIP=YES ;;
--with-stream_geoip_module=dynamic)
STREAM_GEOIP=DYNAMIC ;;
--with-stream_ssl_preread_module)
STREAM_SSL_PREREAD=YES ;;
--without-stream_limit_conn_module)
STREAM_LIMIT_CONN=NO ;;
--without-stream_access_module) STREAM_ACCESS=NO ;;
--without-stream_geo_module) STREAM_GEO=NO ;;
--without-stream_map_module) STREAM_MAP=NO ;;
--without-stream_split_clients_module)
STREAM_SPLIT_CLIENTS=NO ;;
--without-stream_return_module) STREAM_RETURN=NO ;;
--without-stream_set_module) STREAM_SET=NO ;;
--without-stream_upstream_hash_module)
STREAM_UPSTREAM_HASH=NO ;;
--without-stream_upstream_least_conn_module)
STREAM_UPSTREAM_LEAST_CONN=NO ;;
--without-stream_upstream_random_module)
STREAM_UPSTREAM_RANDOM=NO ;;
--without-stream_upstream_zone_module)
STREAM_UPSTREAM_ZONE=NO ;;
@ -355,8 +317,6 @@ use the \"--with-mail_ssl_module\" option instead"
--add-module=*) NGX_ADDONS="$NGX_ADDONS $value" ;;
--add-dynamic-module=*) DYNAMIC_ADDONS="$DYNAMIC_ADDONS $value" ;;
--with-compat) NGX_COMPAT=YES ;;
--with-cc=*) CC="$value" ;;
--with-cpp=*) CPP="$value" ;;
--with-cc-opt=*) NGX_CC_OPT="$value" ;;
@ -369,36 +329,17 @@ use the \"--with-mail_ssl_module\" option instead"
--with-pcre=*) PCRE="$value" ;;
--with-pcre-opt=*) PCRE_OPT="$value" ;;
--with-pcre-jit) PCRE_JIT=YES ;;
--without-pcre2) PCRE2=DISABLED ;;
--with-openssl=*) OPENSSL="$value" ;;
--with-openssl-opt=*) OPENSSL_OPT="$value" ;;
--with-md5=*)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-md5\" option is deprecated"
;;
--with-md5-opt=*)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-md5-opt\" option is deprecated"
;;
--with-md5-asm)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-md5-asm\" option is deprecated"
;;
--with-md5=*) MD5="$value" ;;
--with-md5-opt=*) MD5_OPT="$value" ;;
--with-md5-asm) MD5_ASM=YES ;;
--with-sha1=*)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-sha1\" option is deprecated"
;;
--with-sha1-opt=*)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-sha1-opt\" option is deprecated"
;;
--with-sha1-asm)
NGX_POST_CONF_MSG="$NGX_POST_CONF_MSG
$0: warning: the \"--with-sha1-asm\" option is deprecated"
;;
--with-sha1=*) SHA1="$value" ;;
--with-sha1-opt=*) SHA1_OPT="$value" ;;
--with-sha1-asm) SHA1_ASM=YES ;;
--with-zlib=*) ZLIB="$value" ;;
--with-zlib-opt=*) ZLIB_OPT="$value" ;;
@ -453,12 +394,10 @@ cat << END
--with-threads enable thread pool support
--with-file-aio enable file AIO support
--without-quic_bpf_module disable ngx_quic_bpf_module
--with-ipv6 enable IPv6 support
--with-http_ssl_module enable ngx_http_ssl_module
--with-http_v2_module enable ngx_http_v2_module
--with-http_v3_module enable ngx_http_v3_module
--with-http_realip_module enable ngx_http_realip_module
--with-http_addition_module enable ngx_http_addition_module
--with-http_xslt_module enable ngx_http_xslt_module
@ -487,7 +426,6 @@ cat << END
--without-http_userid_module disable ngx_http_userid_module
--without-http_access_module disable ngx_http_access_module
--without-http_auth_basic_module disable ngx_http_auth_basic_module
--without-http_mirror_module disable ngx_http_mirror_module
--without-http_autoindex_module disable ngx_http_autoindex_module
--without-http_geo_module disable ngx_http_geo_module
--without-http_map_module disable ngx_http_map_module
@ -498,7 +436,6 @@ cat << END
--without-http_fastcgi_module disable ngx_http_fastcgi_module
--without-http_uwsgi_module disable ngx_http_uwsgi_module
--without-http_scgi_module disable ngx_http_scgi_module
--without-http_grpc_module disable ngx_http_grpc_module
--without-http_memcached_module disable ngx_http_memcached_module
--without-http_limit_conn_module disable ngx_http_limit_conn_module
--without-http_limit_req_module disable ngx_http_limit_req_module
@ -510,8 +447,6 @@ cat << END
disable ngx_http_upstream_ip_hash_module
--without-http_upstream_least_conn_module
disable ngx_http_upstream_least_conn_module
--without-http_upstream_random_module
disable ngx_http_upstream_random_module
--without-http_upstream_keepalive_module
disable ngx_http_upstream_keepalive_module
--without-http_upstream_zone_module
@ -547,25 +482,12 @@ cat << END
--with-stream enable TCP/UDP proxy module
--with-stream=dynamic enable dynamic TCP/UDP proxy module
--with-stream_ssl_module enable ngx_stream_ssl_module
--with-stream_quic_module enable ngx_stream_quic_module
--with-stream_realip_module enable ngx_stream_realip_module
--with-stream_geoip_module enable ngx_stream_geoip_module
--with-stream_geoip_module=dynamic enable dynamic ngx_stream_geoip_module
--with-stream_ssl_preread_module enable ngx_stream_ssl_preread_module
--without-stream_limit_conn_module disable ngx_stream_limit_conn_module
--without-stream_access_module disable ngx_stream_access_module
--without-stream_geo_module disable ngx_stream_geo_module
--without-stream_map_module disable ngx_stream_map_module
--without-stream_split_clients_module
disable ngx_stream_split_clients_module
--without-stream_return_module disable ngx_stream_return_module
--without-stream_set_module disable ngx_stream_set_module
--without-stream_upstream_hash_module
disable ngx_stream_upstream_hash_module
--without-stream_upstream_least_conn_module
disable ngx_stream_upstream_least_conn_module
--without-stream_upstream_random_module
disable ngx_stream_upstream_random_module
--without-stream_upstream_zone_module
disable ngx_stream_upstream_zone_module
@ -575,8 +497,6 @@ cat << END
--add-module=PATH enable external module
--add-dynamic-module=PATH enable dynamic external module
--with-compat dynamic modules compatibility
--with-cc=PATH set C compiler pathname
--with-cpp=PATH set C preprocessor pathname
--with-cc-opt=OPTIONS set additional C compiler options
@ -590,7 +510,14 @@ cat << END
--with-pcre=DIR set path to PCRE library sources
--with-pcre-opt=OPTIONS set additional build options for PCRE
--with-pcre-jit build PCRE with JIT compilation support
--without-pcre2 do not use PCRE2 library
--with-md5=DIR set path to md5 library sources
--with-md5-opt=OPTIONS set additional build options for md5
--with-md5-asm use md5 assembler sources
--with-sha1=DIR set path to sha1 library sources
--with-sha1-opt=OPTIONS set additional build options for sha1
--with-sha1-asm use sha1 assembler sources
--with-zlib=DIR set path to zlib library sources
--with-zlib-opt=OPTIONS set additional build options for zlib
@ -612,6 +539,19 @@ END
fi
if [ $HTTP = NO ]; then
HTTP_CHARSET=NO
HTTP_GZIP=NO
HTTP_SSI=NO
HTTP_USERID=NO
HTTP_ACCESS=NO
HTTP_STATUS=NO
HTTP_REWRITE=NO
HTTP_PROXY=NO
HTTP_FASTCGI=NO
fi
if [ ".$NGX_PLATFORM" = ".win32" ]; then
NGX_WINE=$WINE
fi

View File

@ -41,14 +41,6 @@ case "$NGX_PLATFORM" in
'
;;
NetBSD:*)
CORE_INCS="$UNIX_INCS"
CORE_DEPS="$UNIX_DEPS $POSIX_DEPS"
CORE_SRCS="$UNIX_SRCS"
NGX_RPATH=YES
;;
HP-UX:*)
# HP/UX
have=NGX_HPUX . auto/have_headers
@ -110,11 +102,6 @@ case "$NGX_MACHINE" in
NGX_MACH_CACHE_LINE=64
;;
aarch64 | arm64)
have=NGX_ALIGNMENT value=16 . auto/define
NGX_MACH_CACHE_LINE=64
;;
*)
have=NGX_ALIGNMENT value=16 . auto/define
NGX_MACH_CACHE_LINE=32

View File

@ -17,9 +17,6 @@ ngx_spacer='
MAIN_LINK=
MODULE_LINK="-shared -Wl,-undefined,dynamic_lookup"
CC_AUX_FLAGS="$CC_AUX_FLAGS -D__APPLE_USE_RFC_3542"
# kqueue
echo " + kqueue found"
@ -89,6 +86,7 @@ ngx_feature_test="int kq;
# sendfile()
CC_AUX_FLAGS="$CC_AUX_FLAGS"
ngx_feature="sendfile()"
ngx_feature_name="NGX_HAVE_SENDFILE"
ngx_feature_run=yes
@ -115,6 +113,6 @@ ngx_feature_run=no
ngx_feature_incs="#include <libkern/OSAtomic.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int32_t lock = 0;
if (!OSAtomicCompareAndSwap32Barrier(0, 1, &lock)) return 1"
ngx_feature_test="int32_t lock, n;
n = OSAtomicCompareAndSwap32Barrier(0, 1, &lock)"
. auto/feature

View File

@ -44,10 +44,12 @@ if [ $osreldate -gt 300007 ]; then
CORE_SRCS="$CORE_SRCS $FREEBSD_SENDFILE_SRCS"
fi
if [ $osreldate -gt 1100093 ]; then
echo " + sendfile()'s SF_NODISKIO found"
if [ $NGX_FILE_AIO = YES ]; then
if [ $osreldate -gt 502103 ]; then
echo " + sendfile()'s SF_NODISKIO found"
have=NGX_HAVE_SENDFILE_NODISKIO . auto/have
have=NGX_HAVE_AIO_SENDFILE . auto/have
fi
fi
# POSIX semaphores

View File

@ -44,7 +44,6 @@ ngx_feature_test="int efd = 0;
struct epoll_event ee;
ee.events = EPOLLIN|EPOLLOUT|EPOLLET;
ee.data.ptr = NULL;
(void) ee;
efd = epoll_create(100);
if (efd == -1) return 1;"
. auto/feature
@ -70,47 +69,6 @@ if [ $ngx_found = yes ]; then
ee.data.ptr = NULL;
epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
. auto/feature
# EPOLLEXCLUSIVE appeared in Linux 4.5, glibc 2.24
ngx_feature="EPOLLEXCLUSIVE"
ngx_feature_name="NGX_HAVE_EPOLLEXCLUSIVE"
ngx_feature_run=no
ngx_feature_incs="#include <sys/epoll.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int efd = 0, fd = 0;
struct epoll_event ee;
ee.events = EPOLLIN|EPOLLEXCLUSIVE;
ee.data.ptr = NULL;
epoll_ctl(efd, EPOLL_CTL_ADD, fd, &ee)"
. auto/feature
# eventfd()
ngx_feature="eventfd()"
ngx_feature_name="NGX_HAVE_EVENTFD"
ngx_feature_run=no
ngx_feature_incs="#include <sys/eventfd.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="(void) eventfd(0, 0)"
. auto/feature
if [ $ngx_found = yes ]; then
have=NGX_HAVE_SYS_EVENTFD_H . auto/have
fi
if [ $ngx_found = no ]; then
ngx_feature="eventfd() (SYS_eventfd)"
ngx_feature_incs="#include <sys/syscall.h>"
ngx_feature_test="(void) SYS_eventfd"
. auto/feature
fi
fi
@ -182,37 +140,17 @@ ngx_feature_test="if (prctl(PR_SET_DUMPABLE, 1, 0, 0, 0) == -1) return 1"
. auto/feature
# prctl(PR_SET_KEEPCAPS)
# sched_setaffinity()
ngx_feature="prctl(PR_SET_KEEPCAPS)"
ngx_feature_name="NGX_HAVE_PR_SET_KEEPCAPS"
ngx_feature_run=yes
ngx_feature_incs="#include <sys/prctl.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="if (prctl(PR_SET_KEEPCAPS, 1, 0, 0, 0) == -1) return 1"
. auto/feature
# capabilities
ngx_feature="capabilities"
ngx_feature_name="NGX_HAVE_CAPABILITIES"
ngx_feature="sched_setaffinity()"
ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
ngx_feature_run=no
ngx_feature_incs="#include <linux/capability.h>
#include <sys/syscall.h>"
ngx_feature_incs="#include <sched.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct __user_cap_data_struct data;
struct __user_cap_header_struct header;
header.version = _LINUX_CAPABILITY_VERSION_1;
data.effective = CAP_TO_MASK(CAP_NET_RAW);
data.permitted = 0;
(void) header;
(void) data;
(void) SYS_capset"
ngx_feature_test="cpu_set_t mask;
CPU_ZERO(&mask);
sched_setaffinity(0, sizeof(cpu_set_t), &mask)"
. auto/feature
@ -232,63 +170,4 @@ ngx_feature_test="struct crypt_data cd;
ngx_include="sys/vfs.h"; . auto/include
# BPF sockhash
ngx_feature="BPF sockhash"
ngx_feature_name="NGX_HAVE_BPF"
ngx_feature_run=no
ngx_feature_incs="#include <linux/bpf.h>
#include <sys/syscall.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="union bpf_attr attr = { 0 };
attr.map_flags = 0;
attr.map_type = BPF_MAP_TYPE_SOCKHASH;
syscall(__NR_bpf, 0, &attr, 0);"
. auto/feature
if [ $ngx_found = yes ]; then
CORE_SRCS="$CORE_SRCS src/core/ngx_bpf.c"
CORE_DEPS="$CORE_DEPS src/core/ngx_bpf.h"
if [ $QUIC_BPF != NONE ]; then
QUIC_BPF=YES
fi
fi
ngx_feature="SO_COOKIE"
ngx_feature_name="NGX_HAVE_SO_COOKIE"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
$NGX_INCLUDE_INTTYPES_H"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="socklen_t optlen = sizeof(uint64_t);
uint64_t cookie;
getsockopt(0, SOL_SOCKET, SO_COOKIE, &cookie, &optlen)"
. auto/feature
if [ $ngx_found = yes ]; then
SO_COOKIE_FOUND=YES
fi
# UDP segmentation offloading
ngx_feature="UDP_SEGMENT"
ngx_feature_name="NGX_HAVE_UDP_SEGMENT"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/udp.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="socklen_t optlen = sizeof(int);
int val;
getsockopt(0, SOL_UDP, UDP_SEGMENT, &val, &optlen)"
. auto/feature
CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"

View File

@ -52,7 +52,7 @@ ngx_feature_run=no
ngx_feature_incs="#include <port.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="(void) port_create()"
ngx_feature_test="int n = port_create()"
. auto/feature
if [ $ngx_found = yes ]; then

View File

@ -11,10 +11,8 @@ CORE_SRCS="$WIN32_SRCS $IOCP_SRCS"
OS_CONFIG="$WIN32_CONFIG"
NGX_ICONS="$NGX_WIN32_ICONS"
SELECT_SRCS=$WIN32_SELECT_SRCS
POLL_SRCS=$WIN32_POLL_SRCS
ngx_pic_opt=
ngx_binext=".exe"
case "$NGX_CC_NAME" in
@ -32,8 +30,15 @@ case "$NGX_CC_NAME" in
esac
EVENT_MODULES="$EVENT_MODULES $IOCP_MODULE"
#EVENT_FOUND=YES
EVENT_FOUND=YES
have=NGX_HAVE_INET6 . auto/have
if [ $EVENT_SELECT = NO ]; then
CORE_SRCS="$CORE_SRCS $SELECT_SRCS"
EVENT_MODULES="$EVENT_MODULES $SELECT_MODULE"
fi
if [ $NGX_IPV6 = YES ]; then
have=NGX_HAVE_INET6 . auto/have
fi
have=NGX_HAVE_IOCP . auto/have

View File

@ -61,7 +61,6 @@ CORE_SRCS="src/core/nginx.c \
src/core/ngx_crc32.c \
src/core/ngx_murmurhash.c \
src/core/ngx_md5.c \
src/core/ngx_sha1.c \
src/core/ngx_rbtree.c \
src/core/ngx_radix_tree.c \
src/core/ngx_slab.c \
@ -83,20 +82,18 @@ CORE_SRCS="src/core/nginx.c \
EVENT_MODULES="ngx_events_module ngx_event_core_module"
EVENT_INCS="src/event src/event/modules src/event/quic"
EVENT_INCS="src/event src/event/modules"
EVENT_DEPS="src/event/ngx_event.h \
src/event/ngx_event_timer.h \
src/event/ngx_event_posted.h \
src/event/ngx_event_connect.h \
src/event/ngx_event_pipe.h \
src/event/ngx_event_udp.h"
src/event/ngx_event_pipe.h"
EVENT_SRCS="src/event/ngx_event.c \
src/event/ngx_event_timer.c \
src/event/ngx_event_posted.c \
src/event/ngx_event_accept.c \
src/event/ngx_event_udp.c \
src/event/ngx_event_connect.c \
src/event/ngx_event_pipe.c"
@ -107,7 +104,6 @@ WIN32_SELECT_SRCS=src/event/modules/ngx_win32_select_module.c
POLL_MODULE=ngx_poll_module
POLL_SRCS=src/event/modules/ngx_poll_module.c
WIN32_POLL_SRCS=src/event/modules/ngx_win32_poll_module.c
KQUEUE_MODULE=ngx_kqueue_module
KQUEUE_SRCS=src/event/modules/ngx_kqueue_module.c
@ -170,7 +166,6 @@ UNIX_SRCS="$CORE_SRCS $EVENT_SRCS \
src/os/unix/ngx_send.c \
src/os/unix/ngx_writev_chain.c \
src/os/unix/ngx_udp_send.c \
src/os/unix/ngx_udp_sendmsg_chain.c \
src/os/unix/ngx_channel.c \
src/os/unix/ngx_shmem.c \
src/os/unix/ngx_process.c \
@ -256,6 +251,3 @@ NGX_WIN32_RC="src/os/win32/nginx.rc"
HTTP_FILE_CACHE_SRCS=src/http/ngx_http_file_cache.c
HTTP_HUFF_SRCS="src/http/ngx_http_huff_decode.c
src/http/ngx_http_huff_encode.c"

View File

@ -16,9 +16,9 @@ if [ $USE_PCRE = DISABLED ]; then
else
case $PCRE in
YES) echo " + using system $PCRE_LIBRARY library" ;;
YES) echo " + using system PCRE library" ;;
NONE) echo " + PCRE library is not used" ;;
*) echo " + using $PCRE_LIBRARY library: $PCRE" ;;
*) echo " + using PCRE library: $PCRE" ;;
esac
fi
@ -28,6 +28,20 @@ case $OPENSSL in
*) echo " + using OpenSSL library: $OPENSSL" ;;
esac
case $MD5 in
YES) echo " + md5: using $MD5_LIB library" ;;
NONE) echo " + md5 library is not used" ;;
NO) echo " + using builtin md5 code" ;;
*) echo " + using md5 library: $MD5" ;;
esac
case $SHA1 in
YES) echo " + sha1: using $SHA1_LIB library" ;;
NONE) echo " + sha1 library is not used" ;;
NO) echo " + sha1 library is not found" ;;
*) echo " + using sha1 library: $SHA1" ;;
esac
case $ZLIB in
YES) echo " + using system zlib library" ;;
NONE) echo " + zlib library is not used" ;;

View File

@ -17,5 +17,4 @@ END
CORE_DEPS="$CORE_DEPS $THREAD_POOL_DEPS"
CORE_SRCS="$CORE_SRCS $THREAD_POOL_SRCS"
CORE_LIBS="$CORE_LIBS -lpthread"
NGX_LIBPTHREAD="-lpthread"
fi

View File

@ -25,7 +25,7 @@ $NGX_INCLUDE_UNISTD_H
$NGX_INCLUDE_INTTYPES_H
$NGX_INCLUDE_AUTO_CONFIG_H
int main(void) {
int main() {
printf("%d", (int) sizeof($ngx_type));
return 0;
}

View File

@ -27,7 +27,7 @@ do
#include <netinet/in.h>
$NGX_INCLUDE_INTTYPES_H
int main(void) {
int main() {
$ngx_try i = 0;
return (int) i;
}

View File

@ -17,9 +17,9 @@ found=no
cat << END > $NGX_AUTOTEST.c
#include <sys/types.h>
$NGX_INCLUDE_INTTYPES_H
$NGX_INTTYPES_H
int main(void) {
int main() {
uintptr_t i = 0;
return (int) i;
}

255
auto/unix Normal file → Executable file
View File

@ -75,7 +75,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_incs="#include <sys/event.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="(void) kqueue()"
ngx_feature_test="int kq; kq = kqueue()"
. auto/feature
if [ $ngx_found = yes ]; then
@ -92,8 +92,7 @@ if test -z "$NGX_KQUEUE_CHECKED"; then
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct kevent kev;
kev.fflags = NOTE_LOWAT;
(void) kev"
kev.fflags = NOTE_LOWAT;"
. auto/feature
@ -261,11 +260,11 @@ ngx_feature_run=no
ngx_feature_incs="#include <dlfcn.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, \"\")"
ngx_feature_test="dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); dlsym(NULL, NULL)"
. auto/feature
if [ $ngx_found = no ]; then
if [ $ngx_found != yes ]; then
ngx_feature="dlopen() in libdl"
ngx_feature_libs="-ldl"
@ -288,7 +287,7 @@ ngx_feature_test="sched_yield()"
. auto/feature
if [ $ngx_found = no ]; then
if [ $ngx_found != yes ]; then
ngx_feature="sched_yield() in librt"
ngx_feature_libs="-lrt"
@ -300,18 +299,6 @@ if [ $ngx_found = no ]; then
fi
ngx_feature="sched_setaffinity()"
ngx_feature_name="NGX_HAVE_SCHED_SETAFFINITY"
ngx_feature_run=no
ngx_feature_incs="#include <sched.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="cpu_set_t mask;
CPU_ZERO(&mask);
sched_setaffinity(0, sizeof(cpu_set_t), &mask)"
. auto/feature
ngx_feature="SO_SETFIB"
ngx_feature_name="NGX_HAVE_SETFIB"
ngx_feature_run=no
@ -342,57 +329,6 @@ ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_ACCEPTFILTER, NULL, 0)"
. auto/feature
# OpenBSD bind to any address for transparent proxying
ngx_feature="SO_BINDANY"
ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, SOL_SOCKET, SO_BINDANY, NULL, 0)"
. auto/feature
# Linux transparent proxying
ngx_feature="IP_TRANSPARENT"
ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_TRANSPARENT, NULL, 0)"
. auto/feature
# FreeBSD bind to any address for transparent proxying
ngx_feature="IP_BINDANY"
ngx_feature_name="NGX_HAVE_TRANSPARENT_PROXY"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BINDANY, NULL, 0)"
. auto/feature
# Linux IP_BIND_ADDRESS_NO_PORT
ngx_feature="IP_BIND_ADDRESS_NO_PORT"
ngx_feature_name="NGX_HAVE_IP_BIND_ADDRESS_NO_PORT"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_BIND_ADDRESS_NO_PORT, NULL, 0)"
. auto/feature
# BSD way to get IPv4 datagram destination address
ngx_feature="IP_RECVDSTADDR"
@ -406,19 +342,6 @@ ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_RECVDSTADDR, NULL, 0)"
. auto/feature
# BSD way to set IPv4 datagram source address
ngx_feature="IP_SENDSRCADDR"
ngx_feature_name="NGX_HAVE_IP_SENDSRCADDR"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_SENDSRCADDR, NULL, 0)"
. auto/feature
# Linux way to get IPv4 datagram destination address
ngx_feature="IP_PKTINFO"
@ -428,10 +351,7 @@ ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct in_pktinfo pkt;
pkt.ipi_spec_dst.s_addr = INADDR_ANY;
(void) pkt;
setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
ngx_feature_test="setsockopt(0, IPPROTO_IP, IP_PKTINFO, NULL, 0)"
. auto/feature
@ -521,9 +441,9 @@ if [ $NGX_FILE_AIO = YES ]; then
ngx_feature_incs="#include <aio.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct aiocb iocb;
ngx_feature_test="int n; struct aiocb iocb;
iocb.aio_sigevent.sigev_notify = SIGEV_KEVENT;
(void) aio_read(&iocb)"
n = aio_read(&iocb)"
. auto/feature
if [ $ngx_found = yes ]; then
@ -543,7 +463,6 @@ if [ $NGX_FILE_AIO = YES ]; then
iocb.aio_lio_opcode = IOCB_CMD_PREAD;
iocb.aio_flags = IOCB_FLAG_RESFD;
iocb.aio_resfd = -1;
(void) iocb;
(void) eventfd(0, 0)"
. auto/feature
@ -559,12 +478,11 @@ if [ $NGX_FILE_AIO = YES ]; then
ngx_feature="Linux AIO support (SYS_eventfd)"
ngx_feature_incs="#include <linux/aio_abi.h>
#include <sys/syscall.h>"
ngx_feature_test="struct iocb iocb;
ngx_feature_test="int n = SYS_eventfd;
struct iocb iocb;
iocb.aio_lio_opcode = IOCB_CMD_PREAD;
iocb.aio_flags = IOCB_FLAG_RESFD;
iocb.aio_resfd = -1;
(void) iocb;
(void) SYS_eventfd"
iocb.aio_resfd = -1;"
. auto/feature
if [ $ngx_found = yes ]; then
@ -582,6 +500,29 @@ Currently file AIO is supported on FreeBSD 4.3+ and Linux 2.6.22+ only
END
exit 1
fi
else
ngx_feature="eventfd()"
ngx_feature_name="NGX_HAVE_EVENTFD"
ngx_feature_run=no
ngx_feature_incs="#include <sys/eventfd.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="(void) eventfd(0, 0)"
. auto/feature
if [ $ngx_found = yes ]; then
have=NGX_HAVE_SYS_EVENTFD_H . auto/have
fi
if [ $ngx_found = no ]; then
ngx_feature="eventfd() (SYS_eventfd)"
ngx_feature_incs="#include <sys/syscall.h>"
ngx_feature_test="int n = SYS_eventfd"
. auto/feature
fi
fi
@ -642,18 +583,19 @@ ngx_param=NGX_MAX_TIME_T_VALUE; ngx_value=$ngx_max_value; . auto/types/value
# syscalls, libc calls and some features
ngx_feature="AF_INET6"
ngx_feature_name="NGX_HAVE_INET6"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct sockaddr_in6 sin6;
sin6.sin6_family = AF_INET6;
(void) sin6"
. auto/feature
if [ $NGX_IPV6 = YES ]; then
ngx_feature="AF_INET6"
ngx_feature_name="NGX_HAVE_INET6"
ngx_feature_run=no
ngx_feature_incs="#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct sockaddr_in6 sin6;
sin6.sin6_family = AF_INET6;"
. auto/feature
fi
ngx_feature="setproctitle()"
@ -704,33 +646,17 @@ ngx_feature_test="char buf[1]; struct iovec vec[1]; ssize_t n;
. auto/feature
# strerrordesc_np(), introduced in glibc 2.32
ngx_feature="strerrordesc_np()"
ngx_feature_name="NGX_HAVE_STRERRORDESC_NP"
ngx_feature_run=no
ngx_feature_incs='#include <string.h>'
ngx_feature="sys_nerr"
ngx_feature_name="NGX_SYS_NERR"
ngx_feature_run=value
ngx_feature_incs='#include <errno.h>
#include <stdio.h>'
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="char *p; p = strerrordesc_np(0);
if (p == NULL) return 1"
ngx_feature_test='printf("%d", sys_nerr);'
. auto/feature
if [ $ngx_found = no ]; then
ngx_feature="sys_nerr"
ngx_feature_name="NGX_SYS_NERR"
ngx_feature_run=value
ngx_feature_incs='#include <errno.h>
#include <stdio.h>'
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test='printf("%d", sys_nerr);'
. auto/feature
fi
if [ $ngx_found = no ]; then
# Cygiwn defines _sys_nerr
@ -746,6 +672,34 @@ if [ $ngx_found = no ]; then
fi
if [ $ngx_found = no ]; then
# Solaris has no sys_nerr
ngx_feature='maximum errno'
ngx_feature_name=NGX_SYS_NERR
ngx_feature_run=value
ngx_feature_incs='#include <errno.h>
#include <string.h>
#include <stdio.h>'
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test='int n;
char *p;
for (n = 1; n < 1000; n++) {
errno = 0;
p = strerror(n);
if (errno == EINVAL
|| p == NULL
|| strncmp(p, "Unknown error", 13) == 0)
{
break;
}
}
printf("%d", n);'
. auto/feature
fi
ngx_feature="localtime_r()"
ngx_feature_name="NGX_HAVE_LOCALTIME_R"
ngx_feature_run=no
@ -756,30 +710,6 @@ ngx_feature_test="struct tm t; time_t c=0; localtime_r(&c, &t)"
. auto/feature
ngx_feature="clock_gettime(CLOCK_MONOTONIC)"
ngx_feature_name="NGX_HAVE_CLOCK_MONOTONIC"
ngx_feature_run=no
ngx_feature_incs="#include <time.h>"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts)"
. auto/feature
if [ $ngx_found = no ]; then
# Linux before glibc 2.17, notably CentOS 6
ngx_feature="clock_gettime(CLOCK_MONOTONIC) in librt"
ngx_feature_libs="-lrt"
. auto/feature
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS -lrt"
fi
fi
ngx_feature="posix_memalign()"
ngx_feature_name="NGX_HAVE_POSIX_MEMALIGN"
ngx_feature_run=no
@ -866,7 +796,6 @@ if [ $ngx_found = no ]; then
if [ $ngx_found = yes ]; then
CORE_LIBS="$CORE_LIBS -lpthread"
NGX_LIBPTHREAD="-lpthread"
fi
fi
@ -908,18 +837,6 @@ ngx_feature_test="int i = FIONBIO; printf(\"%d\", i)"
. auto/feature
ngx_feature="ioctl(FIONREAD)"
ngx_feature_name="NGX_HAVE_FIONREAD"
ngx_feature_run=no
ngx_feature_incs="#include <sys/ioctl.h>
#include <stdio.h>
$NGX_INCLUDE_SYS_FILIO_H"
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="int i = FIONREAD; printf(\"%d\", i)"
. auto/feature
ngx_feature="struct tm.tm_gmtoff"
ngx_feature_name="NGX_HAVE_GMTOFF"
ngx_feature_run=no
@ -966,16 +883,6 @@ ngx_feature_test="sysconf(_SC_NPROCESSORS_ONLN)"
. auto/feature
ngx_feature="sysconf(_SC_LEVEL1_DCACHE_LINESIZE)"
ngx_feature_name="NGX_HAVE_LEVEL1_DCACHE_LINESIZE"
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path=
ngx_feature_libs=
ngx_feature_test="sysconf(_SC_LEVEL1_DCACHE_LINESIZE)"
. auto/feature
ngx_feature="openat(), fstatat()"
ngx_feature_name="NGX_HAVE_OPENAT"
ngx_feature_run=no

View File

@ -1,99 +1,89 @@
types {
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/html html htm shtml;
text/css css;
text/xml xml;
image/gif gif;
image/jpeg jpeg jpg;
application/javascript js;
application/atom+xml atom;
application/rss+xml rss;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
text/mathml mml;
text/plain txt;
text/vnd.sun.j2me.app-descriptor jad;
text/vnd.wap.wml wml;
text/x-component htc;
image/avif avif;
image/png png;
image/svg+xml svg svgz;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/webp webp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/png png;
image/tiff tif tiff;
image/vnd.wap.wbmp wbmp;
image/x-icon ico;
image/x-jng jng;
image/x-ms-bmp bmp;
image/svg+xml svg svgz;
image/webp webp;
font/woff woff;
font/woff2 woff2;
application/font-woff woff;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.wap.wmlc wmlc;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/java-archive jar war ear;
application/json json;
application/mac-binhex40 hqx;
application/msword doc;
application/pdf pdf;
application/postscript ps eps ai;
application/rtf rtf;
application/vnd.apple.mpegurl m3u8;
application/vnd.google-earth.kml+xml kml;
application/vnd.google-earth.kmz kmz;
application/vnd.ms-excel xls;
application/vnd.ms-fontobject eot;
application/vnd.ms-powerpoint ppt;
application/vnd.oasis.opendocument.graphics odg;
application/vnd.oasis.opendocument.presentation odp;
application/vnd.oasis.opendocument.spreadsheet ods;
application/vnd.oasis.opendocument.text odt;
application/vnd.openxmlformats-officedocument.presentationml.presentation
pptx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
xlsx;
application/vnd.openxmlformats-officedocument.wordprocessingml.document
docx;
application/vnd.wap.wmlc wmlc;
application/wasm wasm;
application/x-7z-compressed 7z;
application/x-cocoa cco;
application/x-java-archive-diff jardiff;
application/x-java-jnlp-file jnlp;
application/x-makeself run;
application/x-perl pl pm;
application/x-pilot prc pdb;
application/x-rar-compressed rar;
application/x-redhat-package-manager rpm;
application/x-sea sea;
application/x-shockwave-flash swf;
application/x-stuffit sit;
application/x-tcl tcl tk;
application/x-x509-ca-cert der pem crt;
application/x-xpinstall xpi;
application/xhtml+xml xhtml;
application/xspf+xml xspf;
application/zip zip;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/octet-stream bin exe dll;
application/octet-stream deb;
application/octet-stream dmg;
application/octet-stream iso img;
application/octet-stream msi msp msm;
application/vnd.openxmlformats-officedocument.wordprocessingml.document docx;
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx;
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
audio/midi mid midi kar;
audio/mpeg mp3;
audio/ogg ogg;
audio/x-m4a m4a;
audio/x-realaudio ra;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
video/3gpp 3gpp 3gp;
video/mp2t ts;
video/mp4 mp4;
video/mpeg mpeg mpg;
video/quicktime mov;
video/webm webm;
video/x-flv flv;
video/x-m4v m4v;
video/x-mng mng;
video/x-ms-asf asx asf;
video/x-ms-wmv wmv;
video/x-msvideo avi;
}

View File

@ -10,7 +10,7 @@
# Needs perl 5.6 or later.
# Written by Maxim Dounin, mdounin@mdounin.ru
# Written by Maxim Dounin, mdounin@rambler-co.ru
###############################################################################
@ -33,10 +33,7 @@ while (<>) {
# Produce UTF-8 sequence from character code;
my $un_utf8 = join('',
map { sprintf("%02X", $_) }
unpack("U0C*", pack("U", hex($un_code)))
);
my $un_utf8 = join('', map { sprintf("%02X", $_) } unpack("C*", pack("U", hex($un_code))));
print " $cs_code $un_utf8 ; $un_name\n";

View File

@ -1 +0,0 @@
setlocal commentstring=#\ %s

File diff suppressed because it is too large Load Diff

View File

@ -3,9 +3,11 @@
<head>
<title>Error</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>
@ -13,7 +15,7 @@ font-family: Tahoma, Verdana, Arial, sans-serif; }
<p>Sorry, the page you are looking for is currently unavailable.<br/>
Please try again later.</p>
<p>If you are the system administrator of this resource then you should check
the error log for details.</p>
the <a href="http://nginx.org/r/error_log">error log</a> for details.</p>
<p><em>Faithfully yours, nginx.</em></p>
</body>
</html>

View File

@ -3,9 +3,11 @@
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
}
</style>
</head>
<body>

View File

@ -1,5 +1,5 @@
.\"
.\" Copyright (C) 2010, 2019 Sergey A. Osokin
.\" Copyright (C) 2010 Sergey A. Osokin
.\" Copyright (C) Nginx, Inc.
.\" All rights reserved.
.\"
@ -25,7 +25,7 @@
.\" SUCH DAMAGE.
.\"
.\"
.Dd November 5, 2020
.Dd June 16, 2015
.Dt NGINX 8
.Os
.Sh NAME
@ -35,7 +35,6 @@
.Nm
.Op Fl ?hqTtVv
.Op Fl c Ar file
.Op Fl e Ar file
.Op Fl g Ar directives
.Op Fl p Ar prefix
.Op Fl s Ar signal
@ -43,8 +42,7 @@
.Nm
(pronounced
.Dq engine x )
is an HTTP and reverse proxy server, a mail proxy server, and a generic
TCP/UDP proxy server.
is an HTTP and reverse proxy server, as well as a mail proxy server.
It is known for its high performance, stability, rich feature set, simple
configuration, and low resource consumption.
.Pp
@ -55,12 +53,6 @@ Print help.
.It Fl c Ar file
Use an alternative configuration
.Ar file .
.It Fl e Ar file
Use an alternative error log
.Ar file .
Special value
.Cm stderr
indicates that the standard error output should be used.
.It Fl g Ar directives
Set global configuration directives.
See
@ -90,15 +82,15 @@ The following table shows the corresponding system signals:
.It Cm reload
.Dv SIGHUP
.El
.It Fl T
Same as
.Fl t ,
but additionally dump configuration files to standard output.
.It Fl t
Do not run, just test the configuration file.
.Nm
checks the configuration file syntax and then tries to open files
referenced in the configuration file.
.It Fl T
Same as
.Fl t ,
but additionally dump configuration files to standard output.
.It Fl V
Print the
.Nm
@ -205,10 +197,10 @@ Development of
started in 2002, with the first public release on October 4, 2004.
.Sh AUTHORS
.An -nosplit
.An Igor Sysoev Aq Mt igor@sysoev.ru .
.An Igor Sysoev Aq igor@sysoev.ru .
.Pp
This manual page was originally written by
.An Sergey A. Osokin Aq Mt osa@FreeBSD.org.ru
.An Sergey A. Osokin Aq osa@FreeBSD.org.ru
as a result of compiling many
.Nm
documents from all over the world.

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2002-2021 Igor Sysoev
* Copyright (C) 2011-2022 Nginx, Inc.
* Copyright (C) 2002-2016 Igor Sysoev
* Copyright (C) 2011-2016 Nginx, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without

File diff suppressed because it is too large Load Diff

View File

@ -25,19 +25,13 @@ X:template = "changes" {
' '),
1, $conf/changes[@lang=$lang]/length)}
X:if "$lang='ru'" {
!{substring(@date, 9, 2)}
X:text {.}
!{substring(@date, 6, 2)}
X:text {.}
!{substring(@date, 1, 4)}
}
X:if "$lang='ru'" { !{@date} }
X:if "$lang='en'" {
!{substring(@date, 9, 2)}
!{substring(@date, 1, 2)}
!{$conf/changes[@lang=$lang]/month[number(substring(current()/@date,
6, 2))]}
!{substring(@date, 1, 4)}
4, 2))]}
!{substring(@date, 7, 4)}
}
X:text {&#10;}

View File

@ -26,19 +26,13 @@
' '),
1, $conf/changes[@lang=$lang]/length)"/>
<xsl:if test="$lang='ru'">
<xsl:value-of select="substring(@date, 9, 2)"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="substring(@date, 6, 2)"/>
<xsl:text>.</xsl:text>
<xsl:value-of select="substring(@date, 1, 4)"/>
</xsl:if>
<xsl:if test="$lang='ru'"> <xsl:value-of select="@date"/> </xsl:if>
<xsl:if test="$lang='en'">
<xsl:value-of select="substring(@date, 9, 2)"/>
<xsl:value-of select="substring(@date, 1, 2)"/>
<xsl:value-of select="$conf/changes[@lang=$lang]/month[number(substring(current()/@date,
6, 2))]"/>
<xsl:value-of select="substring(@date, 1, 4)"/>
4, 2))]"/>
<xsl:value-of select="substring(@date, 7, 4)"/>
</xsl:if>
<xsl:text>&#10;</xsl:text>

View File

@ -4,17 +4,22 @@ VER = $(shell grep 'define NGINX_VERSION' src/core/nginx.h \
NGINX = nginx-$(VER)
TEMP = tmp
CC = cl
OBJS = objs.msvc8
OPENSSL = openssl-1.1.1t
ZLIB = zlib-1.2.13
PCRE = pcre2-10.39
OPENSSL = openssl-1.0.2k
ZLIB = zlib-1.2.11
PCRE = pcre-8.40
release: export
mv $(TEMP)/$(NGINX)/auto/configure $(TEMP)/$(NGINX)
# delete incomplete sources
rm $(TEMP)/$(NGINX)/src/event/ngx_event_acceptex.c
rm $(TEMP)/$(NGINX)/src/event/ngx_event_connectex.c
rm $(TEMP)/$(NGINX)/src/event/modules/ngx_iocp_module.*
rm -r $(TEMP)/$(NGINX)/src/os/win32
mv $(TEMP)/$(NGINX)/docs/text/LICENSE $(TEMP)/$(NGINX)
mv $(TEMP)/$(NGINX)/docs/text/README $(TEMP)/$(NGINX)
mv $(TEMP)/$(NGINX)/docs/html $(TEMP)/$(NGINX)
@ -42,7 +47,7 @@ RELEASE:
win32:
./auto/configure \
--with-cc=$(CC) \
--with-cc=cl \
--builddir=$(OBJS) \
--with-debug \
--prefix= \
@ -59,7 +64,7 @@ win32:
--with-cc-opt=-DFD_SETSIZE=1024 \
--with-pcre=$(OBJS)/lib/$(PCRE) \
--with-zlib=$(OBJS)/lib/$(ZLIB) \
--with-http_v2_module \
--with-select_module \
--with-http_realip_module \
--with-http_addition_module \
--with-http_sub_module \
@ -76,10 +81,11 @@ win32:
--with-mail \
--with-stream \
--with-openssl=$(OBJS)/lib/$(OPENSSL) \
--with-openssl-opt="no-asm no-tests -D_WIN32_WINNT=0x0501" \
--with-openssl-opt=no-asm \
--with-http_ssl_module \
--with-mail_ssl_module \
--with-stream_ssl_module
--with-stream_ssl_module \
--with-ipv6
zip: export

View File

@ -12,7 +12,6 @@
static void ngx_show_version_info(void);
static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle);
static void ngx_cleanup_environment(void *data);
static ngx_int_t ngx_get_options(int argc, char *const *argv);
static ngx_int_t ngx_process_options(ngx_cycle_t *cycle);
static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv);
@ -124,13 +123,6 @@ static ngx_command_t ngx_core_commands[] = {
offsetof(ngx_core_conf_t, rlimit_core),
NULL },
{ ngx_string("worker_shutdown_timeout"),
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
ngx_conf_set_msec_slot,
0,
offsetof(ngx_core_conf_t, shutdown_timeout),
NULL },
{ ngx_string("working_directory"),
NGX_MAIN_CONF|NGX_DIRECT_CONF|NGX_CONF_TAKE1,
ngx_conf_set_str_slot,
@ -183,7 +175,6 @@ static ngx_uint_t ngx_show_help;
static ngx_uint_t ngx_show_version;
static ngx_uint_t ngx_show_configure;
static u_char *ngx_prefix;
static u_char *ngx_error_log;
static u_char *ngx_conf_file;
static u_char *ngx_conf_params;
static char *ngx_signal;
@ -229,9 +220,8 @@ main(int argc, char *const *argv)
#endif
ngx_pid = ngx_getpid();
ngx_parent = ngx_getppid();
log = ngx_log_init(ngx_prefix, ngx_error_log);
log = ngx_log_init(ngx_prefix);
if (log == NULL) {
return 1;
}
@ -275,12 +265,6 @@ main(int argc, char *const *argv)
return 1;
}
/*
* ngx_slab_sizes_init() requires ngx_pagesize set in ngx_os_init()
*/
ngx_slab_sizes_init();
if (ngx_add_inherited_sockets(&init_cycle) != NGX_OK) {
return 1;
}
@ -394,9 +378,9 @@ ngx_show_version_info(void)
if (ngx_show_help) {
ngx_write_stderr(
"Usage: nginx [-?hvVtTq] [-s signal] [-p prefix]" NGX_LINEFEED
" [-e filename] [-c filename] [-g directives]"
NGX_LINEFEED NGX_LINEFEED
"Usage: nginx [-?hvVtTq] [-s signal] [-c filename] "
"[-p prefix] [-g directives]" NGX_LINEFEED
NGX_LINEFEED
"Options:" NGX_LINEFEED
" -?,-h : this help" NGX_LINEFEED
" -v : show version and exit" NGX_LINEFEED
@ -414,12 +398,6 @@ ngx_show_version_info(void)
NGX_LINEFEED
#else
" -p prefix : set prefix path (default: NONE)" NGX_LINEFEED
#endif
" -e filename : set error log file (default: "
#ifdef NGX_ERROR_LOG_STDERR
"stderr)" NGX_LINEFEED
#else
NGX_ERROR_LOG_PATH ")" NGX_LINEFEED
#endif
" -c filename : set configuration file (default: " NGX_CONF_PATH
")" NGX_LINEFEED
@ -499,7 +477,6 @@ ngx_add_inherited_sockets(ngx_cycle_t *cycle)
ngx_memzero(ls, sizeof(ngx_listening_t));
ls->fd = (ngx_socket_t) s;
ls->inherited = 1;
}
}
@ -518,11 +495,10 @@ ngx_add_inherited_sockets(ngx_cycle_t *cycle)
char **
ngx_set_environment(ngx_cycle_t *cycle, ngx_uint_t *last)
{
char **p, **env;
ngx_str_t *var;
ngx_uint_t i, n;
ngx_core_conf_t *ccf;
ngx_pool_cleanup_t *cln;
char **p, **env;
ngx_str_t *var;
ngx_uint_t i, n;
ngx_core_conf_t *ccf;
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
@ -574,25 +550,14 @@ tz_found:
if (last) {
env = ngx_alloc((*last + n + 1) * sizeof(char *), cycle->log);
if (env == NULL) {
return NULL;
}
*last = n;
} else {
cln = ngx_pool_cleanup_add(cycle->pool, 0);
if (cln == NULL) {
return NULL;
}
env = ngx_palloc(cycle->pool, (n + 1) * sizeof(char *));
}
env = ngx_alloc((n + 1) * sizeof(char *), cycle->log);
if (env == NULL) {
return NULL;
}
cln->handler = ngx_cleanup_environment;
cln->data = env;
if (env == NULL) {
return NULL;
}
n = 0;
@ -626,25 +591,6 @@ tz_found:
}
static void
ngx_cleanup_environment(void *data)
{
char **env = data;
if (environ == env) {
/*
* if the environment is still used, as it happens on exit,
* the only option is to leak it
*/
return;
}
ngx_free(env);
}
ngx_pid_t
ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
{
@ -680,9 +626,6 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
if (ls[i].ignore) {
continue;
}
p = ngx_sprintf(p, "%ud;", ls[i].fd);
}
@ -810,24 +753,6 @@ ngx_get_options(int argc, char *const *argv)
ngx_log_stderr(0, "option \"-p\" requires directory name");
return NGX_ERROR;
case 'e':
if (*p) {
ngx_error_log = p;
} else if (argv[++i]) {
ngx_error_log = (u_char *) argv[i];
} else {
ngx_log_stderr(0, "option \"-e\" requires file name");
return NGX_ERROR;
}
if (ngx_strcmp(ngx_error_log, "stderr") == 0) {
ngx_error_log = (u_char *) "";
}
goto next;
case 'c':
if (*p) {
ngx_conf_file = p;
@ -1014,20 +939,12 @@ ngx_process_options(ngx_cycle_t *cycle)
p--)
{
if (ngx_path_separator(*p)) {
cycle->conf_prefix.len = p - cycle->conf_file.data + 1;
cycle->conf_prefix.data = cycle->conf_file.data;
cycle->conf_prefix.len = p - ngx_cycle->conf_file.data + 1;
cycle->conf_prefix.data = ngx_cycle->conf_file.data;
break;
}
}
if (ngx_error_log) {
cycle->error_log.len = ngx_strlen(ngx_error_log);
cycle->error_log.data = ngx_error_log;
} else {
ngx_str_set(&cycle->error_log, NGX_ERROR_LOG_PATH);
}
if (ngx_conf_params) {
cycle->conf_param.len = ngx_strlen(ngx_conf_params);
cycle->conf_param.data = ngx_conf_params;
@ -1065,7 +982,6 @@ ngx_core_module_create_conf(ngx_cycle_t *cycle)
ccf->daemon = NGX_CONF_UNSET;
ccf->master = NGX_CONF_UNSET;
ccf->timer_resolution = NGX_CONF_UNSET_MSEC;
ccf->shutdown_timeout = NGX_CONF_UNSET_MSEC;
ccf->worker_processes = NGX_CONF_UNSET;
ccf->debug_points = NGX_CONF_UNSET;
@ -1094,7 +1010,6 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
ngx_conf_init_value(ccf->daemon, 1);
ngx_conf_init_value(ccf->master, 1);
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
ngx_conf_init_msec_value(ccf->shutdown_timeout, 0);
ngx_conf_init_value(ccf->worker_processes, 1);
ngx_conf_init_value(ccf->debug_points, 0);

View File

@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
#define nginx_version 1023004
#define NGINX_VERSION "1.23.4"
#define nginx_version 1010003
#define NGINX_VERSION "1.10.3"
#define NGINX_VER "nginx/" NGINX_VERSION
#ifdef NGX_BUILD

View File

@ -1,143 +0,0 @@
/*
* Copyright (C) Nginx, Inc.
*/
#include <ngx_config.h>
#include <ngx_core.h>
#define NGX_BPF_LOGBUF_SIZE (16 * 1024)
static ngx_inline int
ngx_bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size)
{
return syscall(__NR_bpf, cmd, attr, size);
}
void
ngx_bpf_program_link(ngx_bpf_program_t *program, const char *symbol, int fd)
{
ngx_uint_t i;
ngx_bpf_reloc_t *rl;
rl = program->relocs;
for (i = 0; i < program->nrelocs; i++) {
if (ngx_strcmp(rl[i].name, symbol) == 0) {
program->ins[rl[i].offset].src_reg = 1;
program->ins[rl[i].offset].imm = fd;
}
}
}
int
ngx_bpf_load_program(ngx_log_t *log, ngx_bpf_program_t *program)
{
int fd;
union bpf_attr attr;
#if (NGX_DEBUG)
char buf[NGX_BPF_LOGBUF_SIZE];
#endif
ngx_memzero(&attr, sizeof(union bpf_attr));
attr.license = (uintptr_t) program->license;
attr.prog_type = program->type;
attr.insns = (uintptr_t) program->ins;
attr.insn_cnt = program->nins;
#if (NGX_DEBUG)
/* for verifier errors */
attr.log_buf = (uintptr_t) buf;
attr.log_size = NGX_BPF_LOGBUF_SIZE;
attr.log_level = 1;
#endif
fd = ngx_bpf(BPF_PROG_LOAD, &attr, sizeof(attr));
if (fd < 0) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
"failed to load BPF program");
ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0,
"bpf verifier: %s", buf);
return -1;
}
return fd;
}
int
ngx_bpf_map_create(ngx_log_t *log, enum bpf_map_type type, int key_size,
int value_size, int max_entries, uint32_t map_flags)
{
int fd;
union bpf_attr attr;
ngx_memzero(&attr, sizeof(union bpf_attr));
attr.map_type = type;
attr.key_size = key_size;
attr.value_size = value_size;
attr.max_entries = max_entries;
attr.map_flags = map_flags;
fd = ngx_bpf(BPF_MAP_CREATE, &attr, sizeof(attr));
if (fd < 0) {
ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
"failed to create BPF map");
return NGX_ERROR;
}
return fd;
}
int
ngx_bpf_map_update(int fd, const void *key, const void *value, uint64_t flags)
{
union bpf_attr attr;
ngx_memzero(&attr, sizeof(union bpf_attr));
attr.map_fd = fd;
attr.key = (uintptr_t) key;
attr.value = (uintptr_t) value;
attr.flags = flags;
return ngx_bpf(BPF_MAP_UPDATE_ELEM, &attr, sizeof(attr));
}
int
ngx_bpf_map_delete(int fd, const void *key)
{
union bpf_attr attr;
ngx_memzero(&attr, sizeof(union bpf_attr));
attr.map_fd = fd;
attr.key = (uintptr_t) key;
return ngx_bpf(BPF_MAP_DELETE_ELEM, &attr, sizeof(attr));
}
int
ngx_bpf_map_lookup(int fd, const void *key, void *value)
{
union bpf_attr attr;
ngx_memzero(&attr, sizeof(union bpf_attr));
attr.map_fd = fd;
attr.key = (uintptr_t) key;
attr.value = (uintptr_t) value;
return ngx_bpf(BPF_MAP_LOOKUP_ELEM, &attr, sizeof(attr));
}

View File

@ -1,43 +0,0 @@
/*
* Copyright (C) Nginx, Inc.
*/
#ifndef _NGX_BPF_H_INCLUDED_
#define _NGX_BPF_H_INCLUDED_
#include <ngx_config.h>
#include <ngx_core.h>
#include <linux/bpf.h>
typedef struct {
char *name;
int offset;
} ngx_bpf_reloc_t;
typedef struct {
char *license;
enum bpf_prog_type type;
struct bpf_insn *ins;
size_t nins;
ngx_bpf_reloc_t *relocs;
size_t nrelocs;
} ngx_bpf_program_t;
void ngx_bpf_program_link(ngx_bpf_program_t *program, const char *symbol,
int fd);
int ngx_bpf_load_program(ngx_log_t *log, ngx_bpf_program_t *program);
int ngx_bpf_map_create(ngx_log_t *log, enum bpf_map_type type, int key_size,
int value_size, int max_entries, uint32_t map_flags);
int ngx_bpf_map_update(int fd, const void *key, const void *value,
uint64_t flags);
int ngx_bpf_map_delete(int fd, const void *key);
int ngx_bpf_map_lookup(int fd, const void *key, void *value);
#endif /* _NGX_BPF_H_INCLUDED_ */

View File

@ -137,7 +137,6 @@ ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in)
while (in) {
cl = ngx_alloc_chain_link(pool);
if (cl == NULL) {
*ll = NULL;
return NGX_ERROR;
}
@ -187,32 +186,30 @@ ngx_chain_update_chains(ngx_pool_t *p, ngx_chain_t **free, ngx_chain_t **busy,
{
ngx_chain_t *cl;
if (*out) {
if (*busy == NULL) {
*busy = *out;
if (*busy == NULL) {
*busy = *out;
} else {
for (cl = *busy; cl->next; cl = cl->next) { /* void */ }
} else {
for (cl = *busy; cl->next; cl = cl->next) { /* void */ }
cl->next = *out;
}
*out = NULL;
cl->next = *out;
}
*out = NULL;
while (*busy) {
cl = *busy;
if (ngx_buf_size(cl->buf) != 0) {
break;
}
if (cl->buf->tag != tag) {
*busy = cl->next;
ngx_free_chain(p, cl);
continue;
}
if (ngx_buf_size(cl->buf) != 0) {
break;
}
cl->buf->pos = cl->buf->start;
cl->buf->last = cl->buf->start;

View File

@ -72,8 +72,10 @@ typedef struct ngx_output_chain_ctx_s ngx_output_chain_ctx_t;
typedef ngx_int_t (*ngx_output_chain_filter_pt)(void *ctx, ngx_chain_t *in);
#if (NGX_HAVE_FILE_AIO)
typedef void (*ngx_output_chain_aio_pt)(ngx_output_chain_ctx_t *ctx,
ngx_file_t *file);
#endif
struct ngx_output_chain_ctx_s {
ngx_buf_t *buf;
@ -83,16 +85,23 @@ struct ngx_output_chain_ctx_s {
unsigned sendfile:1;
unsigned directio:1;
#if (NGX_HAVE_ALIGNED_DIRECTIO)
unsigned unaligned:1;
#endif
unsigned need_in_memory:1;
unsigned need_in_temp:1;
#if (NGX_HAVE_FILE_AIO || NGX_THREADS)
unsigned aio:1;
#if (NGX_HAVE_FILE_AIO || NGX_COMPAT)
ngx_output_chain_aio_pt aio_handler;
#endif
#if (NGX_THREADS || NGX_COMPAT)
#if (NGX_HAVE_FILE_AIO)
ngx_output_chain_aio_pt aio_handler;
#if (NGX_HAVE_AIO_SENDFILE)
ssize_t (*aio_preload)(ngx_buf_t *file);
#endif
#endif
#if (NGX_THREADS)
ngx_int_t (*thread_handler)(ngx_thread_task_t *task,
ngx_file_t *file);
ngx_thread_task_t *thread_task;
@ -122,20 +131,20 @@ typedef struct {
#define NGX_CHAIN_ERROR (ngx_chain_t *) NGX_ERROR
#define ngx_buf_in_memory(b) ((b)->temporary || (b)->memory || (b)->mmap)
#define ngx_buf_in_memory_only(b) (ngx_buf_in_memory(b) && !(b)->in_file)
#define ngx_buf_in_memory(b) (b->temporary || b->memory || b->mmap)
#define ngx_buf_in_memory_only(b) (ngx_buf_in_memory(b) && !b->in_file)
#define ngx_buf_special(b) \
(((b)->flush || (b)->last_buf || (b)->sync) \
&& !ngx_buf_in_memory(b) && !(b)->in_file)
((b->flush || b->last_buf || b->sync) \
&& !ngx_buf_in_memory(b) && !b->in_file)
#define ngx_buf_sync_only(b) \
((b)->sync && !ngx_buf_in_memory(b) \
&& !(b)->in_file && !(b)->flush && !(b)->last_buf)
(b->sync \
&& !ngx_buf_in_memory(b) && !b->in_file && !b->flush && !b->last_buf)
#define ngx_buf_size(b) \
(ngx_buf_in_memory(b) ? (off_t) ((b)->last - (b)->pos): \
((b)->file_last - (b)->file_pos))
(ngx_buf_in_memory(b) ? (off_t) (b->last - b->pos): \
(b->file_last - b->file_pos))
ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size);
ngx_chain_t *ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs);
@ -146,8 +155,8 @@ ngx_chain_t *ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs);
ngx_chain_t *ngx_alloc_chain_link(ngx_pool_t *pool);
#define ngx_free_chain(pool, cl) \
(cl)->next = (pool)->chain; \
(pool)->chain = (cl)
cl->next = pool->chain; \
pool->chain = cl

View File

@ -10,7 +10,6 @@
#define NGX_CONF_BUFFER 4096
static ngx_int_t ngx_conf_add_dump(ngx_conf_t *cf, ngx_str_t *filename);
static ngx_int_t ngx_conf_handler(ngx_conf_t *cf, ngx_int_t last);
static ngx_int_t ngx_conf_read_token(ngx_conf_t *cf);
static void ngx_conf_flush_files(ngx_cycle_t *cycle);
@ -98,70 +97,17 @@ ngx_conf_param(ngx_conf_t *cf)
}
static ngx_int_t
ngx_conf_add_dump(ngx_conf_t *cf, ngx_str_t *filename)
{
off_t size;
u_char *p;
uint32_t hash;
ngx_buf_t *buf;
ngx_str_node_t *sn;
ngx_conf_dump_t *cd;
hash = ngx_crc32_long(filename->data, filename->len);
sn = ngx_str_rbtree_lookup(&cf->cycle->config_dump_rbtree, filename, hash);
if (sn) {
cf->conf_file->dump = NULL;
return NGX_OK;
}
p = ngx_pstrdup(cf->cycle->pool, filename);
if (p == NULL) {
return NGX_ERROR;
}
cd = ngx_array_push(&cf->cycle->config_dump);
if (cd == NULL) {
return NGX_ERROR;
}
size = ngx_file_size(&cf->conf_file->file.info);
buf = ngx_create_temp_buf(cf->cycle->pool, (size_t) size);
if (buf == NULL) {
return NGX_ERROR;
}
cd->name.data = p;
cd->name.len = filename->len;
cd->buffer = buf;
cf->conf_file->dump = buf;
sn = ngx_palloc(cf->temp_pool, sizeof(ngx_str_node_t));
if (sn == NULL) {
return NGX_ERROR;
}
sn->node.key = hash;
sn->str = cd->name;
ngx_rbtree_insert(&cf->cycle->config_dump_rbtree, &sn->node);
return NGX_OK;
}
char *
ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
{
char *rv;
u_char *p;
off_t size;
ngx_fd_t fd;
ngx_int_t rc;
ngx_buf_t buf;
ngx_buf_t buf, *tbuf;
ngx_conf_file_t *prev, conf_file;
ngx_conf_dump_t *cd;
enum {
parse_file = 0,
parse_block,
@ -178,7 +124,6 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
/* open configuration file */
fd = ngx_open_file(filename->data, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
if (fd == NGX_INVALID_FILE) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
ngx_open_file_n " \"%s\" failed",
@ -222,10 +167,29 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
#endif
)
{
if (ngx_conf_add_dump(cf, filename) != NGX_OK) {
p = ngx_pstrdup(cf->cycle->pool, filename);
if (p == NULL) {
goto failed;
}
size = ngx_file_size(&cf->conf_file->file.info);
tbuf = ngx_create_temp_buf(cf->cycle->pool, (size_t) size);
if (tbuf == NULL) {
goto failed;
}
cd = ngx_array_push(&cf->cycle->config_dump);
if (cd == NULL) {
goto failed;
}
cd->name.len = filename->len;
cd->name.data = p;
cd->buffer = tbuf;
cf->conf_file->dump = tbuf;
} else {
cf->conf_file->dump = NULL;
}
@ -310,7 +274,7 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
goto failed;
}
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%s", rv);
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, rv);
goto failed;
}
@ -544,8 +508,8 @@ ngx_conf_read_token(ngx_conf_t *cf)
}
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"unexpected end of file, "
"expecting \";\" or \"}\"");
"unexpected end of file, "
"expecting \";\" or \"}\"");
return NGX_ERROR;
}
@ -656,14 +620,13 @@ ngx_conf_read_token(ngx_conf_t *cf)
}
if (last_space) {
start = b->pos - 1;
start_line = cf->conf_file->line;
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
continue;
}
start = b->pos - 1;
start_line = cf->conf_file->line;
switch (ch) {
case ';':
@ -710,11 +673,6 @@ ngx_conf_read_token(ngx_conf_t *cf)
last_space = 0;
continue;
case '$':
variable = 1;
last_space = 0;
continue;
default:
last_space = 0;
}
@ -1137,7 +1095,7 @@ ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
a = (ngx_array_t **) (p + cmd->offset);
if (*a == NGX_CONF_UNSET_PTR || *a == NULL) {
if (*a == NULL) {
*a = ngx_array_create(cf->pool, 4, sizeof(ngx_keyval_t));
if (*a == NULL) {
return NGX_CONF_ERROR;
@ -1378,7 +1336,7 @@ ngx_conf_set_enum_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
return NGX_CONF_OK;
}
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"invalid value \"%s\"", value[1].data);
return NGX_CONF_ERROR;
@ -1420,7 +1378,7 @@ ngx_conf_set_bitmask_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
}
if (mask[m].name.len == 0) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
ngx_conf_log_error(NGX_LOG_WARN, cf, 0,
"invalid value \"%s\"", value[i].data);
return NGX_CONF_ERROR;

View File

@ -45,11 +45,12 @@
#define NGX_CONF_ANY 0x00000400
#define NGX_CONF_1MORE 0x00000800
#define NGX_CONF_2MORE 0x00001000
#define NGX_CONF_MULTI 0x00000000 /* compatibility */
#define NGX_DIRECT_CONF 0x00010000
#define NGX_MAIN_CONF 0x01000000
#define NGX_ANY_CONF 0xFF000000
#define NGX_ANY_CONF 0x1F000000
@ -128,7 +129,7 @@ struct ngx_conf_s {
ngx_uint_t cmd_type;
ngx_conf_handler_pt handler;
void *handler_conf;
char *handler_conf;
};

View File

@ -129,17 +129,4 @@ typedef intptr_t ngx_flag_t;
#define NGX_MAX_INT32_VALUE (uint32_t) 0x7fffffff
#if (NGX_COMPAT)
#define NGX_COMPAT_BEGIN(slots) uint64_t spare[slots];
#define NGX_COMPAT_END
#else
#define NGX_COMPAT_BEGIN(slots)
#define NGX_COMPAT_END
#endif
#endif /* _NGX_CONFIG_H_INCLUDED_ */

View File

@ -13,12 +13,11 @@
ngx_os_io_t ngx_io;
static void ngx_drain_connections(ngx_cycle_t *cycle);
static void ngx_drain_connections(void);
ngx_listening_t *
ngx_create_listening(ngx_conf_t *cf, struct sockaddr *sockaddr,
socklen_t socklen)
ngx_create_listening(ngx_conf_t *cf, void *sockaddr, socklen_t socklen)
{
size_t len;
ngx_listening_t *ls;
@ -92,7 +91,7 @@ ngx_create_listening(ngx_conf_t *cf, struct sockaddr *sockaddr,
ngx_int_t
ngx_clone_listening(ngx_cycle_t *cycle, ngx_listening_t *ls)
ngx_clone_listening(ngx_conf_t *cf, ngx_listening_t *ls)
{
#if (NGX_HAVE_REUSEPORT)
@ -100,19 +99,20 @@ ngx_clone_listening(ngx_cycle_t *cycle, ngx_listening_t *ls)
ngx_core_conf_t *ccf;
ngx_listening_t ols;
if (!ls->reuseport || ls->worker != 0) {
if (!ls->reuseport) {
return NGX_OK;
}
ols = *ls;
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
ccf = (ngx_core_conf_t *) ngx_get_conf(cf->cycle->conf_ctx,
ngx_core_module);
for (n = 1; n < ccf->worker_processes; n++) {
/* create a socket for each worker process */
ls = ngx_array_push(&cycle->listening);
ls = ngx_array_push(&cf->cycle->listening);
if (ls == NULL) {
return NGX_ERROR;
}
@ -150,12 +150,12 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
ls[i].sockaddr = ngx_palloc(cycle->pool, sizeof(ngx_sockaddr_t));
ls[i].sockaddr = ngx_palloc(cycle->pool, NGX_SOCKADDRLEN);
if (ls[i].sockaddr == NULL) {
return NGX_ERROR;
}
ls[i].socklen = sizeof(ngx_sockaddr_t);
ls[i].socklen = NGX_SOCKADDRLEN;
if (getsockname(ls[i].fd, ls[i].sockaddr, &ls[i].socklen) == -1) {
ngx_log_error(NGX_LOG_CRIT, cycle->log, ngx_socket_errno,
"getsockname() of the inherited "
@ -164,10 +164,6 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
continue;
}
if (ls[i].socklen > (socklen_t) sizeof(ngx_sockaddr_t)) {
ls[i].socklen = sizeof(ngx_sockaddr_t);
}
switch (ls[i].sockaddr->sa_family) {
#if (NGX_HAVE_INET6)
@ -276,22 +272,6 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
reuseport = 0;
olen = sizeof(int);
#ifdef SO_REUSEPORT_LB
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT_LB,
(void *) &reuseport, &olen)
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"getsockopt(SO_REUSEPORT_LB) %V failed, ignored",
&ls[i].addr_text);
} else {
ls[i].reuseport = reuseport ? 1 : 0;
}
#else
if (getsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
(void *) &reuseport, &olen)
== -1)
@ -303,7 +283,6 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
} else {
ls[i].reuseport = reuseport ? 1 : 0;
}
#endif
#endif
@ -321,9 +300,7 @@ ngx_set_inherited_sockets(ngx_cycle_t *cycle)
{
err = ngx_socket_errno;
if (err != NGX_EOPNOTSUPP && err != NGX_ENOPROTOOPT
&& err != NGX_EINVAL)
{
if (err != NGX_EOPNOTSUPP && err != NGX_ENOPROTOOPT) {
ngx_log_error(NGX_LOG_NOTICE, cycle->log, err,
"getsockopt(TCP_FASTOPEN) %V failed, ignored",
&ls[i].addr_text);
@ -442,20 +419,6 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
int reuseport = 1;
#ifdef SO_REUSEPORT_LB
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT_LB,
(const void *) &reuseport, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_socket_errno,
"setsockopt(SO_REUSEPORT_LB) %V failed, "
"ignored",
&ls[i].addr_text);
}
#else
if (setsockopt(ls[i].fd, SOL_SOCKET, SO_REUSEPORT,
(const void *) &reuseport, sizeof(int))
== -1)
@ -464,7 +427,6 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
"setsockopt(SO_REUSEPORT) %V failed, ignored",
&ls[i].addr_text);
}
#endif
ls[i].add_reuseport = 0;
}
@ -491,60 +453,36 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
return NGX_ERROR;
}
if (ls[i].type != SOCK_DGRAM || !ngx_test_config) {
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
(const void *) &reuseaddr, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
"setsockopt(SO_REUSEADDR) %V failed",
&ls[i].addr_text);
if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
(const void *) &reuseaddr, sizeof(int))
== -1)
{
if (ngx_close_socket(s) == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
"setsockopt(SO_REUSEADDR) %V failed",
ngx_close_socket_n " %V failed",
&ls[i].addr_text);
if (ngx_close_socket(s) == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
ngx_close_socket_n " %V failed",
&ls[i].addr_text);
}
return NGX_ERROR;
}
return NGX_ERROR;
}
#if (NGX_HAVE_REUSEPORT)
if (ls[i].reuseport && !ngx_test_config) {
if (ls[i].reuseport) {
int reuseport;
reuseport = 1;
#ifdef SO_REUSEPORT_LB
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT_LB,
(const void *) &reuseport, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
"setsockopt(SO_REUSEPORT_LB) %V failed",
&ls[i].addr_text);
if (ngx_close_socket(s) == -1) {
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
ngx_close_socket_n " %V failed",
&ls[i].addr_text);
}
return NGX_ERROR;
}
#else
if (setsockopt(s, SOL_SOCKET, SO_REUSEPORT,
(const void *) &reuseport, sizeof(int))
== -1)
{
ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
"setsockopt(SO_REUSEPORT) %V failed",
"setsockopt(SO_REUSEPORT) %V failed, ignored",
&ls[i].addr_text);
if (ngx_close_socket(s) == -1) {
@ -555,7 +493,6 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
return NGX_ERROR;
}
#endif
}
#endif
@ -656,7 +593,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
/*
* on OpenVZ after suspend/resume EADDRINUSE
* may be returned by listen() instead of bind(), see
* https://bugs.openvz.org/browse/OVZ-5587
* https://bugzilla.openvz.org/show_bug.cgi?id=2470
*/
if (err != NGX_EADDRINUSE || !ngx_test_config) {
@ -1033,12 +970,6 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
ls = cycle->listening.elts;
for (i = 0; i < cycle->listening.nelts; i++) {
#if (NGX_QUIC)
if (ls[i].quic) {
continue;
}
#endif
c = ls[i].connection;
if (c) {
@ -1075,8 +1006,7 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
if (ls[i].sockaddr->sa_family == AF_UNIX
&& ngx_process <= NGX_PROCESS_MASTER
&& ngx_new_binary == 0
&& (!ls[i].inherited || ngx_getppid() != ngx_parent))
&& ngx_new_binary == 0)
{
u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1;
@ -1112,10 +1042,13 @@ ngx_get_connection(ngx_socket_t s, ngx_log_t *log)
return NULL;
}
ngx_drain_connections((ngx_cycle_t *) ngx_cycle);
c = ngx_cycle->free_connections;
if (c == NULL) {
ngx_drain_connections();
c = ngx_cycle->free_connections;
}
if (c == NULL) {
ngx_log_error(NGX_LOG_ALERT, log, 0,
"%ui worker_connections are not enough",
@ -1257,7 +1190,10 @@ ngx_close_connection(ngx_connection_t *c)
level = NGX_LOG_CRIT;
}
ngx_log_error(level, c->log, err, ngx_close_socket_n " %d failed", fd);
/* we use ngx_cycle->log because c->log was in c->pool */
ngx_log_error(level, ngx_cycle->log, err,
ngx_close_socket_n " %d failed", fd);
}
}
@ -1270,7 +1206,6 @@ ngx_reusable_connection(ngx_connection_t *c, ngx_uint_t reusable)
if (c->reusable) {
ngx_queue_remove(&c->queue);
ngx_cycle->reusable_connections_n--;
#if (NGX_STAT_STUB)
(void) ngx_atomic_fetch_add(ngx_stat_waiting, -1);
@ -1284,7 +1219,6 @@ ngx_reusable_connection(ngx_connection_t *c, ngx_uint_t reusable)
ngx_queue_insert_head(
(ngx_queue_t *) &ngx_cycle->reusable_connections_queue, &c->queue);
ngx_cycle->reusable_connections_n++;
#if (NGX_STAT_STUB)
(void) ngx_atomic_fetch_add(ngx_stat_waiting, 1);
@ -1294,36 +1228,18 @@ ngx_reusable_connection(ngx_connection_t *c, ngx_uint_t reusable)
static void
ngx_drain_connections(ngx_cycle_t *cycle)
ngx_drain_connections(void)
{
ngx_uint_t i, n;
ngx_int_t i;
ngx_queue_t *q;
ngx_connection_t *c;
if (cycle->free_connection_n > cycle->connection_n / 16
|| cycle->reusable_connections_n == 0)
{
return;
}
if (cycle->connections_reuse_time != ngx_time()) {
cycle->connections_reuse_time = ngx_time();
ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
"%ui worker_connections are not enough, "
"reusing connections",
cycle->connection_n);
}
c = NULL;
n = ngx_max(ngx_min(32, cycle->reusable_connections_n / 8), 1);
for (i = 0; i < n; i++) {
if (ngx_queue_empty(&cycle->reusable_connections_queue)) {
for (i = 0; i < 32; i++) {
if (ngx_queue_empty(&ngx_cycle->reusable_connections_queue)) {
break;
}
q = ngx_queue_last(&cycle->reusable_connections_queue);
q = ngx_queue_last(&ngx_cycle->reusable_connections_queue);
c = ngx_queue_data(q, ngx_connection_t, queue);
ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0,
@ -1332,21 +1248,6 @@ ngx_drain_connections(ngx_cycle_t *cycle)
c->close = 1;
c->read->handler(c->read);
}
if (cycle->free_connection_n == 0 && c && c->reusable) {
/*
* if no connections were freed, try to reuse the last
* connection again: this should free it as long as
* previous reuse moved it to lingering close
*/
ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0,
"reusing connection again");
c->close = 1;
c->read->handler(c->read);
}
}
@ -1376,7 +1277,7 @@ ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
{
socklen_t len;
ngx_uint_t addr;
ngx_sockaddr_t sa;
u_char sa[NGX_SOCKADDRLEN];
struct sockaddr_in *sin;
#if (NGX_HAVE_INET6)
ngx_uint_t i;
@ -1414,9 +1315,9 @@ ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
if (addr == 0) {
len = sizeof(ngx_sockaddr_t);
len = NGX_SOCKADDRLEN;
if (getsockname(c->fd, &sa.sockaddr, &len) == -1) {
if (getsockname(c->fd, (struct sockaddr *) &sa, &len) == -1) {
ngx_connection_error(c, ngx_socket_errno, "getsockname() failed");
return NGX_ERROR;
}
@ -1442,49 +1343,6 @@ ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
}
ngx_int_t
ngx_tcp_nodelay(ngx_connection_t *c)
{
int tcp_nodelay;
if (c->tcp_nodelay != NGX_TCP_NODELAY_UNSET) {
return NGX_OK;
}
ngx_log_debug0(NGX_LOG_DEBUG_CORE, c->log, 0, "tcp_nodelay");
tcp_nodelay = 1;
if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY,
(const void *) &tcp_nodelay, sizeof(int))
== -1)
{
#if (NGX_SOLARIS)
if (c->log_error == NGX_ERROR_INFO) {
/* Solaris returns EINVAL if a socket has been shut down */
c->log_error = NGX_ERROR_IGNORE_EINVAL;
ngx_connection_error(c, ngx_socket_errno,
"setsockopt(TCP_NODELAY) failed");
c->log_error = NGX_ERROR_INFO;
return NGX_ERROR;
}
#endif
ngx_connection_error(c, ngx_socket_errno,
"setsockopt(TCP_NODELAY) failed");
return NGX_ERROR;
}
c->tcp_nodelay = NGX_TCP_NODELAY_SET;
return NGX_OK;
}
ngx_int_t
ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text)
{

View File

@ -45,13 +45,12 @@ struct ngx_listening_s {
size_t pool_size;
/* should be here because of the AcceptEx() preread */
size_t post_accept_buffer_size;
/* should be here because of the deferred accept */
ngx_msec_t post_accept_timeout;
ngx_listening_t *previous;
ngx_connection_t *connection;
ngx_rbtree_t rbtree;
ngx_rbtree_node_t sentinel;
ngx_uint_t worker;
unsigned open:1;
@ -67,20 +66,23 @@ struct ngx_listening_s {
unsigned addr_ntop:1;
unsigned wildcard:1;
#if (NGX_HAVE_INET6)
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
unsigned ipv6only:1;
#endif
#if (NGX_HAVE_REUSEPORT)
unsigned reuseport:1;
unsigned add_reuseport:1;
#endif
unsigned keepalive:2;
unsigned quic:1;
#if (NGX_HAVE_DEFERRED_ACCEPT)
unsigned deferred_accept:1;
unsigned delete_deferred:1;
unsigned add_deferred:1;
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
#ifdef SO_ACCEPTFILTER
char *accept_filter;
#endif
#endif
#if (NGX_HAVE_SETFIB)
int setfib;
#endif
@ -146,18 +148,12 @@ struct ngx_connection_s {
socklen_t socklen;
ngx_str_t addr_text;
ngx_proxy_protocol_t *proxy_protocol;
ngx_str_t proxy_protocol_addr;
#if (NGX_QUIC || NGX_COMPAT)
ngx_quic_stream_t *quic;
#endif
#if (NGX_SSL || NGX_COMPAT)
#if (NGX_SSL)
ngx_ssl_connection_t *ssl;
#endif
ngx_udp_connection_t *udp;
struct sockaddr *local_sockaddr;
socklen_t local_socklen;
@ -167,17 +163,16 @@ struct ngx_connection_s {
ngx_atomic_uint_t number;
ngx_msec_t start_time;
ngx_uint_t requests;
unsigned buffered:8;
unsigned log_error:3; /* ngx_connection_log_error_e */
unsigned unexpected_eof:1;
unsigned timedout:1;
unsigned error:1;
unsigned destroyed:1;
unsigned pipeline:1;
unsigned idle:1;
unsigned reusable:1;
@ -190,13 +185,16 @@ struct ngx_connection_s {
unsigned tcp_nopush:2; /* ngx_connection_tcp_nopush_e */
unsigned need_last_buf:1;
unsigned need_flush_buf:1;
#if (NGX_HAVE_SENDFILE_NODISKIO || NGX_COMPAT)
#if (NGX_HAVE_IOCP)
unsigned accept_context_updated:1;
#endif
#if (NGX_HAVE_AIO_SENDFILE)
unsigned busy_count:2;
#endif
#if (NGX_THREADS || NGX_COMPAT)
#if (NGX_THREADS)
ngx_thread_task_t *sendfile_task;
#endif
};
@ -213,9 +211,9 @@ struct ngx_connection_s {
}
ngx_listening_t *ngx_create_listening(ngx_conf_t *cf, struct sockaddr *sockaddr,
ngx_listening_t *ngx_create_listening(ngx_conf_t *cf, void *sockaddr,
socklen_t socklen);
ngx_int_t ngx_clone_listening(ngx_cycle_t *cycle, ngx_listening_t *ls);
ngx_int_t ngx_clone_listening(ngx_conf_t *cf, ngx_listening_t *ls);
ngx_int_t ngx_set_inherited_sockets(ngx_cycle_t *cycle);
ngx_int_t ngx_open_listening_sockets(ngx_cycle_t *cycle);
void ngx_configure_listening_sockets(ngx_cycle_t *cycle);
@ -224,7 +222,6 @@ void ngx_close_connection(ngx_connection_t *c);
void ngx_close_idle_connections(ngx_cycle_t *cycle);
ngx_int_t ngx_connection_local_sockaddr(ngx_connection_t *c, ngx_str_t *s,
ngx_uint_t port);
ngx_int_t ngx_tcp_nodelay(ngx_connection_t *c);
ngx_int_t ngx_connection_error(ngx_connection_t *c, ngx_err_t err, char *text);
ngx_connection_t *ngx_get_connection(ngx_socket_t s, ngx_log_t *log);

View File

@ -12,24 +12,22 @@
#include <ngx_config.h>
typedef struct ngx_module_s ngx_module_t;
typedef struct ngx_conf_s ngx_conf_t;
typedef struct ngx_cycle_s ngx_cycle_t;
typedef struct ngx_pool_s ngx_pool_t;
typedef struct ngx_chain_s ngx_chain_t;
typedef struct ngx_log_s ngx_log_t;
typedef struct ngx_open_file_s ngx_open_file_t;
typedef struct ngx_command_s ngx_command_t;
typedef struct ngx_file_s ngx_file_t;
typedef struct ngx_event_s ngx_event_t;
typedef struct ngx_event_aio_s ngx_event_aio_t;
typedef struct ngx_connection_s ngx_connection_t;
typedef struct ngx_thread_task_s ngx_thread_task_t;
typedef struct ngx_ssl_s ngx_ssl_t;
typedef struct ngx_proxy_protocol_s ngx_proxy_protocol_t;
typedef struct ngx_quic_stream_s ngx_quic_stream_t;
typedef struct ngx_ssl_connection_s ngx_ssl_connection_t;
typedef struct ngx_udp_connection_s ngx_udp_connection_t;
typedef struct ngx_module_s ngx_module_t;
typedef struct ngx_conf_s ngx_conf_t;
typedef struct ngx_cycle_s ngx_cycle_t;
typedef struct ngx_pool_s ngx_pool_t;
typedef struct ngx_chain_s ngx_chain_t;
typedef struct ngx_log_s ngx_log_t;
typedef struct ngx_open_file_s ngx_open_file_t;
typedef struct ngx_command_s ngx_command_t;
typedef struct ngx_file_s ngx_file_t;
typedef struct ngx_event_s ngx_event_t;
typedef struct ngx_event_aio_s ngx_event_aio_t;
typedef struct ngx_connection_s ngx_connection_t;
#if (NGX_THREADS)
typedef struct ngx_thread_task_s ngx_thread_task_t;
#endif
typedef void (*ngx_event_handler_pt)(ngx_event_t *ev);
typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
@ -83,9 +81,6 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
#include <ngx_resolver.h>
#if (NGX_OPENSSL)
#include <ngx_event_openssl.h>
#if (NGX_QUIC)
#include <ngx_event_quic.h>
#endif
#endif
#include <ngx_process_cycle.h>
#include <ngx_conf_file.h>
@ -95,9 +90,6 @@ typedef void (*ngx_connection_handler_pt)(ngx_connection_t *c);
#include <ngx_connection.h>
#include <ngx_syslog.h>
#include <ngx_proxy_protocol.h>
#if (NGX_HAVE_BPF)
#include <ngx_bpf.h>
#endif
#define LF (u_char) '\n'

View File

@ -8,7 +8,9 @@
#include <ngx_core.h>
#include <ngx_crypt.h>
#include <ngx_md5.h>
#if (NGX_HAVE_SHA1)
#include <ngx_sha1.h>
#endif
#if (NGX_CRYPT)
@ -17,11 +19,16 @@ static ngx_int_t ngx_crypt_apr1(ngx_pool_t *pool, u_char *key, u_char *salt,
u_char **encrypted);
static ngx_int_t ngx_crypt_plain(ngx_pool_t *pool, u_char *key, u_char *salt,
u_char **encrypted);
#if (NGX_HAVE_SHA1)
static ngx_int_t ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt,
u_char **encrypted);
static ngx_int_t ngx_crypt_sha(ngx_pool_t *pool, u_char *key, u_char *salt,
u_char **encrypted);
#endif
static u_char *ngx_crypt_to64(u_char *p, uint32_t v, size_t n);
@ -35,11 +42,13 @@ ngx_crypt(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
} else if (ngx_strncmp(salt, "{PLAIN}", sizeof("{PLAIN}") - 1) == 0) {
return ngx_crypt_plain(pool, key, salt, encrypted);
#if (NGX_HAVE_SHA1)
} else if (ngx_strncmp(salt, "{SSHA}", sizeof("{SSHA}") - 1) == 0) {
return ngx_crypt_ssha(pool, key, salt, encrypted);
} else if (ngx_strncmp(salt, "{SHA}", sizeof("{SHA}") - 1) == 0) {
return ngx_crypt_sha(pool, key, salt, encrypted);
#endif
}
/* fallback to libc crypt() */
@ -184,6 +193,8 @@ ngx_crypt_plain(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
}
#if (NGX_HAVE_SHA1)
static ngx_int_t
ngx_crypt_ssha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
{
@ -267,4 +278,6 @@ ngx_crypt_sha(ngx_pool_t *pool, u_char *key, u_char *salt, u_char **encrypted)
return NGX_OK;
}
#endif /* NGX_HAVE_SHA1 */
#endif /* NGX_CRYPT */

View File

@ -15,7 +15,6 @@ static ngx_int_t ngx_init_zone_pool(ngx_cycle_t *cycle,
ngx_shm_zone_t *shm_zone);
static ngx_int_t ngx_test_lockfile(u_char *file, ngx_log_t *log);
static void ngx_clean_old_cycles(ngx_event_t *ev);
static void ngx_shutdown_timer_handler(ngx_event_t *ev);
volatile ngx_cycle_t *ngx_cycle;
@ -23,7 +22,6 @@ ngx_array_t ngx_old_cycles;
static ngx_pool_t *ngx_temp_pool;
static ngx_event_t ngx_cleaner_event;
static ngx_event_t ngx_shutdown_event;
ngx_uint_t ngx_test_config;
ngx_uint_t ngx_dump_config;
@ -39,7 +37,7 @@ ngx_cycle_t *
ngx_init_cycle(ngx_cycle_t *old_cycle)
{
void *rv;
char **senv;
char **senv, **env;
ngx_uint_t i, n;
ngx_log_t *log;
ngx_time_t *tp;
@ -96,15 +94,6 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
return NULL;
}
cycle->error_log.len = old_cycle->error_log.len;
cycle->error_log.data = ngx_pnalloc(pool, old_cycle->error_log.len + 1);
if (cycle->error_log.data == NULL) {
ngx_destroy_pool(pool);
return NULL;
}
ngx_cpystrn(cycle->error_log.data, old_cycle->error_log.data,
old_cycle->error_log.len + 1);
cycle->conf_file.len = old_cycle->conf_file.len;
cycle->conf_file.data = ngx_pnalloc(pool, old_cycle->conf_file.len + 1);
if (cycle->conf_file.data == NULL) {
@ -124,14 +113,16 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
n = old_cycle->paths.nelts ? old_cycle->paths.nelts : 10;
if (ngx_array_init(&cycle->paths, pool, n, sizeof(ngx_path_t *))
!= NGX_OK)
{
cycle->paths.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *));
if (cycle->paths.elts == NULL) {
ngx_destroy_pool(pool);
return NULL;
}
ngx_memzero(cycle->paths.elts, n * sizeof(ngx_path_t *));
cycle->paths.nelts = 0;
cycle->paths.size = sizeof(ngx_path_t *);
cycle->paths.nalloc = n;
cycle->paths.pool = pool;
if (ngx_array_init(&cycle->config_dump, pool, 1, sizeof(ngx_conf_dump_t))
@ -141,9 +132,6 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
return NULL;
}
ngx_rbtree_init(&cycle->config_dump_rbtree, &cycle->config_dump_sentinel,
ngx_str_rbtree_insert_value);
if (old_cycle->open_files.part.nelts) {
n = old_cycle->open_files.part.nelts;
for (part = old_cycle->open_files.part.next; part; part = part->next) {
@ -182,14 +170,16 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
if (ngx_array_init(&cycle->listening, pool, n, sizeof(ngx_listening_t))
!= NGX_OK)
{
cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
if (cycle->listening.elts == NULL) {
ngx_destroy_pool(pool);
return NULL;
}
ngx_memzero(cycle->listening.elts, n * sizeof(ngx_listening_t));
cycle->listening.nelts = 0;
cycle->listening.size = sizeof(ngx_listening_t);
cycle->listening.nalloc = n;
cycle->listening.pool = pool;
ngx_queue_init(&cycle->reusable_connections_queue);
@ -479,6 +469,8 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
goto shm_zone_found;
}
ngx_shm_free(&oshm_zone[n].shm);
break;
}
@ -529,7 +521,6 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
== NGX_OK)
{
nls[n].fd = ls[i].fd;
nls[n].inherited = ls[i].inherited;
nls[n].previous = &ls[i];
ls[i].remain = 1;
@ -670,26 +661,14 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
n = 0;
}
if (oshm_zone[i].shm.name.len != shm_zone[n].shm.name.len) {
continue;
}
if (ngx_strncmp(oshm_zone[i].shm.name.data,
shm_zone[n].shm.name.data,
oshm_zone[i].shm.name.len)
!= 0)
{
continue;
}
if (oshm_zone[i].tag == shm_zone[n].tag
&& oshm_zone[i].shm.size == shm_zone[n].shm.size
&& !oshm_zone[i].noreuse)
if (oshm_zone[i].shm.name.len == shm_zone[n].shm.name.len
&& ngx_strncmp(oshm_zone[i].shm.name.data,
shm_zone[n].shm.name.data,
oshm_zone[i].shm.name.len)
== 0)
{
goto live_shm_zone;
}
break;
}
ngx_shm_free(&oshm_zone[i].shm);
@ -768,9 +747,20 @@ old_shm_zone_done:
if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
/*
* perl_destruct() frees environ, if it is not the same as it was at
* perl_construct() time, therefore we save the previous cycle
* environment before ngx_conf_parse() where it will be changed.
*/
env = environ;
environ = senv;
ngx_destroy_pool(old_cycle->pool);
cycle->old_cycle = NULL;
environ = env;
return cycle;
}
@ -784,15 +774,15 @@ old_shm_zone_done:
}
n = 10;
if (ngx_array_init(&ngx_old_cycles, ngx_temp_pool, n,
sizeof(ngx_cycle_t *))
!= NGX_OK)
{
ngx_old_cycles.elts = ngx_pcalloc(ngx_temp_pool,
n * sizeof(ngx_cycle_t *));
if (ngx_old_cycles.elts == NULL) {
exit(1);
}
ngx_memzero(ngx_old_cycles.elts, n * sizeof(ngx_cycle_t *));
ngx_old_cycles.nelts = 0;
ngx_old_cycles.size = sizeof(ngx_cycle_t *);
ngx_old_cycles.nalloc = n;
ngx_old_cycles.pool = ngx_temp_pool;
ngx_cleaner_event.handler = ngx_clean_old_cycles;
ngx_cleaner_event.log = cycle->log;
@ -853,69 +843,6 @@ failed:
}
}
/* free the newly created shared memory */
part = &cycle->shared_memory.part;
shm_zone = part->elts;
for (i = 0; /* void */ ; i++) {
if (i >= part->nelts) {
if (part->next == NULL) {
break;
}
part = part->next;
shm_zone = part->elts;
i = 0;
}
if (shm_zone[i].shm.addr == NULL) {
continue;
}
opart = &old_cycle->shared_memory.part;
oshm_zone = opart->elts;
for (n = 0; /* void */ ; n++) {
if (n >= opart->nelts) {
if (opart->next == NULL) {
break;
}
opart = opart->next;
oshm_zone = opart->elts;
n = 0;
}
if (shm_zone[i].shm.name.len != oshm_zone[n].shm.name.len) {
continue;
}
if (ngx_strncmp(shm_zone[i].shm.name.data,
oshm_zone[n].shm.name.data,
shm_zone[i].shm.name.len)
!= 0)
{
continue;
}
if (shm_zone[i].tag == oshm_zone[n].tag
&& shm_zone[i].shm.size == oshm_zone[n].shm.size
&& !shm_zone[i].noreuse)
{
goto old_shm_zone_found;
}
break;
}
ngx_shm_free(&shm_zone[i].shm);
old_shm_zone_found:
continue;
}
if (ngx_test_config) {
ngx_destroy_cycle_pools(&conf);
return NULL;
@ -994,8 +921,7 @@ ngx_init_zone_pool(ngx_cycle_t *cycle, ngx_shm_zone_t *zn)
#else
file = ngx_pnalloc(cycle->pool,
cycle->lock_file.len + zn->shm.name.len + 1);
file = ngx_pnalloc(cycle->pool, cycle->lock_file.len + zn->shm.name.len);
if (file == NULL) {
return NGX_ERROR;
}
@ -1018,7 +944,6 @@ ngx_int_t
ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
{
size_t len;
ngx_int_t rc;
ngx_uint_t create;
ngx_file_t file;
u_char pid[NGX_INT64_LEN + 2];
@ -1043,13 +968,11 @@ ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
return NGX_ERROR;
}
rc = NGX_OK;
if (!ngx_test_config) {
len = ngx_snprintf(pid, NGX_INT64_LEN + 2, "%P%N", ngx_pid) - pid;
if (ngx_write_file(&file, pid, len, 0) == NGX_ERROR) {
rc = NGX_ERROR;
return NGX_ERROR;
}
}
@ -1058,7 +981,7 @@ ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
ngx_close_file_n " \"%s\" failed", file.name.data);
}
return rc;
return NGX_OK;
}
@ -1211,7 +1134,9 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
ngx_file_info_t fi;
if (ngx_file_info(file[i].name.data, &fi) == NGX_FILE_ERROR) {
if (ngx_file_info((const char *) file[i].name.data, &fi)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
ngx_file_info_n " \"%s\" failed",
file[i].name.data);
@ -1350,7 +1275,6 @@ ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)
shm_zone->data = NULL;
shm_zone->shm.log = cf->cycle->log;
shm_zone->shm.addr = NULL;
shm_zone->shm.size = size;
shm_zone->shm.name = *name;
shm_zone->shm.exists = 0;
@ -1417,54 +1341,3 @@ ngx_clean_old_cycles(ngx_event_t *ev)
ngx_old_cycles.nelts = 0;
}
}
void
ngx_set_shutdown_timer(ngx_cycle_t *cycle)
{
ngx_core_conf_t *ccf;
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
if (ccf->shutdown_timeout) {
ngx_shutdown_event.handler = ngx_shutdown_timer_handler;
ngx_shutdown_event.data = cycle;
ngx_shutdown_event.log = cycle->log;
ngx_shutdown_event.cancelable = 1;
ngx_add_timer(&ngx_shutdown_event, ccf->shutdown_timeout);
}
}
static void
ngx_shutdown_timer_handler(ngx_event_t *ev)
{
ngx_uint_t i;
ngx_cycle_t *cycle;
ngx_connection_t *c;
cycle = ev->data;
c = cycle->connections;
for (i = 0; i < cycle->connection_n; i++) {
if (c[i].fd == (ngx_socket_t) -1
|| c[i].read == NULL
|| c[i].read->accept
|| c[i].read->channel
|| c[i].read->resolver)
{
continue;
}
ngx_log_debug1(NGX_LOG_DEBUG_CORE, ev->log, 0,
"*%uA shutdown timeout", c[i].number);
c[i].close = 1;
c[i].error = 1;
c[i].read->handler(c[i].read);
}
}

View File

@ -31,7 +31,6 @@ struct ngx_shm_zone_s {
ngx_shm_t shm;
ngx_shm_zone_init_pt init;
void *tag;
void *sync;
ngx_uint_t noreuse; /* unsigned noreuse:1; */
};
@ -54,16 +53,10 @@ struct ngx_cycle_s {
ngx_uint_t modules_used; /* unsigned modules_used:1; */
ngx_queue_t reusable_connections_queue;
ngx_uint_t reusable_connections_n;
time_t connections_reuse_time;
ngx_array_t listening;
ngx_array_t paths;
ngx_array_t config_dump;
ngx_rbtree_t config_dump_rbtree;
ngx_rbtree_node_t config_dump_sentinel;
ngx_list_t open_files;
ngx_list_t shared_memory;
@ -80,7 +73,6 @@ struct ngx_cycle_s {
ngx_str_t conf_param;
ngx_str_t conf_prefix;
ngx_str_t prefix;
ngx_str_t error_log;
ngx_str_t lock_file;
ngx_str_t hostname;
};
@ -91,7 +83,6 @@ typedef struct {
ngx_flag_t master;
ngx_msec_t timer_resolution;
ngx_msec_t shutdown_timeout;
ngx_int_t worker_processes;
ngx_int_t debug_points;
@ -117,8 +108,6 @@ typedef struct {
ngx_array_t env;
char **environment;
ngx_uint_t transparent; /* unsigned transparent:1; */
} ngx_core_conf_t;
@ -135,7 +124,6 @@ ngx_pid_t ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv);
ngx_cpuset_t *ngx_get_cpu_affinity(ngx_uint_t n);
ngx_shm_zone_t *ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name,
size_t size, void *tag);
void ngx_set_shutdown_timer(ngx_cycle_t *cycle);
extern volatile ngx_cycle_t *ngx_cycle;

View File

@ -141,27 +141,12 @@ ngx_int_t
ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
ngx_uint_t persistent, ngx_uint_t clean, ngx_uint_t access)
{
size_t levels;
u_char *p;
uint32_t n;
ngx_err_t err;
ngx_str_t name;
ngx_uint_t prefix;
ngx_pool_cleanup_t *cln;
ngx_pool_cleanup_file_t *clnf;
if (file->name.len) {
name = file->name;
levels = 0;
prefix = 1;
} else {
name = path->name;
levels = path->len;
prefix = 0;
}
file->name.len = name.len + 1 + levels + 10;
file->name.len = path->name.len + 1 + path->len + 10;
file->name.data = ngx_pnalloc(pool, file->name.len + 1);
if (file->name.data == NULL) {
@ -174,13 +159,7 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
}
#endif
p = ngx_cpymem(file->name.data, name.data, name.len);
if (prefix) {
*p = '.';
}
p += 1 + levels;
ngx_memcpy(file->name.data, path->name.data, path->name.len);
n = (uint32_t) ngx_next_temp_number(0);
@ -190,11 +169,10 @@ ngx_create_temp_file(ngx_file_t *file, ngx_path_t *path, ngx_pool_t *pool,
}
for ( ;; ) {
(void) ngx_sprintf(p, "%010uD%Z", n);
(void) ngx_sprintf(file->name.data + path->name.len + 1 + path->len,
"%010uD%Z", n);
if (!prefix) {
ngx_create_hashed_filename(path, file->name.data, file->name.len);
}
ngx_create_hashed_filename(path, file->name.data, file->name.len);
ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
"hashed path: %s", file->name.data);
@ -247,7 +225,7 @@ ngx_create_hashed_filename(ngx_path_t *path, u_char *file, size_t len)
file[path->name.len + path->len] = '/';
for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) {
for (n = 0; n < 3; n++) {
level = path->level[n];
if (level == 0) {
@ -271,7 +249,7 @@ ngx_create_path(ngx_file_t *file, ngx_path_t *path)
pos = path->name.len;
for (i = 0; i < NGX_MAX_PATH_LEVEL; i++) {
for (i = 0; i < 3; i++) {
if (path->level[i] == 0) {
break;
}
@ -421,8 +399,6 @@ char *
ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev,
ngx_path_init_t *init)
{
ngx_uint_t i;
if (*path) {
return NGX_CONF_OK;
}
@ -443,10 +419,13 @@ ngx_conf_merge_path_value(ngx_conf_t *cf, ngx_path_t **path, ngx_path_t *prev,
return NGX_CONF_ERROR;
}
for (i = 0; i < NGX_MAX_PATH_LEVEL; i++) {
(*path)->level[i] = init->level[i];
(*path)->len += init->level[i] + (init->level[i] ? 1 : 0);
}
(*path)->level[0] = init->level[0];
(*path)->level[1] = init->level[1];
(*path)->level[2] = init->level[2];
(*path)->len = init->level[0] + (init->level[0] ? 1 : 0)
+ init->level[1] + (init->level[1] ? 1 : 0)
+ init->level[2] + (init->level[2] ? 1 : 0);
if (ngx_add_path(cf, path) != NGX_OK) {
return NGX_CONF_ERROR;
@ -463,7 +442,7 @@ ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
u_char *p;
ngx_str_t *value;
ngx_uint_t i, right, shift, *access, user;
ngx_uint_t i, right, shift, *access;
access = (ngx_uint_t *) (confp + cmd->offset);
@ -473,8 +452,7 @@ ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
value = cf->args->elts;
*access = 0;
user = 0600;
*access = 0600;
for (i = 1; i < cf->args->nelts; i++) {
@ -483,7 +461,6 @@ ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
if (ngx_strncmp(p, "user:", sizeof("user:") - 1) == 0) {
shift = 6;
p += sizeof("user:") - 1;
user = 0;
} else if (ngx_strncmp(p, "group:", sizeof("group:") - 1) == 0) {
shift = 3;
@ -510,8 +487,6 @@ ngx_conf_set_access_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
*access |= right << shift;
}
*access |= user;
return NGX_CONF_OK;
invalid:
@ -543,7 +518,7 @@ ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot)
return NGX_ERROR;
}
for (n = 0; n < NGX_MAX_PATH_LEVEL; n++) {
for (n = 0; n < 3; n++) {
if (p[i]->level[n] != path->level[n]) {
if (path->conf_file == NULL) {
if (p[i]->conf_file == NULL) {
@ -622,7 +597,9 @@ ngx_create_paths(ngx_cycle_t *cycle, ngx_uid_t user)
{
ngx_file_info_t fi;
if (ngx_file_info(path[i]->name.data, &fi) == NGX_FILE_ERROR) {
if (ngx_file_info((const char *) path[i]->name.data, &fi)
== NGX_FILE_ERROR)
{
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
ngx_file_info_n " \"%s\" failed", path[i]->name.data);
return NGX_ERROR;
@ -796,12 +773,10 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
{
char *buf;
off_t size;
time_t time;
size_t len;
ssize_t n;
ngx_fd_t fd, nfd;
ngx_int_t rc;
ngx_uint_t access;
ngx_file_info_t fi;
rc = NGX_ERROR;
@ -816,10 +791,8 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
goto failed;
}
if (cf->size != -1 && cf->access != 0 && cf->time != -1) {
if (cf->size != -1) {
size = cf->size;
access = cf->access;
time = cf->time;
} else {
if (ngx_fd_info(fd, &fi) == NGX_FILE_ERROR) {
@ -829,9 +802,7 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
goto failed;
}
size = (cf->size != -1) ? cf->size : ngx_file_size(&fi);
access = cf->access ? cf->access : ngx_file_access(&fi);
time = (cf->time != -1) ? cf->time : ngx_file_mtime(&fi);
size = ngx_file_size(&fi);
}
len = cf->buf_size ? cf->buf_size : 65536;
@ -845,7 +816,8 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
goto failed;
}
nfd = ngx_open_file(to, NGX_FILE_WRONLY, NGX_FILE_TRUNCATE, access);
nfd = ngx_open_file(to, NGX_FILE_WRONLY, NGX_FILE_CREATE_OR_OPEN,
cf->access);
if (nfd == NGX_INVALID_FILE) {
ngx_log_error(NGX_LOG_CRIT, cf->log, ngx_errno,
@ -892,10 +864,12 @@ ngx_copy_file(u_char *from, u_char *to, ngx_copy_file_t *cf)
size -= n;
}
if (ngx_set_file_time(to, nfd, time) != NGX_OK) {
ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
ngx_set_file_time_n " \"%s\" failed", to);
goto failed;
if (cf->time != -1) {
if (ngx_set_file_time(to, nfd, cf->time) != NGX_OK) {
ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
ngx_set_file_time_n " \"%s\" failed", to);
goto failed;
}
}
rc = NGX_OK;
@ -1017,13 +991,13 @@ ngx_walk_tree(ngx_tree_ctx_t *ctx, ngx_str_t *tree)
file.len = tree->len + 1 + len;
if (file.len > buf.len) {
if (file.len + NGX_DIR_MASK_LEN > buf.len) {
if (buf.len) {
ngx_free(buf.data);
}
buf.len = tree->len + 1 + len;
buf.len = tree->len + 1 + len + NGX_DIR_MASK_LEN;
buf.data = ngx_alloc(buf.len + 1, ctx->log);
if (buf.data == NULL) {

View File

@ -23,14 +23,14 @@ struct ngx_file_s {
ngx_log_t *log;
#if (NGX_THREADS || NGX_COMPAT)
#if (NGX_THREADS)
ngx_int_t (*thread_handler)(ngx_thread_task_t *task,
ngx_file_t *file);
void *thread_ctx;
ngx_thread_task_t *thread_task;
#endif
#if (NGX_HAVE_FILE_AIO || NGX_COMPAT)
#if (NGX_HAVE_FILE_AIO)
ngx_event_aio_t *aio;
#endif
@ -42,18 +42,16 @@ struct ngx_file_s {
#define NGX_MAX_PATH_LEVEL 3
typedef ngx_msec_t (*ngx_path_manager_pt) (void *data);
typedef ngx_msec_t (*ngx_path_purger_pt) (void *data);
typedef time_t (*ngx_path_manager_pt) (void *data);
typedef void (*ngx_path_loader_pt) (void *data);
typedef struct {
ngx_str_t name;
size_t len;
size_t level[NGX_MAX_PATH_LEVEL];
size_t level[3];
ngx_path_manager_pt manager;
ngx_path_purger_pt purger;
ngx_path_loader_pt loader;
void *data;
@ -64,7 +62,7 @@ typedef struct {
typedef struct {
ngx_str_t name;
size_t level[NGX_MAX_PATH_LEVEL];
size_t level[3];
} ngx_path_init_t;

View File

@ -265,19 +265,7 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
return NGX_ERROR;
}
if (hinit->bucket_size > 65536 - ngx_cacheline_size) {
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"could not build %s, too large "
"%s_bucket_size: %i",
hinit->name, hinit->name, hinit->bucket_size);
return NGX_ERROR;
}
for (n = 0; n < nelts; n++) {
if (names[n].key.data == NULL) {
continue;
}
if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
{
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
@ -312,19 +300,17 @@ ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
}
key = names[n].key_hash % size;
len = test[key] + NGX_HASH_ELT_SIZE(&names[n]);
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
#if 0
ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
"%ui: %ui %uz \"%V\"",
size, key, len, &names[n].key);
"%ui: %ui %ui \"%V\"",
size, key, test[key], &names[n].key);
#endif
if (len > bucket_size) {
if (test[key] > (u_short) bucket_size) {
goto next;
}
test[key] = (u_short) len;
}
goto found;
@ -355,18 +341,7 @@ found:
}
key = names[n].key_hash % size;
len = test[key] + NGX_HASH_ELT_SIZE(&names[n]);
if (len > 65536 - ngx_cacheline_size) {
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"could not build %s, you should "
"increase %s_max_size: %i",
hinit->name, hinit->name, hinit->max_size);
ngx_free(test);
return NGX_ERROR;
}
test[key] = (u_short) len;
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
}
len = 0;
@ -415,6 +390,7 @@ found:
buckets[i] = (ngx_hash_elt_t *) elts;
elts += test[i];
}
for (i = 0; i < size; i++) {

View File

@ -89,15 +89,12 @@ typedef struct {
} ngx_hash_keys_arrays_t;
typedef struct ngx_table_elt_s ngx_table_elt_t;
struct ngx_table_elt_s {
typedef struct {
ngx_uint_t hash;
ngx_str_t key;
ngx_str_t value;
u_char *lowcase_key;
ngx_table_elt_t *next;
};
} ngx_table_elt_t;
void *ngx_hash_find(ngx_hash_t *hash, ngx_uint_t key, u_char *name, size_t len);

View File

@ -12,8 +12,6 @@
static ngx_int_t ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u);
static ngx_int_t ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u);
static ngx_int_t ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u);
static ngx_int_t ngx_inet_add_addr(ngx_pool_t *pool, ngx_url_t *u,
struct sockaddr *sockaddr, socklen_t socklen, ngx_uint_t total);
in_addr_t
@ -184,11 +182,9 @@ ngx_sock_ntop(struct sockaddr *sa, socklen_t socklen, u_char *text, size_t len,
ngx_uint_t port)
{
u_char *p;
#if (NGX_HAVE_INET6 || NGX_HAVE_UNIX_DOMAIN)
size_t n;
#endif
struct sockaddr_in *sin;
#if (NGX_HAVE_INET6)
size_t n;
struct sockaddr_in6 *sin6;
#endif
#if (NGX_HAVE_UNIX_DOMAIN)
@ -245,9 +241,7 @@ ngx_sock_ntop(struct sockaddr *sa, socklen_t socklen, u_char *text, size_t len,
p = ngx_snprintf(text, len, "unix:%Z");
} else {
n = ngx_strnlen((u_char *) saun->sun_path,
socklen - offsetof(struct sockaddr_un, sun_path));
p = ngx_snprintf(text, len, "unix:%*s%Z", n, saun->sun_path);
p = ngx_snprintf(text, len, "unix:%s%Z", saun->sun_path);
}
/* we do not include trailing zero in address length */
@ -471,93 +465,6 @@ ngx_ptocidr(ngx_str_t *text, ngx_cidr_t *cidr)
}
ngx_int_t
ngx_cidr_match(struct sockaddr *sa, ngx_array_t *cidrs)
{
#if (NGX_HAVE_INET6)
u_char *p;
#endif
in_addr_t inaddr;
ngx_cidr_t *cidr;
ngx_uint_t family, i;
#if (NGX_HAVE_INET6)
ngx_uint_t n;
struct in6_addr *inaddr6;
#endif
#if (NGX_SUPPRESS_WARN)
inaddr = 0;
#if (NGX_HAVE_INET6)
inaddr6 = NULL;
#endif
#endif
family = sa->sa_family;
if (family == AF_INET) {
inaddr = ((struct sockaddr_in *) sa)->sin_addr.s_addr;
}
#if (NGX_HAVE_INET6)
else if (family == AF_INET6) {
inaddr6 = &((struct sockaddr_in6 *) sa)->sin6_addr;
if (IN6_IS_ADDR_V4MAPPED(inaddr6)) {
family = AF_INET;
p = inaddr6->s6_addr;
inaddr = p[12] << 24;
inaddr += p[13] << 16;
inaddr += p[14] << 8;
inaddr += p[15];
inaddr = htonl(inaddr);
}
}
#endif
for (cidr = cidrs->elts, i = 0; i < cidrs->nelts; i++) {
if (cidr[i].family != family) {
goto next;
}
switch (family) {
#if (NGX_HAVE_INET6)
case AF_INET6:
for (n = 0; n < 16; n++) {
if ((inaddr6->s6_addr[n] & cidr[i].u.in6.mask.s6_addr[n])
!= cidr[i].u.in6.addr.s6_addr[n])
{
goto next;
}
}
break;
#endif
#if (NGX_HAVE_UNIX_DOMAIN)
case AF_UNIX:
break;
#endif
default: /* AF_INET */
if ((inaddr & cidr[i].u.in.mask) != cidr[i].u.in.addr) {
goto next;
}
break;
}
return NGX_OK;
next:
continue;
}
return NGX_DECLINED;
}
ngx_int_t
ngx_parse_addr(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, size_t len)
{
@ -618,68 +525,6 @@ ngx_parse_addr(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, size_t len)
}
ngx_int_t
ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text,
size_t len)
{
u_char *p, *last;
size_t plen;
ngx_int_t rc, port;
rc = ngx_parse_addr(pool, addr, text, len);
if (rc != NGX_DECLINED) {
return rc;
}
last = text + len;
#if (NGX_HAVE_INET6)
if (len && text[0] == '[') {
p = ngx_strlchr(text, last, ']');
if (p == NULL || p == last - 1 || *++p != ':') {
return NGX_DECLINED;
}
text++;
len -= 2;
} else
#endif
{
p = ngx_strlchr(text, last, ':');
if (p == NULL) {
return NGX_DECLINED;
}
}
p++;
plen = last - p;
port = ngx_atoi(p, plen);
if (port < 1 || port > 65535) {
return NGX_DECLINED;
}
len -= plen + 1;
rc = ngx_parse_addr(pool, addr, text, len);
if (rc != NGX_OK) {
return rc;
}
ngx_inet_set_port(addr->sockaddr, (in_port_t) port);
return NGX_OK;
}
ngx_int_t
ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u)
{
@ -782,10 +627,13 @@ ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u)
static ngx_int_t
ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
{
u_char *host, *port, *last, *uri, *args, *dash;
size_t len;
ngx_int_t n;
struct sockaddr_in *sin;
u_char *p, *host, *port, *last, *uri, *args;
size_t len;
ngx_int_t n;
struct sockaddr_in *sin;
#if (NGX_HAVE_INET6)
struct sockaddr_in6 *sin6;
#endif
u->socklen = sizeof(struct sockaddr_in);
sin = (struct sockaddr_in *) &u->sockaddr;
@ -830,25 +678,6 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
len = last - port;
if (u->listen) {
dash = ngx_strlchr(port, last, '-');
if (dash) {
dash++;
n = ngx_atoi(dash, last - dash);
if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
u->last_port = (in_port_t) n;
len = dash - port - 1;
}
}
n = ngx_atoi(port, len);
if (n < 1 || n > 65535) {
@ -856,15 +685,10 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
return NGX_ERROR;
}
if (u->last_port && n > u->last_port) {
u->err = "invalid port range";
return NGX_ERROR;
}
u->port = (in_port_t) n;
sin->sin_port = htons((in_port_t) n);
u->port_text.len = last - port;
u->port_text.len = len;
u->port_text.data = port;
last = port - 1;
@ -876,69 +700,31 @@ ngx_parse_inet_url(ngx_pool_t *pool, ngx_url_t *u)
/* test value as port only */
len = last - host;
dash = ngx_strlchr(host, last, '-');
if (dash) {
dash++;
n = ngx_atoi(dash, last - dash);
if (n == NGX_ERROR) {
goto no_port;
}
if (n < 1 || n > 65535) {
u->err = "invalid port";
} else {
u->last_port = (in_port_t) n;
}
len = dash - host - 1;
}
n = ngx_atoi(host, len);
n = ngx_atoi(host, last - host);
if (n != NGX_ERROR) {
if (u->err) {
return NGX_ERROR;
}
if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
if (u->last_port && n > u->last_port) {
u->err = "invalid port range";
return NGX_ERROR;
}
u->port = (in_port_t) n;
sin->sin_port = htons((in_port_t) n);
sin->sin_addr.s_addr = INADDR_ANY;
u->port_text.len = last - host;
u->port_text.data = host;
u->wildcard = 1;
return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr,
u->socklen, 1);
return NGX_OK;
}
}
}
no_port:
u->err = NULL;
u->no_port = 1;
u->port = u->default_port;
sin->sin_port = htons(u->default_port);
u->last_port = 0;
}
len = last - host;
@ -954,7 +740,7 @@ no_port:
if (u->listen && len == 1 && *host == '*') {
sin->sin_addr.s_addr = INADDR_ANY;
u->wildcard = 1;
return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr, u->socklen, 1);
return NGX_OK;
}
sin->sin_addr.s_addr = ngx_inet_addr(host, len);
@ -965,7 +751,33 @@ no_port:
u->wildcard = 1;
}
return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr, u->socklen, 1);
u->naddrs = 1;
u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t));
if (u->addrs == NULL) {
return NGX_ERROR;
}
sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
if (sin == NULL) {
return NGX_ERROR;
}
ngx_memcpy(sin, u->sockaddr, sizeof(struct sockaddr_in));
u->addrs[0].sockaddr = (struct sockaddr *) sin;
u->addrs[0].socklen = sizeof(struct sockaddr_in);
p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
if (p == NULL) {
return NGX_ERROR;
}
u->addrs[0].name.len = ngx_sprintf(p, "%V:%d",
&u->host, u->port) - p;
u->addrs[0].name.data = p;
return NGX_OK;
}
if (u->no_resolve) {
@ -978,8 +790,30 @@ no_port:
u->family = u->addrs[0].sockaddr->sa_family;
u->socklen = u->addrs[0].socklen;
ngx_memcpy(&u->sockaddr, u->addrs[0].sockaddr, u->addrs[0].socklen);
u->wildcard = ngx_inet_wildcard(&u->sockaddr.sockaddr);
ngx_memcpy(u->sockaddr, u->addrs[0].sockaddr, u->addrs[0].socklen);
switch (u->family) {
#if (NGX_HAVE_INET6)
case AF_INET6:
sin6 = (struct sockaddr_in6 *) &u->sockaddr;
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
u->wildcard = 1;
}
break;
#endif
default: /* AF_INET */
sin = (struct sockaddr_in *) &u->sockaddr;
if (sin->sin_addr.s_addr == INADDR_ANY) {
u->wildcard = 1;
}
break;
}
return NGX_OK;
}
@ -989,7 +823,7 @@ static ngx_int_t
ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
{
#if (NGX_HAVE_INET6)
u_char *p, *host, *port, *last, *uri, *dash;
u_char *p, *host, *port, *last, *uri;
size_t len;
ngx_int_t n;
struct sockaddr_in6 *sin6;
@ -1009,73 +843,47 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
return NGX_ERROR;
}
port = p + 1;
if (last - p) {
uri = ngx_strlchr(port, last, '/');
port = p + 1;
if (uri) {
if (u->listen || !u->uri_part) {
u->err = "invalid host";
return NGX_ERROR;
}
uri = ngx_strlchr(port, last, '/');
u->uri.len = last - uri;
u->uri.data = uri;
last = uri;
}
if (port < last) {
if (*port != ':') {
u->err = "invalid host";
return NGX_ERROR;
}
port++;
len = last - port;
if (u->listen) {
dash = ngx_strlchr(port, last, '-');
if (dash) {
dash++;
n = ngx_atoi(dash, last - dash);
if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
u->last_port = (in_port_t) n;
len = dash - port - 1;
if (uri) {
if (u->listen || !u->uri_part) {
u->err = "invalid host";
return NGX_ERROR;
}
u->uri.len = last - uri;
u->uri.data = uri;
last = uri;
}
n = ngx_atoi(port, len);
if (*port == ':') {
port++;
if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
len = last - port;
n = ngx_atoi(port, len);
if (n < 1 || n > 65535) {
u->err = "invalid port";
return NGX_ERROR;
}
u->port = (in_port_t) n;
sin6->sin6_port = htons((in_port_t) n);
u->port_text.len = len;
u->port_text.data = port;
} else {
u->no_port = 1;
u->port = u->default_port;
sin6->sin6_port = htons(u->default_port);
}
if (u->last_port && n > u->last_port) {
u->err = "invalid port range";
return NGX_ERROR;
}
u->port = (in_port_t) n;
sin6->sin6_port = htons((in_port_t) n);
u->port_text.len = last - port;
u->port_text.data = port;
} else {
u->no_port = 1;
u->port = u->default_port;
sin6->sin6_port = htons(u->default_port);
}
len = p - host;
@ -1098,8 +906,33 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
}
u->family = AF_INET6;
u->naddrs = 1;
return ngx_inet_add_addr(pool, u, &u->sockaddr.sockaddr, u->socklen, 1);
u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t));
if (u->addrs == NULL) {
return NGX_ERROR;
}
sin6 = ngx_pcalloc(pool, sizeof(struct sockaddr_in6));
if (sin6 == NULL) {
return NGX_ERROR;
}
ngx_memcpy(sin6, u->sockaddr, sizeof(struct sockaddr_in6));
u->addrs[0].sockaddr = (struct sockaddr *) sin6;
u->addrs[0].socklen = sizeof(struct sockaddr_in6);
p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
if (p == NULL) {
return NGX_ERROR;
}
u->addrs[0].name.len = ngx_sprintf(p, "%V:%d",
&u->host, u->port) - p;
u->addrs[0].name.data = p;
return NGX_OK;
#else
@ -1116,9 +949,15 @@ ngx_parse_inet6_url(ngx_pool_t *pool, ngx_url_t *u)
ngx_int_t
ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
{
u_char *host;
ngx_uint_t n;
struct addrinfo hints, *res, *rp;
u_char *p, *host;
size_t len;
in_port_t port;
ngx_uint_t i;
struct addrinfo hints, *res, *rp;
struct sockaddr_in *sin;
struct sockaddr_in6 *sin6;
port = htons(u->port);
host = ngx_alloc(u->host.len + 1, pool->log);
if (host == NULL) {
@ -1142,7 +981,7 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
ngx_free(host);
for (n = 0, rp = res; rp != NULL; rp = rp->ai_next) {
for (i = 0, rp = res; rp != NULL; rp = rp->ai_next) {
switch (rp->ai_family) {
@ -1154,33 +993,92 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
continue;
}
n++;
i++;
}
if (n == 0) {
if (i == 0) {
u->err = "host not found";
goto failed;
}
/* MP: ngx_shared_palloc() */
u->addrs = ngx_pcalloc(pool, i * sizeof(ngx_addr_t));
if (u->addrs == NULL) {
goto failed;
}
u->naddrs = i;
i = 0;
/* AF_INET addresses first */
for (rp = res; rp != NULL; rp = rp->ai_next) {
switch (rp->ai_family) {
case AF_INET:
case AF_INET6:
break;
default:
if (rp->ai_family != AF_INET) {
continue;
}
if (ngx_inet_add_addr(pool, u, rp->ai_addr, rp->ai_addrlen, n)
!= NGX_OK)
{
sin = ngx_pcalloc(pool, rp->ai_addrlen);
if (sin == NULL) {
goto failed;
}
ngx_memcpy(sin, rp->ai_addr, rp->ai_addrlen);
sin->sin_port = port;
u->addrs[i].sockaddr = (struct sockaddr *) sin;
u->addrs[i].socklen = rp->ai_addrlen;
len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
p = ngx_pnalloc(pool, len);
if (p == NULL) {
goto failed;
}
len = ngx_sock_ntop((struct sockaddr *) sin, rp->ai_addrlen, p, len, 1);
u->addrs[i].name.len = len;
u->addrs[i].name.data = p;
i++;
}
for (rp = res; rp != NULL; rp = rp->ai_next) {
if (rp->ai_family != AF_INET6) {
continue;
}
sin6 = ngx_pcalloc(pool, rp->ai_addrlen);
if (sin6 == NULL) {
goto failed;
}
ngx_memcpy(sin6, rp->ai_addr, rp->ai_addrlen);
sin6->sin6_port = port;
u->addrs[i].sockaddr = (struct sockaddr *) sin6;
u->addrs[i].socklen = rp->ai_addrlen;
len = NGX_INET6_ADDRSTRLEN + sizeof("[]:65535") - 1;
p = ngx_pnalloc(pool, len);
if (p == NULL) {
goto failed;
}
len = ngx_sock_ntop((struct sockaddr *) sin6, rp->ai_addrlen, p,
len, 1);
u->addrs[i].name.len = len;
u->addrs[i].name.data = p;
i++;
}
freeaddrinfo(res);
@ -1197,19 +1095,21 @@ failed:
ngx_int_t
ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
{
u_char *host;
ngx_uint_t i, n;
u_char *p, *host;
size_t len;
in_port_t port;
in_addr_t in_addr;
ngx_uint_t i;
struct hostent *h;
struct sockaddr_in sin;
struct sockaddr_in *sin;
/* AF_INET only */
ngx_memzero(&sin, sizeof(struct sockaddr_in));
port = htons(u->port);
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = ngx_inet_addr(u->host.data, u->host.len);
in_addr = ngx_inet_addr(u->host.data, u->host.len);
if (sin.sin_addr.s_addr == INADDR_NONE) {
if (in_addr == INADDR_NONE) {
host = ngx_alloc(u->host.len + 1, pool->log);
if (host == NULL) {
return NGX_ERROR;
@ -1226,31 +1126,76 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
return NGX_ERROR;
}
for (n = 0; h->h_addr_list[n] != NULL; n++) { /* void */ }
for (i = 0; h->h_addr_list[i] != NULL; i++) { /* void */ }
/* MP: ngx_shared_palloc() */
for (i = 0; i < n; i++) {
sin.sin_addr.s_addr = *(in_addr_t *) (h->h_addr_list[i]);
u->addrs = ngx_pcalloc(pool, i * sizeof(ngx_addr_t));
if (u->addrs == NULL) {
return NGX_ERROR;
}
if (ngx_inet_add_addr(pool, u, (struct sockaddr *) &sin,
sizeof(struct sockaddr_in), n)
!= NGX_OK)
{
u->naddrs = i;
for (i = 0; i < u->naddrs; i++) {
sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
if (sin == NULL) {
return NGX_ERROR;
}
sin->sin_family = AF_INET;
sin->sin_port = port;
sin->sin_addr.s_addr = *(in_addr_t *) (h->h_addr_list[i]);
u->addrs[i].sockaddr = (struct sockaddr *) sin;
u->addrs[i].socklen = sizeof(struct sockaddr_in);
len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
p = ngx_pnalloc(pool, len);
if (p == NULL) {
return NGX_ERROR;
}
len = ngx_sock_ntop((struct sockaddr *) sin,
sizeof(struct sockaddr_in), p, len, 1);
u->addrs[i].name.len = len;
u->addrs[i].name.data = p;
}
} else {
/* MP: ngx_shared_palloc() */
if (ngx_inet_add_addr(pool, u, (struct sockaddr *) &sin,
sizeof(struct sockaddr_in), 1)
!= NGX_OK)
{
u->addrs = ngx_pcalloc(pool, sizeof(ngx_addr_t));
if (u->addrs == NULL) {
return NGX_ERROR;
}
sin = ngx_pcalloc(pool, sizeof(struct sockaddr_in));
if (sin == NULL) {
return NGX_ERROR;
}
u->naddrs = 1;
sin->sin_family = AF_INET;
sin->sin_port = port;
sin->sin_addr.s_addr = in_addr;
u->addrs[0].sockaddr = (struct sockaddr *) sin;
u->addrs[0].socklen = sizeof(struct sockaddr_in);
p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
if (p == NULL) {
return NGX_ERROR;
}
u->addrs[0].name.len = ngx_sprintf(p, "%V:%d",
&u->host, ntohs(port)) - p;
u->addrs[0].name.data = p;
}
return NGX_OK;
@ -1259,67 +1204,6 @@ ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
#endif /* NGX_HAVE_GETADDRINFO && NGX_HAVE_INET6 */
static ngx_int_t
ngx_inet_add_addr(ngx_pool_t *pool, ngx_url_t *u, struct sockaddr *sockaddr,
socklen_t socklen, ngx_uint_t total)
{
u_char *p;
size_t len;
ngx_uint_t i, nports;
ngx_addr_t *addr;
struct sockaddr *sa;
nports = u->last_port ? u->last_port - u->port + 1 : 1;
if (u->addrs == NULL) {
u->addrs = ngx_palloc(pool, total * nports * sizeof(ngx_addr_t));
if (u->addrs == NULL) {
return NGX_ERROR;
}
}
for (i = 0; i < nports; i++) {
sa = ngx_pcalloc(pool, socklen);
if (sa == NULL) {
return NGX_ERROR;
}
ngx_memcpy(sa, sockaddr, socklen);
ngx_inet_set_port(sa, u->port + i);
switch (sa->sa_family) {
#if (NGX_HAVE_INET6)
case AF_INET6:
len = NGX_INET6_ADDRSTRLEN + sizeof("[]:65536") - 1;
break;
#endif
default: /* AF_INET */
len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
}
p = ngx_pnalloc(pool, len);
if (p == NULL) {
return NGX_ERROR;
}
len = ngx_sock_ntop(sa, socklen, p, len, 1);
addr = &u->addrs[u->naddrs++];
addr->sockaddr = sa;
addr->socklen = socklen;
addr->name.len = len;
addr->name.data = p;
}
return NGX_OK;
}
ngx_int_t
ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1,
struct sockaddr *sa2, socklen_t slen2, ngx_uint_t cmp_port)
@ -1398,98 +1282,3 @@ ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1,
return NGX_OK;
}
in_port_t
ngx_inet_get_port(struct sockaddr *sa)
{
struct sockaddr_in *sin;
#if (NGX_HAVE_INET6)
struct sockaddr_in6 *sin6;
#endif
switch (sa->sa_family) {
#if (NGX_HAVE_INET6)
case AF_INET6:
sin6 = (struct sockaddr_in6 *) sa;
return ntohs(sin6->sin6_port);
#endif
#if (NGX_HAVE_UNIX_DOMAIN)
case AF_UNIX:
return 0;
#endif
default: /* AF_INET */
sin = (struct sockaddr_in *) sa;
return ntohs(sin->sin_port);
}
}
void
ngx_inet_set_port(struct sockaddr *sa, in_port_t port)
{
struct sockaddr_in *sin;
#if (NGX_HAVE_INET6)
struct sockaddr_in6 *sin6;
#endif
switch (sa->sa_family) {
#if (NGX_HAVE_INET6)
case AF_INET6:
sin6 = (struct sockaddr_in6 *) sa;
sin6->sin6_port = htons(port);
break;
#endif
#if (NGX_HAVE_UNIX_DOMAIN)
case AF_UNIX:
break;
#endif
default: /* AF_INET */
sin = (struct sockaddr_in *) sa;
sin->sin_port = htons(port);
break;
}
}
ngx_uint_t
ngx_inet_wildcard(struct sockaddr *sa)
{
struct sockaddr_in *sin;
#if (NGX_HAVE_INET6)
struct sockaddr_in6 *sin6;
#endif
switch (sa->sa_family) {
case AF_INET:
sin = (struct sockaddr_in *) sa;
if (sin->sin_addr.s_addr == INADDR_ANY) {
return 1;
}
break;
#if (NGX_HAVE_INET6)
case AF_INET6:
sin6 = (struct sockaddr_in6 *) sa;
if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
return 1;
}
break;
#endif
}
return 0;
}

View File

@ -13,35 +13,31 @@
#include <ngx_core.h>
/*
* TODO: autoconfigure NGX_SOCKADDRLEN and NGX_SOCKADDR_STRLEN as
* sizeof(struct sockaddr_storage)
* sizeof(struct sockaddr_un)
* sizeof(struct sockaddr_in6)
* sizeof(struct sockaddr_in)
*/
#define NGX_INET_ADDRSTRLEN (sizeof("255.255.255.255") - 1)
#define NGX_INET6_ADDRSTRLEN \
(sizeof("ffff:ffff:ffff:ffff:ffff:ffff:255.255.255.255") - 1)
#define NGX_UNIX_ADDRSTRLEN \
(sizeof("unix:") - 1 + \
sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
(sizeof(struct sockaddr_un) - offsetof(struct sockaddr_un, sun_path))
#if (NGX_HAVE_UNIX_DOMAIN)
#define NGX_SOCKADDR_STRLEN NGX_UNIX_ADDRSTRLEN
#elif (NGX_HAVE_INET6)
#define NGX_SOCKADDR_STRLEN (NGX_INET6_ADDRSTRLEN + sizeof("[]:65535") - 1)
#define NGX_SOCKADDR_STRLEN (sizeof("unix:") - 1 + NGX_UNIX_ADDRSTRLEN)
#else
#define NGX_SOCKADDR_STRLEN (NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1)
#define NGX_SOCKADDR_STRLEN (NGX_INET6_ADDRSTRLEN + sizeof("[]:65535") - 1)
#endif
/* compatibility */
#define NGX_SOCKADDRLEN sizeof(ngx_sockaddr_t)
typedef union {
struct sockaddr sockaddr;
struct sockaddr_in sockaddr_in;
#if (NGX_HAVE_INET6)
struct sockaddr_in6 sockaddr_in6;
#endif
#if (NGX_HAVE_UNIX_DOMAIN)
struct sockaddr_un sockaddr_un;
#define NGX_SOCKADDRLEN sizeof(struct sockaddr_un)
#else
#define NGX_SOCKADDRLEN 512
#endif
} ngx_sockaddr_t;
typedef struct {
@ -86,18 +82,18 @@ typedef struct {
in_port_t port;
in_port_t default_port;
in_port_t last_port;
int family;
unsigned listen:1;
unsigned uri_part:1;
unsigned no_resolve:1;
unsigned one_addr:1; /* compatibility */
unsigned no_port:1;
unsigned wildcard:1;
socklen_t socklen;
ngx_sockaddr_t sockaddr;
u_char sockaddr[NGX_SOCKADDRLEN];
ngx_addr_t *addrs;
ngx_uint_t naddrs;
@ -115,18 +111,12 @@ size_t ngx_sock_ntop(struct sockaddr *sa, socklen_t socklen, u_char *text,
size_t len, ngx_uint_t port);
size_t ngx_inet_ntop(int family, void *addr, u_char *text, size_t len);
ngx_int_t ngx_ptocidr(ngx_str_t *text, ngx_cidr_t *cidr);
ngx_int_t ngx_cidr_match(struct sockaddr *sa, ngx_array_t *cidrs);
ngx_int_t ngx_parse_addr(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text,
size_t len);
ngx_int_t ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr,
u_char *text, size_t len);
ngx_int_t ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u);
ngx_int_t ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u);
ngx_int_t ngx_cmp_sockaddr(struct sockaddr *sa1, socklen_t slen1,
struct sockaddr *sa2, socklen_t slen2, ngx_uint_t cmp_port);
in_port_t ngx_inet_get_port(struct sockaddr *sa);
void ngx_inet_set_port(struct sockaddr *sa, in_port_t port);
ngx_uint_t ngx_inet_wildcard(struct sockaddr *sa);
#endif /* _NGX_INET_H_INCLUDED_ */

View File

@ -315,7 +315,7 @@ ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err)
ngx_log_t *
ngx_log_init(u_char *prefix, u_char *error_log)
ngx_log_init(u_char *prefix)
{
u_char *p, *name;
size_t nlen, plen;
@ -323,11 +323,13 @@ ngx_log_init(u_char *prefix, u_char *error_log)
ngx_log.file = &ngx_log_file;
ngx_log.log_level = NGX_LOG_NOTICE;
if (error_log == NULL) {
error_log = (u_char *) NGX_ERROR_LOG_PATH;
}
name = (u_char *) NGX_ERROR_LOG_PATH;
/*
* we use ngx_strlen() here since BCC warns about
* condition is always false and unreachable code
*/
name = error_log;
nlen = ngx_strlen(name);
if (nlen == 0) {
@ -367,7 +369,7 @@ ngx_log_init(u_char *prefix, u_char *error_log)
*p++ = '/';
}
ngx_cpystrn(p, error_log, nlen + 1);
ngx_cpystrn(p, (u_char *) NGX_ERROR_LOG_PATH, nlen + 1);
p = name;
}
@ -401,7 +403,8 @@ ngx_log_init(u_char *prefix, u_char *error_log)
ngx_int_t
ngx_log_open_default(ngx_cycle_t *cycle)
{
ngx_log_t *log;
ngx_log_t *log;
static ngx_str_t error_log = ngx_string(NGX_ERROR_LOG_PATH);
if (ngx_log_get_file_log(&cycle->new_log) != NULL) {
return NGX_OK;
@ -422,7 +425,7 @@ ngx_log_open_default(ngx_cycle_t *cycle)
log->log_level = NGX_LOG_ERR;
log->file = ngx_conf_open_file(cycle, &cycle->error_log);
log->file = ngx_conf_open_file(cycle, &error_log);
if (log->file == NULL) {
return NGX_ERROR;
}

View File

@ -228,7 +228,7 @@ void ngx_cdecl ngx_log_debug_core(ngx_log_t *log, ngx_err_t err,
/*********************************/
ngx_log_t *ngx_log_init(u_char *prefix, u_char *error_log);
ngx_log_t *ngx_log_init(u_char *prefix);
void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...);
void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
u_char *ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err);

View File

@ -3,6 +3,8 @@
* An internal implementation, based on Alexander Peslyak's
* public domain implementation:
* http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
* It is not expected to be optimal and is used only
* if no MD5 implementation was found in system.
*/
@ -11,6 +13,8 @@
#include <ngx_md5.h>
#if !(NGX_HAVE_MD5)
static const u_char *ngx_md5_body(ngx_md5_t *ctx, const u_char *data,
size_t size);
@ -281,3 +285,5 @@ ngx_md5_body(ngx_md5_t *ctx, const u_char *data, size_t size)
return p;
}
#endif

View File

@ -13,6 +13,36 @@
#include <ngx_core.h>
#if (NGX_HAVE_MD5)
#if (NGX_HAVE_OPENSSL_MD5_H)
#include <openssl/md5.h>
#else
#include <md5.h>
#endif
typedef MD5_CTX ngx_md5_t;
#if (NGX_OPENSSL_MD5)
#define ngx_md5_init MD5_Init
#define ngx_md5_update MD5_Update
#define ngx_md5_final MD5_Final
#else
#define ngx_md5_init MD5Init
#define ngx_md5_update MD5Update
#define ngx_md5_final MD5Final
#endif
#else /* !NGX_HAVE_MD5 */
typedef struct {
uint64_t bytes;
uint32_t a, b, c, d;
@ -25,4 +55,6 @@ void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size);
void ngx_md5_final(u_char result[16], ngx_md5_t *ctx);
#endif
#endif /* _NGX_MD5_H_INCLUDED_ */

View File

@ -35,13 +35,13 @@
#define NGX_MODULE_SIGNATURE_2 "0"
#endif
#if (NGX_HAVE_FILE_AIO || NGX_COMPAT)
#if (NGX_HAVE_FILE_AIO)
#define NGX_MODULE_SIGNATURE_3 "1"
#else
#define NGX_MODULE_SIGNATURE_3 "0"
#endif
#if (NGX_HAVE_SENDFILE_NODISKIO || NGX_COMPAT)
#if (NGX_HAVE_AIO_SENDFILE)
#define NGX_MODULE_SIGNATURE_4 "1"
#else
#define NGX_MODULE_SIGNATURE_4 "0"
@ -71,8 +71,17 @@
#define NGX_MODULE_SIGNATURE_8 "0"
#endif
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
#define NGX_MODULE_SIGNATURE_9 "1"
#else
#define NGX_MODULE_SIGNATURE_9 "0"
#endif
#if (NGX_HAVE_REUSEPORT)
#define NGX_MODULE_SIGNATURE_10 "1"
#else
#define NGX_MODULE_SIGNATURE_10 "0"
#endif
#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
#define NGX_MODULE_SIGNATURE_11 "1"
@ -80,7 +89,11 @@
#define NGX_MODULE_SIGNATURE_11 "0"
#endif
#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
#define NGX_MODULE_SIGNATURE_12 "1"
#else
#define NGX_MODULE_SIGNATURE_12 "0"
#endif
#if (NGX_HAVE_SETFIB)
#define NGX_MODULE_SIGNATURE_13 "1"
@ -106,8 +119,17 @@
#define NGX_MODULE_SIGNATURE_16 "0"
#endif
#if (NGX_HAVE_MD5)
#define NGX_MODULE_SIGNATURE_17 "1"
#else
#define NGX_MODULE_SIGNATURE_17 "0"
#endif
#if (NGX_HAVE_SHA1)
#define NGX_MODULE_SIGNATURE_18 "1"
#else
#define NGX_MODULE_SIGNATURE_18 "0"
#endif
#if (NGX_HAVE_OPENAT)
#define NGX_MODULE_SIGNATURE_19 "1"
@ -127,7 +149,7 @@
#define NGX_MODULE_SIGNATURE_21 "0"
#endif
#if (NGX_THREADS || NGX_COMPAT)
#if (NGX_THREADS)
#define NGX_MODULE_SIGNATURE_22 "1"
#else
#define NGX_MODULE_SIGNATURE_22 "0"
@ -139,13 +161,17 @@
#define NGX_MODULE_SIGNATURE_23 "0"
#endif
#if (NGX_HTTP_SSL || NGX_COMPAT)
#if (NGX_HTTP_SSL)
#define NGX_MODULE_SIGNATURE_24 "1"
#else
#define NGX_MODULE_SIGNATURE_24 "0"
#endif
#if (NGX_HTTP_V2)
#define NGX_MODULE_SIGNATURE_25 "1"
#else
#define NGX_MODULE_SIGNATURE_25 "0"
#endif
#if (NGX_HTTP_GZIP)
#define NGX_MODULE_SIGNATURE_26 "1"
@ -153,7 +179,11 @@
#define NGX_MODULE_SIGNATURE_26 "0"
#endif
#if (NGX_HTTP_DEGRADATION)
#define NGX_MODULE_SIGNATURE_27 "1"
#else
#define NGX_MODULE_SIGNATURE_27 "0"
#endif
#if (NGX_HTTP_X_FORWARDED_FOR)
#define NGX_MODULE_SIGNATURE_28 "1"
@ -191,12 +221,6 @@
#define NGX_MODULE_SIGNATURE_33 "0"
#endif
#if (NGX_COMPAT)
#define NGX_MODULE_SIGNATURE_34 "1"
#else
#define NGX_MODULE_SIGNATURE_34 "0"
#endif
#define NGX_MODULE_SIGNATURE \
NGX_MODULE_SIGNATURE_0 NGX_MODULE_SIGNATURE_1 NGX_MODULE_SIGNATURE_2 \
NGX_MODULE_SIGNATURE_3 NGX_MODULE_SIGNATURE_4 NGX_MODULE_SIGNATURE_5 \
@ -209,7 +233,7 @@
NGX_MODULE_SIGNATURE_24 NGX_MODULE_SIGNATURE_25 NGX_MODULE_SIGNATURE_26 \
NGX_MODULE_SIGNATURE_27 NGX_MODULE_SIGNATURE_28 NGX_MODULE_SIGNATURE_29 \
NGX_MODULE_SIGNATURE_30 NGX_MODULE_SIGNATURE_31 NGX_MODULE_SIGNATURE_32 \
NGX_MODULE_SIGNATURE_33 NGX_MODULE_SIGNATURE_34
NGX_MODULE_SIGNATURE_33
#define NGX_MODULE_V1 \

View File

@ -35,10 +35,8 @@ ngx_murmur_hash2(u_char *data, size_t len)
switch (len) {
case 3:
h ^= data[2] << 16;
/* fall through */
case 2:
h ^= data[1] << 8;
/* fall through */
case 1:
h ^= data[0];
h *= 0x5bd1e995;

View File

@ -29,6 +29,10 @@
static ngx_inline ngx_int_t
ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
#if (NGX_HAVE_AIO_SENDFILE)
static ngx_int_t ngx_output_chain_aio_setup(ngx_output_chain_ctx_t *ctx,
ngx_file_t *file);
#endif
static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
ngx_chain_t **chain, ngx_chain_t *in);
static ngx_int_t ngx_output_chain_align_file_buf(ngx_output_chain_ctx_t *ctx,
@ -122,26 +126,6 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
continue;
}
if (bsize < 0) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
"negative size buf in output "
"t:%d r:%d f:%d %p %p-%p %p %O-%O",
ctx->in->buf->temporary,
ctx->in->buf->recycled,
ctx->in->buf->in_file,
ctx->in->buf->start,
ctx->in->buf->pos,
ctx->in->buf->last,
ctx->in->buf->file,
ctx->in->buf->file_pos,
ctx->in->buf->file_last);
ngx_debug_point();
return NGX_ERROR;
}
if (ngx_output_chain_as_is(ctx, ctx->in->buf)) {
/* move the chain link to the output chain */
@ -256,6 +240,10 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
}
#endif
if (buf->in_file && buf->file->directio) {
return 0;
}
sendfile = ctx->sendfile;
#if (NGX_SENDFILE_LIMIT)
@ -264,19 +252,6 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
sendfile = 0;
}
#endif
#if !(NGX_HAVE_SENDFILE_NODISKIO)
/*
* With DIRECTIO, disable sendfile() unless sendfile(SF_NOCACHE)
* is available.
*/
if (buf->in_file && buf->file->directio) {
sendfile = 0;
}
#endif
if (!sendfile) {
@ -288,6 +263,12 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
buf->in_file = 0;
}
#if (NGX_HAVE_AIO_SENDFILE)
if (ctx->aio_preload && buf->in_file) {
(void) ngx_output_chain_aio_setup(ctx, buf->file);
}
#endif
if (ctx->need_in_memory && !ngx_buf_in_memory(buf)) {
return 0;
}
@ -300,6 +281,28 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
}
#if (NGX_HAVE_AIO_SENDFILE)
static ngx_int_t
ngx_output_chain_aio_setup(ngx_output_chain_ctx_t *ctx, ngx_file_t *file)
{
ngx_event_aio_t *aio;
if (file->aio == NULL && ngx_file_aio_init(file, ctx->pool) != NGX_OK) {
return NGX_ERROR;
}
aio = file->aio;
aio->data = ctx->filter_ctx;
aio->preload_handler = ctx->aio_preload;
return NGX_OK;
}
#endif
static ngx_int_t
ngx_output_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
ngx_chain_t *in)
@ -509,7 +512,7 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
size = ngx_buf_size(src);
size = ngx_min(size, dst->end - dst->pos);
sendfile = ctx->sendfile && !ctx->directio;
sendfile = ctx->sendfile & !ctx->directio;
#if (NGX_SENDFILE_LIMIT)
@ -662,6 +665,7 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
for (size = 0; in; in = in->next) {
#if 1
if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
@ -681,26 +685,7 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
continue;
}
if (ngx_buf_size(in->buf) < 0) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
"negative size buf in chain writer "
"t:%d r:%d f:%d %p %p-%p %p %O-%O",
in->buf->temporary,
in->buf->recycled,
in->buf->in_file,
in->buf->start,
in->buf->pos,
in->buf->last,
in->buf->file,
in->buf->file_pos,
in->buf->file_last);
ngx_debug_point();
return NGX_ERROR;
}
#endif
size += ngx_buf_size(in->buf);
@ -724,6 +709,7 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
for (cl = ctx->out; cl; cl = cl->next) {
#if 1
if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
@ -743,26 +729,7 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
continue;
}
if (ngx_buf_size(cl->buf) < 0) {
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
"negative size buf in chain writer "
"t:%d r:%d f:%d %p %p-%p %p %O-%O",
cl->buf->temporary,
cl->buf->recycled,
cl->buf->in_file,
cl->buf->start,
cl->buf->pos,
cl->buf->last,
cl->buf->file,
cl->buf->file_pos,
cl->buf->file_last);
ngx_debug_point();
return NGX_ERROR;
}
#endif
size += ngx_buf_size(cl->buf);
}
@ -780,10 +747,6 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
return NGX_ERROR;
}
if (chain && c->write->ready) {
ngx_post_event(c->write, &ngx_posted_next_events);
}
for (cl = ctx->out; cl && cl != chain; /* void */) {
ln = cl;
cl = cl->next;

View File

@ -72,6 +72,9 @@ typedef struct {
} ngx_pool_cleanup_file_t;
void *ngx_alloc(size_t size, ngx_log_t *log);
void *ngx_calloc(size_t size, ngx_log_t *log);
ngx_pool_t *ngx_create_pool(size_t size, ngx_log_t *log);
void ngx_destroy_pool(ngx_pool_t *pool);
void ngx_reset_pool(ngx_pool_t *pool);

View File

@ -17,11 +17,6 @@ ngx_parse_size(ngx_str_t *line)
ssize_t size, scale, max;
len = line->len;
if (len == 0) {
return NGX_ERROR;
}
unit = line->data[len - 1];
switch (unit) {
@ -63,11 +58,6 @@ ngx_parse_offset(ngx_str_t *line)
size_t len;
len = line->len;
if (len == 0) {
return NGX_ERROR;
}
unit = line->data[len - 1];
switch (unit) {

Some files were not shown because too many files have changed in this diff Show More