Commit Graph

289 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa f8472f4709 nghttpx: Remove backend priority handling code
Currently, this does not do anything useful.
2016-01-15 00:17:40 +09:00
Tatsuhiro Tsujikawa 3218c160be nghttpx: Refactor Downstream::response_datalen_ 2016-01-14 23:49:21 +09:00
Tatsuhiro Tsujikawa e7e52b11ce nghttpx: Refactor Downstream::response_bodylen_ 2016-01-14 23:20:44 +09:00
Tatsuhiro Tsujikawa 3b8889a2a1 nghttpx: Extract response related fields to Response struct 2016-01-14 01:05:10 +09:00
Tatsuhiro Tsujikawa 919f08eb38 nghttpx: Extract request related fields to Request struct
Header field related functions are now gathered into FieldStore class.
This commit only handles request.  Subsequent commit will do the same
thing for response.
2016-01-14 01:04:32 +09:00
Tatsuhiro Tsujikawa 848f8fbe54 nghttpx: Don't apply max_header_fields and header_field_buffer limit to response
We modeled max_header_fields and header_field_buffer limit from Apache
configuration directives.  In Apache, they are only applied to request
header fields, while we applied both request and response.  Since
nghttpx is used as reverse proxy and backend server is relatively
"trusted", this commit removes the application to response header
fields.
2016-01-05 16:44:44 +09:00
Tatsuhiro Tsujikawa c0858d8c1a src: Minor optimization for appending single character 2015-11-28 00:03:16 +09:00
Tatsuhiro Tsujikawa 1753bea692 nghttpx: Support server push from HTTP/2 backend
This commits enables HTTP/2 server push from HTTP/2 backend to be
relayed to HTTP/2 frontend.  To use this feature, --http2-bridge or
--client is required.  Server push via Link header field contiues to
work.
2015-11-16 23:12:25 +09:00
Tatsuhiro Tsujikawa c6ef1c02b9 Switch to clang-format-3.6 2015-11-13 00:53:29 +09:00
Tatsuhiro Tsujikawa dbbed64146 nghttpx: Fix bug that causes connection failure with backend proxy URI
This is a regression when we introduced SSL/TLS session resumption in
HTTP/2 backend.  Before the introduction of session resumption,
conn_.tls.ssl is always nullptr when connection is made to proxy.  But
we have to keep conn_.tls.ssl to enable session resumption, so our
code breaks when it is reused.  This commit fixes this issue.

See GH-421
2015-11-09 21:35:53 +09:00
Lucas Pardue dcc9aaaa24 Add TLS dynamic record size behaviour command line options 2015-10-22 14:07:18 +00:00
Tatsuhiro Tsujikawa baadec5ef4 nghttpx: Add response mruby hook 2015-09-03 01:33:52 +09:00
Tatsuhiro Tsujikawa 1c12606e70 nghttpx: Don't allow blacked listed cipher suites for HTTP/2 connection 2015-08-19 23:42:43 +09:00
Tatsuhiro Tsujikawa e91a576179 nghttpx: Rewrite TLS async handshake using memchunk buffers 2015-08-13 00:42:59 +09:00
Tatsuhiro Tsujikawa ff44e211ed nghttpx: Fix tls handshake bug
This fixes 2 things:
1. potential busy loop
2. disabling ticket is not working after resumption
2015-08-09 18:33:49 +09:00
Tatsuhiro Tsujikawa 6446660113 nghttpx: Make record size timeout more durable to high load situation 2015-07-29 20:57:11 +09:00
Tatsuhiro Tsujikawa d0a37d59a5 nghttpx: Disable TLS session ticket if ticket key is not available 2015-07-29 20:38:49 +09:00
Tatsuhiro Tsujikawa cd25c6846e nghttpx: Create struct Address which holds struct sockaddr_union and length 2015-07-27 01:41:10 +09:00
Tatsuhiro Tsujikawa 90b4b48c7e nghttpx: Add shared session cache using memcached 2015-07-26 23:33:06 +09:00
Tatsuhiro Tsujikawa afbb99ecf7 nghttpx: Enable session resumption on HTTP/2 backend 2015-07-24 23:40:27 +09:00
Tatsuhiro Tsujikawa f96edbf987 nghttpx: Pin frontend to specific HTTP/2 session object per group 2015-07-13 21:31:37 +09:00
Tatsuhiro Tsujikawa 6307f96fb3 nghttpx: Enable host-path backend routing in HTTP/2 backend
To achieve host-path backend routing, we changed behaviour of
--backend-http2-connections-per-worker.  It now sets the number of
HTTP/2 physical connections per pattern group if pattern is used in -b
option.

Fixes GH-292
2015-07-12 23:02:30 +09:00
Tatsuhiro Tsujikawa 3119fc259c Select backend based on request host and path by extending -b option
-b option syntax is now <HOST>,<PORT>[;<PATTERN>[:...]].  The optional
<PATTERN>s specify the request host and path it is used for.  The
<PATTERN> can contain path, host + path or host.  The matching rule is
closely designed to ServeMux in Go programming language.
2015-07-11 00:15:52 +09:00
Tatsuhiro Tsujikawa 0b27f005e0 Merge branch 'master' into v1.0.0
Conflicts:
	src/HttpServer.cc
2015-05-15 23:24:19 +09:00
Tatsuhiro Tsujikawa 38cfc5c47c Check more headers and funcs 2015-05-13 23:29:20 +09:00
Tatsuhiro Tsujikawa e63d6e490a Merge branch 'master' into v1.0.0
Conflicts:
	lib/nghttp2_option.h
	lib/nghttp2_session.h
	src/HttpServer.cc
2015-05-08 19:21:51 +09:00
Tatsuhiro Tsujikawa 552f675466 nghttpx: Add --header-field-buffer and --max-header-fields options 2015-04-29 21:10:59 +09:00
Tatsuhiro Tsujikawa 5937b4b6f7 Merge branch 'master' into v1.0.0 2015-04-19 23:13:38 +09:00
Tatsuhiro Tsujikawa 308738025c nghttpx: Don't set response content-length if HTTP/2 response upgraded 2015-04-10 22:24:17 +09:00
Tatsuhiro Tsujikawa 97366bf55c nghttpx: Set content-length after complete request/response headers 2015-04-10 22:10:51 +09:00
Tatsuhiro Tsujikawa d0c27d5229 Send 24 bytes client magic byte string by library
Previously nghttp2_session_send() and nghttp2_session_mem_send() did
not send 24 bytes client magic byte string (MAGIC).  We made
nghttp2_session_recv() and nghttp2_session_mem_recv() process MAGIC by
default, so it is natural to make library send MAGIC as well.  This
commit makes nghttp2_session_send() and nghttp2_session_mem_send()
send MAGIC.  This commit also replace "connection preface" with
"client magic", since we call MAGIC as "connection preface" but it is
just a part of connection preface.  NGHTTP2_CLIENT_CONNECTION_PREFACE
macro was replaced with NGHTTP2_CLIENT_MAGIC.  The already deprecated
NGHTTP2_CLIENT_CONNECTION_HEADER macro was removed permanently.
nghttp2_option_set_no_recv_client_preface() was renamed as
nghttp2_option_set_no_recv_client_magic().  NGHTTP2_ERR_BAD_PREFACE
was renamed as NGHTTP2_ERR_BAD_CLIENT_MAGIC.
2015-04-05 23:15:20 +09:00
Tatsuhiro Tsujikawa 8bf440b89c nghttpx: Rename Http2Session::on_connect as connection_made 2015-03-28 20:19:17 +09:00
Tatsuhiro Tsujikawa 6f58434d89 nghttpx, h2load: Perform write whenever read succeeds 2015-03-28 19:13:14 +09:00
Tatsuhiro Tsujikawa 7b90404072 nghttpx: Omit well-known port from hostport in downstream request 2015-03-14 00:09:10 +09:00
Tatsuhiro Tsujikawa 0f87cedc2d nghttpx: Use doubly linked list for dconns_ and streams_ 2015-03-11 21:35:47 +09:00
Tatsuhiro Tsujikawa 4877f72a75 nghttpx: Optimize a bit 2015-03-11 00:42:18 +09:00
Tatsuhiro Tsujikawa 274b3a2296 nghttpx: Reset connection check timer on successful write while not checking 2015-03-11 00:27:51 +09:00
Tatsuhiro Tsujikawa 93013f4205 nghttpx: Remove --backend-http2-connection-check option, enable it by default 2015-03-11 00:22:05 +09:00
Tatsuhiro Tsujikawa 446de923f3 nghttpx: Support multiple HTTP/2 session per worker
Currently, we use same number of HTTP/2 sessions per worker with given
backend addresses.  New option to specify the number of HTTP/2 session
per worker will follow.
2015-03-10 23:20:21 +09:00
Tatsuhiro Tsujikawa c5860fc6f4 nghttpx: Support multiple -b option for HTTP/2 backend 2015-03-10 21:54:29 +09:00
Tatsuhiro Tsujikawa 41e266181e nghttpx: Attempt to improve HTTP/2 backend connection check
It turns out that writing successfully to network is not enough.
After apparently successful network write, read fails and then we
first know network has been lost (at least my android mobile network).
In this change, we say connection check is successful only when
successful read.  We already send PING in this case, so we just wait
PING ACK with short timeout.  If timeout has expired, drop connection.
Since waiting for PING ACK could degrade performance for fast reliably
connected network, we decided to disable connection check by default.
Use --backend-http2-connection-check to enable it.
2015-03-09 23:37:54 +09:00
Tatsuhiro Tsujikawa 60c2fe5a2e nghttpx: Support trailer-part in h2 <- h2 path 2015-03-08 16:48:45 +09:00
Tatsuhiro Tsujikawa 4de8db523f nghttpx: Check frame type in HTTP/2 backend on_begin_headers_callback 2015-03-02 00:53:48 +09:00
Tatsuhiro Tsujikawa 1c0d617742 nghttpx: Rename WorkerConfig as LogConfig
This is a sign that we only use thread-local storage for logging only.
2015-02-26 00:02:29 +09:00
Tatsuhiro Tsujikawa 1a2bccd71c nghttpx: Share nghttp2_session_callbacks between objects 2015-02-24 15:21:10 +09:00
Tatsuhiro Tsujikawa e583a25a8b nghttpx: Fix error found by coverity scan 2015-02-22 17:53:12 +09:00
Tatsuhiro Tsujikawa 49781da8f0 nghttpx: Don't need to const_cast to sockaddr* 2015-02-22 12:06:31 +09:00
Tatsuhiro Tsujikawa c84a190ac7 nghttpx: Use return 0 instead of break for readability 2015-02-21 17:08:03 +09:00
Tatsuhiro Tsujikawa 4424cf5b65 nghttpx: Fix 1 second delay in HTTP/2 backend connection 2015-02-20 19:48:35 +09:00
Tatsuhiro Tsujikawa 489b4f307c nghttp, nghttpd, nghttpx: Remove validations libnghttp2 offers 2015-02-20 01:01:10 +09:00
Tatsuhiro Tsujikawa b157d4ebb2 Validate HTTP semantics by default
Previously we did not check HTTP semantics and it is left out for
application.  Although checking is relatively easy, but they are
scattered and error prone.  We have implemented these checks in our
applications and also feel they are tedious.  To make application
development a bit easier, this commit adds basic HTTP semantics
validation to library code.  We do following checks:

server:

* HEADERS is either request header or trailer header.  Other type of
header is disallowed.

client:

* HEADERS is either zero or more non-final response header or final
  response header or trailer header.  Other type of header is
  disallowed.

For both:

* Check mandatory pseudo header fields.
* Make sure that content-length matches the amount of DATA we
  received.

If validation fails, RST_STREAM of type PROTOCOL_ERROR is issued.
2015-02-20 01:01:10 +09:00
Tatsuhiro Tsujikawa dbfc02cba0 nghttpx: Issue RST_STREAM if END_STREAM seen without final response 2015-02-18 00:36:49 +09:00
Tatsuhiro Tsujikawa d1a1e882bf nghttpx: Fix request re-submission bug in HTTP/2 backend 2015-02-17 23:15:53 +09:00
Tatsuhiro Tsujikawa 799778af69 Revert "nghttpx: Fix request resubmit bug on HTTP/2 backend connection check"
This reverts commit d45f5a51e4.
2015-02-17 22:28:03 +09:00
Tatsuhiro Tsujikawa d45f5a51e4 nghttpx: Fix request resubmit bug on HTTP/2 backend connection check 2015-02-17 21:50:32 +09:00
Tatsuhiro Tsujikawa 58d3b5b4a0 nghttpx: Fix occasional HTTP/2 backend connection failure with proxy
Previously if HTTP/1 proxy is used for backend connection, we read all
incoming bytes from proxy including response body, which may be part
of HTTP/2 protocol.  While investigating this issue, we found that
http_parser_execute() returns 1-less length when we call
http_parser_pause() inside on_headers_complete callback.  To
workaround this, we increment the return value by 1.  This commit also
fixes possible segmentation fault error, which could be caused by the
lack of stopping libev watcher in disconnect().
2015-02-15 01:09:10 +09:00
Tatsuhiro Tsujikawa 011e3b325d nghttpx: Cancel backend request when frontend HTTP/1 connection is lost 2015-02-13 22:41:50 +09:00
Tatsuhiro Tsujikawa 115d7133a0 nghttpx: Don't check HEADERS category in on_frame_not_send_callback 2015-02-12 22:44:29 +09:00
Tatsuhiro Tsujikawa 4401f697e5 src: Try to write immediately after read 2015-02-11 00:44:30 +09:00
Tatsuhiro Tsujikawa b14cfaf308 src: Store token in Header object to avoid additional lookups 2015-02-08 16:10:01 +09:00
Tatsuhiro Tsujikawa b4b2ddad3b src: Rewrite defer function template 2015-02-06 23:27:15 +09:00
Tatsuhiro Tsujikawa 90746cdd0e nghttpx: Fix compile error with OpenSSL 1.0.2 2015-02-06 21:14:04 +09:00
Tatsuhiro Tsujikawa 4cda09beff src: Prefer std::array 2015-02-06 00:15:43 +09:00
Tatsuhiro Tsujikawa 54851ef7a6 src: Move make_unique to nghttp2 namespace 2015-02-06 00:15:43 +09:00
Tatsuhiro Tsujikawa f3b247e4c8 nghttpx: Add missing rev start in HTTP/2 backend 2015-02-05 03:05:34 +09:00
Tatsuhiro Tsujikawa 7c75d9db98 nghttpx: Set nghttp2_option_set_peer_max_concurrent_streams for HTTP/2 backend 2015-02-05 03:05:34 +09:00
Tatsuhiro Tsujikawa b2fb888363 Share I/O code with all upstreams/downstream objects 2015-02-05 03:05:34 +09:00
Tatsuhiro Tsujikawa 82f90f9030 nghttpx: Rewrite :authority and host header field
We don't rewrite them if -s or -p is used
2015-02-04 01:42:19 +09:00
Tatsuhiro Tsujikawa 9a89db575a nghttpx: Reject multiple Content-Length even if their values are identical 2015-01-24 00:07:28 +09:00
Tatsuhiro Tsujikawa 5770c6bd04 nghttpx: Return 503 on hard disconnect in HTTP/2 backend 2015-01-21 23:30:48 +09:00
Tatsuhiro Tsujikawa 41e72064e0 nghttpx: Log error in INFO level when frame cannot be sent 2015-01-21 22:49:00 +09:00
Tatsuhiro Tsujikawa 53a41c953d nghttpx: Don't call ev_TYPE_set macro while watcher is active 2015-01-21 21:43:49 +09:00
Tatsuhiro Tsujikawa a440bdf15e nghttpx: Response 502 if HTTP/2 backend receives invalid Content-Length 2015-01-19 23:44:23 +09:00
Tatsuhiro Tsujikawa 441f1cc282 nghttpx: Validate received response body length against content-length 2015-01-17 21:33:23 +09:00
Tatsuhiro Tsujikawa 84ead30e58 nghttpx: Remove NGHTTP2_HCAT_REQUEST halding since already handled in lib 2015-01-15 23:16:24 +09:00
Tatsuhiro Tsujikawa 473f1d71ff src: Clear OpenSSL error queue before SSL_shutdown 2015-01-09 09:15:01 +09:00
Tatsuhiro Tsujikawa 7add262721 nghttpx: Detect TLS renegotiation after SSL_read and SSL_write 2015-01-09 00:49:27 +09:00
Tatsuhiro Tsujikawa 4a218f1b79 nghttpx: Clear OpenSSL error and handle limit change in read_tls 2015-01-09 00:08:34 +09:00
Tatsuhiro Tsujikawa d1391f1db7 nghttpx: Process buffered data first without reading additional data 2015-01-06 22:48:17 +09:00
Tatsuhiro Tsujikawa a6cf6c00ea nghttpx: Add SSL_read/write error logging 2015-01-06 22:02:24 +09:00
Tatsuhiro Tsujikawa cbc02bbc4c nghttpx: Code cleanup 2015-01-06 00:51:52 +09:00
Tatsuhiro Tsujikawa 7a50299cb0 nghttpx: Handle connect error 2015-01-05 16:14:10 +09:00
Tatsuhiro Tsujikawa 8fb544523c nghttpx: Fix HTTP/2 settings timer for HTTP/2 backend 2015-01-05 01:46:41 +09:00
Tatsuhiro Tsujikawa 3ae44ef2f3 nghttpd, nghttpx: Rework incoming header handling 2015-01-05 01:46:41 +09:00
Tatsuhiro Tsujikawa c654549d35 nghttpx: Remove commented code 2015-01-03 00:19:41 +09:00
Tatsuhiro Tsujikawa 645897503d nghttpx: Reset buffer on empty 2015-01-03 00:19:41 +09:00
Tatsuhiro Tsujikawa d157744fb2 nghttpx: Fix handling of pending data 2015-01-03 00:19:41 +09:00
Tatsuhiro Tsujikawa bfac015d61 src: Use libev for rest of the applications 2015-01-03 00:19:41 +09:00
Tatsuhiro Tsujikawa 556811ec64 nghttpx: Don't connect backend if connection is not establish up front 2014-12-15 23:34:00 +09:00
Tatsuhiro Tsujikawa 9a35dbc4ab src: Just check emptiness for value since spaces around value are stripped 2014-12-15 23:14:07 +09:00
Tatsuhiro Tsujikawa dce20c3e6a nghttpx: Check HTTP/2 downstream connection after certain idle time
Previously when requests are issued to HTTP/2 downstream connection,
but it turns out that connection is down, handlers of those requests
are deleted.  In some situations, we only know connection is down when
we write something to network, so we'd like to handle this kind of
situation in more robust manner.  In this change, certain seconds
passed after last network activity, we first issue PING frame to
downstream connection before issuing new HTTP request.  If writing
PING frame is failed, it means connection was lost.  In this case,
instead of deleting handler, pending requests are migrated to new
HTTP2/ downstream connection, so that it can continue without
affecting upstream connection.
2014-12-09 21:41:29 +09:00
Tatsuhiro Tsujikawa b607a22076 nghttpx: Support multiple HTTP/1 backend address
For HTTP/1 backend, -b option can be used several times to specify
multiple backend address.  HTTP/2 backend does not support multiple
addresses and only uses first address even if multiple addresses are
specified.
2014-12-06 19:30:27 +09:00
Tatsuhiro Tsujikawa cbb5da5285 nghttpx: Fix --backend-http-proxy-uri does not work 2014-12-02 03:03:14 +09:00
Tatsuhiro Tsujikawa dcc7b23980 nghttpx: Remove cipher suite requirement
This makes the library h2-16 compatible now.
2014-11-30 22:52:34 +09:00
Tatsuhiro Tsujikawa b1f807abd1 Reformat lines with clang-format-3.5 2014-11-27 23:56:30 +09:00
Tatsuhiro Tsujikawa 1e4f288a7c nghttpx: Remove misleading logging 2014-11-23 16:45:36 +09:00
Tatsuhiro Tsujikawa d98e9a63d0 src: Refactor code around ALPN setup 2014-11-14 23:14:39 +09:00
Tatsuhiro Tsujikawa ce71e65aee nghttpx: Replace WARNING with WARN for consistency 2014-11-08 10:51:56 +09:00
Tatsuhiro Tsujikawa 446f8f13aa src: Move libevent related helper functions to libevent_util 2014-09-24 00:45:40 +09:00
Tatsuhiro Tsujikawa 83309b6391 nghttpx: Reduce epoll_ctl call 2014-09-18 23:56:01 +09:00
Tatsuhiro Tsujikawa 23dd428d65 nghttpx: Reset timeouts when either read or write succeeds
See previous commit message why we need this.
2014-09-18 23:19:28 +09:00
Tatsuhiro Tsujikawa 5bff48a15a nghttpx: Call upstream resume_read after sending pending request to backend
With the combination of HTTP/1 upstream and HTTP/2 downstream,
downstream tells SHRPX_NO_BUFFER while connecting to the backend
server.  Previously, we did not call upstream resume_read and upload
was blocked.  This commit now calls upstream resume_read to unblock.
This commit also remove pending output buffer size of Http2Session
when calculating downstream connection's buffer is full.  This is
desirable since we only operate resume_read by stream basis.
2014-09-17 22:36:42 +09:00
Tatsuhiro Tsujikawa e4751a798a Replace auto_delete* with defer 2014-09-16 23:39:38 +09:00
Tatsuhiro Tsujikawa 8890e593e6 src: Add util::array_size 2014-08-28 00:45:12 +09:00
Tatsuhiro Tsujikawa 223242b512 nghttpx: Don't consume response data in downstream on_stream_close_callback
Even after on_stream_close_callback, Http2DownstreamConnection is
still alive and upstream keeps sending response to the client.  The
consumed bytes are processed normally (data_source_read_callback) and
also we have a code to consume all allocated bytes for
Http2DownstreamConnection object when it is deleted.  This means that
we don't need to and should not consume response data in downstream
on_stream_close_callback.  If we do, we may get assertion error in
Http2DownstreamConnection::resume_read().
2014-08-26 22:16:19 +09:00
Tatsuhiro Tsujikawa 53ee21caa9 Remove nghttp2_on_unknown_frame_recv_callback
It is not used by library for a while.  It could be used to pass
unsupported extension frames to application, but its interface
requires library to buffer entire frame, which we'd like to avoid.
For unsupported extension frames, we will add new callbacks which does
not require buffering if they are required.
2014-08-25 21:24:04 +09:00
Tatsuhiro Tsujikawa 31528b6267 Use uint32_t for HTTP/2 error_code
h2-14 now allows extensions to define new error codes.  To allow
application callback to access such error codes, we uses uint32_t as
error_code type for structs and function parameters.  Previously we
treated unknown error code as INTERNAL_ERROR, but this change removes
this and unknown error code is passed to application callback as is.
2014-08-25 21:24:04 +09:00
Tatsuhiro Tsujikawa ab5b81bee1 Hide nghttp2_session_callbacks details and provide setter like functions
To make it possible to add new callbacks without bumping so name, we
decided to hide details of nghttp2_session_callbacks.  We provide
setter like functions to set individual callback function.
2014-08-25 21:24:04 +09:00
Tatsuhiro Tsujikawa d5dcbf6f3b nghttpx: Fix possible flow control issue
Previously we only update consumed flow control window when number of
bytes read in nghttp2 and spdylay callback is 0.  Now we notify
nghttp2 library the consumed bytes even if number of bytes read > 0.
This change also uses newly added spdylay_session_consume() API, so we
require spdylay >= 1.3.0.
2014-08-21 21:22:16 +09:00
Tatsuhiro Tsujikawa 345121975a nghttpx: Handle socket creation error 2014-08-19 22:29:44 +09:00
Tatsuhiro Tsujikawa f776c50d43 nghttpx: Just record error code when RST_STREAM is received
libnghttp2 will call on_stream_close callback when RST_STREAM is
received.  So we can use on_stream_close callback to handle existing
stream, instead of on_frame_recv callback.
2014-08-14 12:48:30 +09:00
Tatsuhiro Tsujikawa 7b85f6c50d nghttpx: Store errno to a variable temporarly 2014-08-13 22:13:08 +09:00
Tatsuhiro Tsujikawa 21cbf417c8 nghttpx: Use SOCK_NONBLOCK and SOCK_CLOEXEC flag in socketpair to avoid race 2014-08-13 22:09:35 +09:00
Tatsuhiro Tsujikawa bf13d91264 nghttpx: Add hot deploy feature
nghttpx supports hot deploy feature using signals.  The host deploy in
nghttpx is multi step process.  First send USR2 signal to nghttpx
process.  It will do fork and execute new executable, using same
command-line arguments and environment variables.  At this point, both
current and new processes can accept requests.  To gracefully shutdown
current process, send QUIT signal to current nghttpx process.  When
all existing frontend connections are done, the current process will
exit.  At this point, only new nghttpx process exists and serves
incoming requests.
2014-08-13 00:43:54 +09:00
Tatsuhiro Tsujikawa 76703f79fa nghttpx: Add stream level timeout for HTTP/2 and SPDY upstream/downstream 2014-08-09 22:56:27 +09:00
Tatsuhiro Tsujikawa 704bbbfcaa nghttpx: Fail if :status is not digits on http2 downstream 2014-08-08 23:08:24 +09:00
Tatsuhiro Tsujikawa d4d56e1846 nghttpd, nghttpx: Check that pseudo headers come before normal headers 2014-08-08 20:52:32 +09:00
Tatsuhiro Tsujikawa d496c42dc9 Revert "nghttpx, nghttpd: Check pseudo header fields come before normal header fields"
This reverts commit cc24b9aaf0.
2014-08-08 20:17:03 +09:00
Tatsuhiro Tsujikawa cc24b9aaf0 nghttpx, nghttpd: Check pseudo header fields come before normal header fields 2014-08-07 22:49:34 +09:00
Tatsuhiro Tsujikawa 7c781bcd1a nghttpx: Issue RST_STREAM instead of returning NGHTTP2_ERR_TEMPORAL_CALLBACKFAILURE
NGHTTP2_ERR_TEMPORAL_CALLBACKFAILURE is not supported in
on_frame_recv_callback.
2014-08-02 00:26:43 +09:00
Tatsuhiro Tsujikawa 2e083352d5 nghttpx: Fix crash on http2 downstream disconnect 2014-07-31 23:34:33 +09:00
Tatsuhiro Tsujikawa 6e027ad830 nghttpd, nghttpx: Check allowed pseudo headers 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 9d78167297 nghttpx: Treat unexpected HEADERS as stream error 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 04b5d1679f nghttpx: Log non-final response headers 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa c859fb8f7c nghttpx: Don't respond DATA frame for HEAD request or 204, 304, 1xx 2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 079db14d45 Add nghttp2_session_consume() API
Reworked no automatic WINDOW_UPDATE feature.  We added new API
nghttp2_session_consume() which tells the library how many bytes are
consumed by the application.  Instead of submitting WINDOW_UPDATE by
the application, the library is now responsible to submit
WINDOW_UPDATE based on consumed bytes.  This is more reliable method,
since it enables us to properly send WINDOW_UPDATE for stream and
connection individually.  The previous implementation of nghttpx had
broken connection window management.
2014-07-31 23:05:53 +09:00
Tatsuhiro Tsujikawa 4f815521ae nghttpx, nghttpd: Support non-final response 2014-07-31 23:05:52 +09:00
Tatsuhiro Tsujikawa d3ca003346 Update android-config and fix build warning with android NDK 2014-07-06 23:32:08 +09:00
Tatsuhiro Tsujikawa 0ce848a611 nghttpx: Rewrite logging system
This change rewrites logging system of nghttpx.  Previously access log
and error log are written to stderr or syslog and there was no option
to change stderr to something else.  With this change, file path of
access log and error log can be configured separately and logging to
regular file is now added.  To support rotating log, if SIGUSR1 signal
is received by nghttpx, it closes the current log files and reopen it
with the same name.  The format of access log is changed and has same
look of apache's.  But not all columns are not supported yet.
2014-07-05 18:43:24 +09:00
Tatsuhiro Tsujikawa 119fb05cc2 nghttpx: Call on_response_headers for response header only in http2 downstream 2014-07-03 21:18:01 +09:00
Tatsuhiro Tsujikawa acb3d4dcfc nghttpx: Handle connection flow control for DATA not sent to frontend 2014-07-02 23:24:59 +09:00
Tatsuhiro Tsujikawa ca87b45fe4 nghttpx: Don't fail backend connection if one of backend request fails 2014-06-27 22:34:54 +09:00
Tatsuhiro Tsujikawa 94b9c3771d nghttpx: Throw away request and response headers when they are done 2014-06-15 17:25:24 +09:00
Tatsuhiro Tsujikawa 24762db8f5 nghttpx: Drop connection if HTTP/2 security level is not satisfied on backend 2014-06-11 00:19:54 +09:00
Tatsuhiro Tsujikawa 14b818efc8 nghttpx: Use std::unique_ptr<char[]> instead of char* 2014-06-08 21:02:40 +09:00
Tatsuhiro Tsujikawa 7e217511bf nghttpx: Code cleanup
Mainly make nested code block to rather flat style.
2014-06-01 23:44:32 +09:00
Tatsuhiro Tsujikawa 8c67bbe3a8 src: Avoid copy in evbuffer_pullup()
Previously, we use evbuffer_pullup(buf, -1) to linearize the memory
region and it may cause buffer copy.  To avoid this, we use the return
value of evbuffer_get_contiguous_space() as 2nd parameter.  According
to the libevent manual, by doing so evbuffer_pullup() will not copy or
modify any data in evbuffer.
2014-06-01 21:01:01 +09:00
Tatsuhiro Tsujikawa 3b7c733246 nghttpx: Fix typo 2014-06-01 02:32:15 +09:00
Tatsuhiro Tsujikawa 3b5b5ce254 Update http-parser to 8d9e5db981b623fffc93657abacdc80270cbee58 2014-05-16 00:23:03 +09:00
Tatsuhiro Tsujikawa 2ae1da113e src: Use C++ style comments for C++ source code 2014-05-14 23:22:23 +09:00
Tatsuhiro Tsujikawa e8de437d5c Return new stream ID from nghttp2_submit_{request, headers, push_promise}
Previously stream ID was assigned just before HEADERS or PUSH_PROMISE
was serialized and nghttp2_submit_{request, headers, push_promise} did
not return stream ID.  The application has to check assigned stream ID
using before_frame_send_callback.  Now it is apparent that priority is
meant to DATA transfer only.  Also application can reorder the
requests if it wants. Therefore we can assign stream ID in
nghttp2_submit_* functions and return stream ID from them.  With this
change, now application does not have to check stream ID using
before_frame_send_callback and its code will be simplified.
2014-05-07 23:24:07 +09:00
Tatsuhiro Tsujikawa a82b7f09c8 nghttpx: Drop HTTP/2 backend connection unless TLSv1.2 or TLSv1.1 was negotiated 2014-04-26 23:00:58 +09:00
Tatsuhiro Tsujikawa d668d2448b Hide session option from public API
To make adding new option easier, we decided to make the details of
option struct private and hide it from public API.  We provide
functions to set individual option value.
2014-04-04 21:57:47 +09:00
Tatsuhiro Tsujikawa 22c88af1ab nghttpx: Resume deferred DATA after complete DATA frame arrived on backend
If SPDY or HTTP/2 ustream is used and HTTP/2 downstream is used, only
call {spdylay,nghttp2}_resume_data when complete DATA frame was read
in backend to avoid to transmit too small DATA frame to the upstream.
2014-04-03 18:54:15 +09:00
Tatsuhiro Tsujikawa b1edb1f3ae Don't index name/value pair bearing NO_INDEX flag when forwarding it 2014-04-03 11:22:11 +09:00
Tatsuhiro Tsujikawa c9f90924a9 Add flags parameter to nghttp2_on_header_callback 2014-04-02 02:10:35 +09:00
Tatsuhiro Tsujikawa 60a2c260a5 Define NGHTTP2_CLIENT_CONNECTION_PREFACE macro
NGHTTP2_CLIENT_CONNECTION_PREFACE has the same content with
NGHTTP2_CLIENT_CONNECTION_HEADER, which is now obsoleted by
NGHTTP2_CLIENT_CONNECTION_PREFACE.
2014-03-30 21:02:25 +09:00
Tatsuhiro Tsujikawa ab2dc5967d Replace HTTP/2.0 with HTTP/2 2014-03-30 19:26:37 +09:00
Tatsuhiro Tsujikawa f7162ab702 Implement dependency based priority 2014-03-30 01:24:16 +09:00
Tatsuhiro Tsujikawa 334656b704 nghttpx: Announce 2.0 in via header field 2014-03-21 19:25:46 +09:00