Commit Graph

4202 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa aa317c89ea Add API to change stream priority without sending PRIORITY frame
The added API is nghttp2_session_change_stream_priority().  This
provides the same functionality to re-prioritize stream when PRIORITY
frame.  is received, but we do it without PRIORITY frame.  This could
be useful for server to change pushed stream's priority silently.
2015-11-21 18:32:42 +09:00
Tatsuhiro Tsujikawa 72f2c4b272 Add nghttp2_session_check_server_session.rst to APIDOCS 2015-11-21 18:31:39 +09:00
Tatsuhiro Tsujikawa c7304317d4 nghttpd: Check validity of cached file descriptor periodically
This commit adds ability to check status of cached file descriptor to
make sure that it can be reused.  We inspect last modification time
and number of hard links.  If last modification is changed from the
last validation time, or number of hard links gets 0, we don't reuse
file descriptor.  We also capped upper limit of the cached file
descriptors.  If the limit is reached, we will close file descriptor
which is least recently used, and its usecount is 0.
2015-11-21 16:05:08 +09:00
Tatsuhiro Tsujikawa 3673b1303a python: Do the same thing in 8481bc6 with HEADERS + END_STREAM flag set 2015-11-21 15:44:12 +09:00
Tatsuhiro Tsujikawa b27b002a3f python: Use nghttp2_session_get_stream_remote_close 2015-11-21 15:40:05 +09:00
Tatsuhiro Tsujikawa 8481bc6e93 python: Send RST_STREAM if remote side is not closed and response finished 2015-11-21 15:09:06 +09:00
Tatsuhiro Tsujikawa 63a50b1ccf Add nghttp2_session_check_server_session() API
This is very simple API, and it returns nonzero if session is
initialized as server.
2015-11-21 15:07:55 +09:00
Tatsuhiro Tsujikawa 63aa3466e9 nghttpd: Fix crash with CONNECT request 2015-11-21 12:54:04 +09:00
Tatsuhiro Tsujikawa d7b0768ab8 Fix bug that dep_stream->sum_dep_weight was not updated 2015-11-20 21:24:54 +09:00
Tatsuhiro Tsujikawa 4db3828fa6 Reset last_writelen to 0 when stream is removed from tree
When stream is removed from tree, stream is either closed, or its
remote flow control window is depleted.  In the latter case, we
schedule this stream as fast as possible if its remote window gets
positive, since it did not sent anything in its turn.  To achieve
this, reset last_writelen to 0 when stream is removed from tree.
2015-11-20 00:19:17 +09:00
Tatsuhiro Tsujikawa 3bbb05f59b Optimize the case when only weight is changed 2015-11-20 00:19:02 +09:00
Tatsuhiro Tsujikawa ab1e8305a1 asio: client: call on_error when connection is dropped
When connection is dropped, we get "nonzero" error code ec in
read_socket callback.  We can just call on_error callback if ec is
nonzero.  But there is a problem when we did ordered shutdown.  In
this case, we also get EOF in ec, but we don't want to call on_error
because it is not an error.  To workaround this, we check return value
of should_stop().  If it is true, then we assume that HTTP/2 session
cleanly ended, and we don't call on_error.
2015-11-19 00:04:10 +09:00
Tatsuhiro Tsujikawa 8b4f6f1778 nghttpd: Defered eviction of cached fd using timer
To make use cache fd more robust manner (e.g. among several
connections), eviction of cached file descriptor now takes place using
timer.  The timer is started when there is no handler (no
connections).  The timeout value is hard-coded and 2 seconds.
2015-11-18 23:21:57 +09:00
Tatsuhiro Tsujikawa 8c94341c18 h2load: Override user-agent with -H option
This commit allows user to override user-agent with -H option.  We
also enabled custom header support for http/1.1 requests.  We also did
minor optimizations (std::vector::reserve).
2015-11-18 22:25:02 +09:00
Tatsuhiro Tsujikawa 79ee999f1b Update mruby to 1.2.0 2015-11-17 23:23:53 +09:00
Tatsuhiro Tsujikawa dcf060198b Merge branch 'http2-backend-push' 2015-11-16 23:13:35 +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 b95a3c4b28 Consider to use CANCEL error code when closing streams with GOAWAY
For clients, CANCEL is more appropriate for both incoming/outgoing
streams.  For servers, CANCEL is appropriate for its pushed stream
(outgoing), but REFUSED_STREAM is more appropriate for incoming
stream.
2015-11-16 22:53:31 +09:00
Tatsuhiro Tsujikawa b918f9650a Don't send push response if GOAWAY has been received 2015-11-16 22:47:12 +09:00
Tatsuhiro Tsujikawa 7463493259 Use error code CANCEL to reset pushed reserved stream from remote 2015-11-16 22:20:27 +09:00
Tatsuhiro Tsujikawa c3459c9e86 nghttpx: Clarify return value of nghttp2_submit_push_promise is stream ID 2015-11-16 21:44:36 +09:00
Tatsuhiro Tsujikawa fe8720341d nghttpx: Fix crash on non-final response from backend server 2015-11-13 23:59:36 +09:00
Tatsuhiro Tsujikawa c6ef1c02b9 Switch to clang-format-3.6 2015-11-13 00:53:29 +09:00
Tatsuhiro Tsujikawa 7c613386db Update man pages 2015-11-12 23:14:45 +09:00
Tatsuhiro Tsujikawa a13c5a6bfb Merge branch 'syohex-misspelling' 2015-11-09 21:46:26 +09:00
Tatsuhiro Tsujikawa c711a80411 src: Fix typo
Apply typo fixes to the original source files in the previous commit
which were done in generated text.
2015-11-09 21:43:25 +09:00
Tatsuhiro Tsujikawa 7e8dc73f2f Merge branch 'misspelling' of https://github.com/syohex/nghttp2 into syohex-misspelling 2015-11-09 21:40:56 +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
Syohei YOSHIDA a93e0016ff Correct misspellings 2015-11-09 11:40:35 +09:00
Tatsuhiro Tsujikawa 9b18e47671 nghttpx: Use --backend-tls-sni-field to verify certificate hostname 2015-11-08 00:22:44 +09:00
Tatsuhiro Tsujikawa aecddc2cda Merge pull request #418 from thinred/pr-apparmor
added apparmor profile
2015-11-07 22:59:43 +09:00
Tatsuhiro Tsujikawa b89f1f5869 asio: ALPN support 2015-11-07 22:53:25 +09:00
Tomasz Buchert a4012b594b added apparmor profile 2015-11-07 12:45:57 +01:00
Tatsuhiro Tsujikawa ab1f70dcd7 Merge branch 'upgrade2' 2015-11-07 16:13:20 +09:00
Tatsuhiro Tsujikawa eaefce3792 nghttp: Record request method to output it in har correctly 2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa 558934cee5 src: Use nghttp2_session_upgrade2 2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa 269a100081 Add nghttp2_session_upgrade2(), deprecate nghttp2_session_upgrade()
To validate actual response body length against the value declared in
content-length response header field, we first check request method.
If request method is HEAD, respose body must be 0 regardless of the
value in content-length.  nghttp2_session_upgrade() has no parameter
to indicate the request method is HEAD, so we failed to validate
response body if HEAD is used with HTTP Upgrade.  New
nghttp2_session_upgrade2() accepts new parameter to indicate that
request method is HEAD or not to fix this issue.  Although, this issue
affects client side only, we deprecate nghttp2_session_upgrade() in
favor of nghttp2_session_upgrade2() for both client and server side.
2015-11-07 16:13:06 +09:00
Tatsuhiro Tsujikawa af4c3cb2cf Fix travis gcc build 2015-11-07 11:34:05 +09:00
Tatsuhiro Tsujikawa 6958d0b55d nghttp: Use method given in -H with ":method" in HTTP Upgrade 2015-11-07 11:14:28 +09:00
Tatsuhiro Tsujikawa 5e7e479c6c Workaround HTTP upgrade with HEAD request
By default, we check the length of response body matches
content-length.  For HEAD request, this is not necessarily true, so we
sniff request method, and if it is HEAD, make sure that response body
length is 0.  But this does not work for HTTP Upgrade, since
nghttp2_session_upgrade() has no parameter to tell the request method
was HEAD.  This commit disables this response body length validation
for the stream upgraded by HTTP Upgrade.  We will add new version of
nghttp2_session_upgrade with the parameter to pass the request method
information so that we can handle this situation properly.
2015-11-07 10:56:40 +09:00
Tatsuhiro Tsujikawa dfbbb08124 Silence warning with scan-build 2015-11-06 20:07:40 +09:00
Tatsuhiro Tsujikawa 7755c2827c nghttpx: Reserve headers vector 2015-11-05 23:47:22 +09:00
Tatsuhiro Tsujikawa ac41946533 nghttpx: Use NGHTTP2_NV_FLAG_NO_COPY_NAME and NGHTTP2_NV_FLAG_NO_COPY_VALUE
For both HTTP/2 frontend and backend.

Also adds http2::stringify_status to optimize status code
serialization.
2015-11-05 23:47:11 +09:00
Tatsuhiro Tsujikawa 43b230685f Introduce NGHTTP2_NV_FLAG_NO_COPY_NAME and NGHTTP2_NV_FLAG_NO_COPY_VALUE 2015-11-05 22:48:30 +09:00
Tatsuhiro Tsujikawa cb73fa1d3b h2load: Return SSL_TLSEXT_ERR_NOACK if there is protocol list overlap in NPN 2015-11-05 21:26:38 +09:00
Tatsuhiro Tsujikawa 0dc7fee713 h2load: Print "space savings" to measure header compression efficiency 2015-11-04 01:04:56 +09:00
Tatsuhiro Tsujikawa 58d636abdb Revert 918f8cca36
For first scheduling, we might ignore weight.  This is OK since weight
is just a distribution of resource, rather than strict priority
ordering.
2015-11-02 23:38:29 +09:00
Tatsuhiro Tsujikawa be0d0e2995 Rename nghttp2_session_request_allowed as nghttp2_session_check_request_allowed 2015-10-30 22:48:27 +09:00
Tatsuhiro Tsujikawa 6ff9c4d8f9 Update doc
With 4825009e42, static lib is no longer
required for unit tests.
2015-10-29 23:13:11 +09:00
Tatsuhiro Tsujikawa 1e7f0d833e nghttpd: Don't show read error if mime types file is not set by user manually 2015-10-29 23:08:52 +09:00