Commit Graph

64 Commits

Author SHA1 Message Date
Max Romanov
6bda9b5eeb Using malloc/free for the http fields hash.
This is required due to lack of a graceful shutdown: there is a small gap
between the runtime's memory pool release and router process's exit. Thus, a
worker thread may start processing a request between these two operations,
which may result in an http fields hash access and subsequent crash.

To simplify issue reproduction, it makes sense to add a 2 sec sleep before
exit() in nxt_runtime_exit().
2020-04-16 17:09:23 +03:00
Igor Sysoev
04143c8c7e Fixed crash that occurs when idle connections are closed forcibly. 2020-04-15 14:54:09 +03:00
Valentin Bartenev
c63b498f94 Implemented "location" option for "return" action.
This allows to specify redirects:

  {
      "action": {
          "return": 301,
          "location": "https://www.example.com/"
      }
  }
2020-03-21 01:39:00 +03:00
Max Romanov
59e06e4910 Completing buffers immediately
This fixes crash introduced in 039b00e32e3d.
2020-03-19 22:04:43 +03:00
Max Romanov
c26fbbe53a Completing request header buffers to avoid memory leak.
Before this fix, only persistent connection request buffers were completed.

This issue was introduced in dc403927ab0b.
2020-03-19 20:43:35 +03:00
Max Romanov
5296be0b82 Using disk file to store large request body.
This closes #386 on GitHub.
2020-03-12 17:54:29 +03:00
Max Romanov
0b5aabfc3f Checking Content-Length value right after header parse.
The check was moved from the request body read stage.
2020-03-12 17:54:19 +03:00
Igor Sysoev
7935ea4543 Round robin upstream added. 2020-03-06 18:28:54 +03:00
Max Romanov
806b3945fe Introducing write tail reference to avoid buffer chain iteration. 2019-12-24 18:04:00 +03:00
Igor Sysoev
02e197e978 Processing inconsistent proxied response length.
Keepalive connection is disabled if upstream response length
differs from specified in the "Content-Length" field value.
2019-11-14 16:40:02 +03:00
Igor Sysoev
ddde9c23cf Initial proxy support. 2019-11-14 16:39:54 +03:00
Igor Sysoev
57e326b411 Introduced chained buffer completion handlers. 2019-11-14 16:39:48 +03:00
Igor Sysoev
643c433f8e Using event engine memory buffers in HTTP/1 layer. 2019-11-14 16:39:48 +03:00
Igor Sysoev
d4e3951c4d Using request task. 2019-11-14 16:39:48 +03:00
Igor Sysoev
09e7357b08 Style fixes. 2019-10-10 19:42:41 +03:00
Igor Sysoev
ec0d5c928e Changed nxt_memcasecmp() interface to avoid casts. 2019-10-10 19:37:40 +03:00
Valentin Bartenev
f8ff71b917 HTTP: corrected allocation size for tail chunk. 2019-09-30 19:11:17 +03:00
Max Romanov
daadc2e00b Making request state handler calls more consistent. 2019-09-02 18:27:08 +03:00
Igor Sysoev
e2abfaf381 Adding body handler to nxt_http_request_header_send(). 2019-08-26 18:29:00 +03:00
Max Romanov
e501c74ddc Introducing websocket support in router and libunit. 2019-08-20 16:31:53 +03:00
Max Romanov
686f5b1436 Changing the sequence of body send execution.
Request state ready_handler required for further websocket events processing.
It is not required for regular response transferring.
2019-08-16 14:55:18 +03:00
Igor Sysoev
c7210eaa5a nxt_h1proto_t definition was moved to h1proto implementation. 2019-08-06 15:29:40 +03:00
Igor Sysoev
17bb22a4e4 Refactored HTTP protocol callback table. 2019-08-06 15:29:39 +03:00
Axel Duch
7785c96c1a Added routing based on request scheme.
Scheme matches exact string “http” or “https”.
2019-07-24 13:47:35 +03:00
Max Romanov
452ce0789e Adjusting request schema value according to connection tls state.
This closes #223 issue on GitHub.
2019-03-21 13:55:57 +03:00
Igor Sysoev
834e8ca576 Fixed timer and event race condition.
When idle timeout occurs at the same time as a request comes in,
the timer handler closes connection while the read event triggers
request processing, and this eventually leads to segmentation fault.
2019-02-28 18:04:11 +03:00
Igor Sysoev
444b9ffea9 Keepalive mode is disabled on HTTP header parsing errors. 2019-02-26 19:12:16 +03:00
Valentin Bartenev
2d4697dbbe Validation and normalization of request host. 2019-02-19 20:25:25 +03:00
Valentin Bartenev
d54d806c52 Disabled chunked transfer encoding for 304 responses as well.
According to RFC 7232:

 | A 304 response cannot contain a message-body; it is always terminated
 | by the first empty line after the header fields.
2018-10-01 15:06:31 +03:00
Valentin Bartenev
3c2eddb183 Allowing keep-alive connections after 204 responses.
This was unintentionally disabled by 7b5026a0bdeb.
2018-10-01 15:06:31 +03:00
Igor Sysoev
b5d4fc939e Disabled chunked transfer encoding for 204 responses. 2018-09-28 17:32:02 +03:00
Igor Sysoev
b5d76454ed Added nginx error 497 response. 2018-09-20 15:05:38 +03:00
Igor Sysoev
96cd68b340 Added SSL/TLS support on connection level. 2018-09-20 15:05:37 +03:00
Igor Sysoev
8654372842 Fixed segfault on listening socket close.
Now keep-alive connection sends 408 response if listening
socket was closed while reconfiguration.
2018-07-30 17:05:49 +03:00
Igor Sysoev
69a1169cae Sending 408 response on idle connection timeout. 2018-07-30 17:05:48 +03:00
Igor Sysoev
5de582f6db Disabling keep-alive connection on errors. 2018-07-12 18:29:22 +03:00
Igor Sysoev
071412a9ae Fixed bug in "send_timeout" handling. 2018-07-12 18:29:22 +03:00
Valentin Bartenev
1a52d876f7 Introduced nxt_length() macro. 2018-06-25 16:51:47 +03:00
Igor Sysoev
ff6ca2a82c Fixed keep-alive hanging after reconfiguration. 2018-05-30 18:46:05 +03:00
Igor Sysoev
d5a96ff000 Miscellaneous changes. 2018-04-12 17:11:35 +03:00
Igor Sysoev
8afa51415e Disabling timer when request header has been entirely read. 2018-04-12 17:11:34 +03:00
Igor Sysoev
8e9a950374 Fixed idle timeout, broken in b3e55c647741. 2018-04-12 17:11:33 +03:00
Valentin Bartenev
204c394721 Initial access log support. 2018-04-11 18:23:33 +03:00
Igor Sysoev
c7e575d5c6 Introducing connection state io_read_handler. 2018-04-11 17:33:18 +03:00
Igor Sysoev
0be4f1f693 Keepalive processing optimization. 2018-04-11 17:33:16 +03:00
Valentin Bartenev
dc75c83950 Fixed pipelined request processing, broken by 9e16499b63f0. 2018-04-11 12:49:58 +03:00
Igor Sysoev
1fab645246 Added "408 Request Timeout" error response. 2018-04-10 19:38:48 +03:00
Igor Sysoev
73bdb5ec09 Refactored HTTP header parsing. 2018-04-10 19:38:45 +03:00
Igor Sysoev
0a44ac371a Splitting HTTP processing in more granulate connection states. 2018-04-10 19:30:45 +03:00
Valentin Bartenev
eb51264710 Processing of partially parsed HTTP header.
This is useful for log purposes.
2018-04-09 19:16:19 +03:00