Commit Graph

1491 Commits

Author SHA1 Message Date
Tatsuhiro Tsujikawa d88f962565 Add test for altsvc frame 2016-04-09 22:32:48 +09:00
Tatsuhiro Tsujikawa 3086d65657 altsvc: Update doc 2016-04-09 19:27:09 +09:00
Tatsuhiro Tsujikawa d4144a7475 altsvc: Add tests, ignore altsvc if stream does not exist 2016-04-09 19:14:15 +09:00
Tatsuhiro Tsujikawa 6638ca9333 altsvc: Reduce bitfield size 2016-04-09 18:23:15 +09:00
Tatsuhiro Tsujikawa b924ef5fff altsvc: Discard altsvc when it is received by server in earlier point 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa df56f55f84 Assign nghttp2_frame.ext.payload early 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa 31595c2416 Embed nghttp2_ext_frame_payload into nghttp2_outbound_item 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa 795ee8c20f altsvc: Receive ALTSVC frame 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa efbd48b122 altsvc: Add tx tests 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa 8b5a85ae1d altsvc: Add error handling about origin and stream_id 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa ecabef2dc7 altsvc: Add ALTSVC frame support 2016-04-08 23:25:56 +09:00
Tatsuhiro Tsujikawa 5974abad75 Run error callback when peer does not send initial SETTINGS frame 2016-04-02 18:20:49 +09:00
Tatsuhiro Tsujikawa 8667bbb823 Don't send WINDOW_UPDATE if session is being closed 2016-03-29 23:30:55 +09:00
Peter Wu bd253e1bdd cmake: fix Windows build with CUnit
failmalloc and main tests succesfully pass the test now.
2016-03-17 23:32:07 +01:00
Peter Wu d10f149161 cmake: fix Windows support
Fix Windows build by defining `ssize_t` when missing and adjusting the
install commands.

Add support for ENABLE_WERROR=1 while at it.

Tested with MSVC 2013 on Windows 7 x64.
2016-03-16 17:33:20 +01:00
Peter Wu 7c55c335cc Merge branches 'master' and 'cmake-updated' into cmake
Update to latest master with appropriate cmake changes at the same time.
2016-03-14 17:26:15 +01:00
Peter Wu 2ddb83206b cmake: sync with v1.8.0-63-g37b09f6
Adds missing source files and configure.ac changes since
v1.7.0-93-g093eb51.
2016-03-14 17:20:37 +01:00
Jan-E e8b62c620d Revert change of NGHTTP2_VERSION_NUM, keep the parentheses around VERSION_NUM, not in the sed -e 2016-03-14 14:13:19 +01:00
Jan-E 0f71fbce8d Generate nghttp2ver.h before compiling 2016-03-13 18:57:58 +01:00
Jan-E 4e2972a5dc Use string for NGHTTP2_VERSION_NUM, e.g 0x010800: do not add parentheses 2016-03-13 18:43:44 +01:00
Jan-E 78e5417ff2 Remove -nologo: not used in VC11/VC14, throws error in VC9 2016-03-13 18:31:14 +01:00
Jan-E 77852cf572 Use string for NGHTTP2_VERSION_NUM, e.g 0x010800 2016-03-13 18:24:32 +01:00
Jan-E fa36537f82 Detect version for releases en dev versions 2016-03-13 18:18:22 +01:00
Jan-E 4cde76c9c3 Do not use Cython by default 2016-03-13 18:13:46 +01:00
Jan-E e02512032b Fix missing external symbol nghttp2_rcbuf_new2 2016-03-13 18:12:39 +01:00
Tatsuhiro Tsujikawa e58db4f8b0 Attempt to fix compile error with msvc 2016-03-14 00:54:02 +09:00
Peter Wu 7f8110601e cmake: fix compatibility with cmake before 3.3
The COMPILE_LANGUAGE generator expression is only supported since CMake
3.3. Moreover, it does not work with all generators (works with Makefile
and Ninja, but not with Visual Studio).

target_compile_options would only work if a target does not mix C and
C++ sources, since the flags are intended to be set for a specific
language, use set_source_files_properties instead. This approach is also
less repetitive.

Drop the idea of using lists and COMPILE_OPTIONS,
set_source_files_properties only understands COMPILE_FLAGS (a single
string, not a list).
2016-03-13 12:30:41 +01:00
Tatsuhiro Tsujikawa 37b09f6785 Use %u for uint8_t for formatting 2016-03-13 18:25:30 +09:00
Tatsuhiro Tsujikawa 2a606bae4c Add nghttp2_error_callback to tell application human readable error message 2016-03-13 18:22:52 +09:00
Tatsuhiro Tsujikawa 3db9c2c796 Remove extra tokenization of header names; they are not effective at best 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 12dad32890 Add nghttp2_on_header_callback2 2016-03-12 21:13:09 +09:00
Tatsuhiro Tsujikawa 689d2a1afb Fix compile error with --enable-debug 2016-03-12 21:12:27 +09:00
Tatsuhiro Tsujikawa ff0d137fb3 Reference counted HPACK name/value pair 2016-03-12 21:12:27 +09:00
Tatsuhiro Tsujikawa 8da20975f9 Always allocate buffer for name, and value 2016-03-12 21:12:26 +09:00
Peter Wu bdb6581990 Add CMake-related files to EXTRA_DIST 2016-03-12 01:38:12 +01:00
Tatsuhiro Tsujikawa e453759637 Add nghttp2_option_set_no_auto_ping_ack() option
This option prevents the nghttp2 library from sending PING frame with
ACK flag set in the reply to incoming PING frame.  To allow the
application to send PING with ACK flag set, nghttp2_submit_ping() now
recognizes NGHTTP2_FLAG_PING in its flags parameter.
2016-02-29 23:39:50 +09:00
Tatsuhiro Tsujikawa a21c87d11c Add nghttp2_http2_strerror() to return HTTP/2 error code string 2016-02-29 23:10:20 +09:00
Tatsuhiro Tsujikawa 32446a5197 Revert "Update doc"
This reverts commit 8aac5d6af2.
2016-02-25 21:19:38 +09:00
Tatsuhiro Tsujikawa 40c1b29f36 Handle extension frame in session_inbound_frame_reset 2016-02-25 21:18:59 +09:00
Tatsuhiro Tsujikawa 8aac5d6af2 Update doc 2016-02-25 00:58:50 +09:00
Tatsuhiro Tsujikawa 56bdfd1df2 Revert "Handle extension frame in session_inbound_frame_reset"
This reverts commit dbffb8995b.
2016-02-25 00:58:24 +09:00
Tatsuhiro Tsujikawa dbffb8995b Handle extension frame in session_inbound_frame_reset 2016-02-25 00:45:24 +09:00
Tatsuhiro Tsujikawa ebfae904ab Fix typo 2016-02-25 00:32:17 +09:00
Tatsuhiro Tsujikawa 827abb57e9 Simplified bitfield calculation of extension frame 2016-02-24 23:59:01 +09:00
Tatsuhiro Tsujikawa 9aee43f7d8 Update doc for extension frames 2016-02-24 23:51:00 +09:00
Tatsuhiro Tsujikawa 34bf153653 Merge branch 'master' into simple-extensions 2016-02-24 23:21:03 +09:00
Tatsuhiro Tsujikawa 3e72711e23 Cap 100 limit for remembering idle streams 2016-02-23 01:09:45 +09:00
Tatsuhiro Tsujikawa 7921029e33 Tokenize extra HTTP header fields
The extra HTTP header fields are compiled from
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers,
https://en.wikipedia.org/wiki/List_of_HTTP_header_fields, and
https://www.owasp.org/index.php/List_of_useful_HTTP_headers.
2016-02-20 23:30:02 +09:00
Tatsuhiro Tsujikawa b7159f80b2 Eliminate the possibility of nghttp2_stream.cycle overflow 2016-02-18 23:56:29 +09:00
Peter Wu 77e8190b6c cmake: fix symbol visibility issues
libnghttp2.so was missing -fvisibility=hidden. libnghttp2_asio.so on the
other hand had hidden visibility which resulted in no exported symbols
and a broken asio client examples.

Just build a static nghttp2 library to solve this issue.
2016-02-16 16:04:01 +01:00
Peter Wu 0afc21c9d8 cmake: fix compilation in lib
Need to add -fPIC to objects that will be put in a shared library.
2016-02-15 10:49:55 +01:00
Peter Wu 8c46d9181f cmake: process tests directory
Split the nghttp2 library into objects and a shared library from those
objects. This is needed because of symbol visibility. An advantage over
the autotools build is that there are no worries about static versus
static library builds.

Test:

    cmake $srcdir
    make nghttpx-unittest main failmalloc
    make test
2016-02-15 01:57:13 +01:00
Peter Wu ccd2d34160 cmake: Install headers 2016-02-13 20:13:42 +01:00
Peter Wu ea6eed10c7 cmake: fix version in soname 2016-02-13 20:13:42 +01:00
Peter Wu 5b21c39bb2 cmake: add lib, add versioning info, install lib
Also remove some headers which were not checked anyway and add macros to
cmakeconfig.h.in (based on the headers list in the CMakeLists.txt file).
2016-02-13 20:13:42 +01:00
Peter Wu 0e469ed221 Fix typo in HAVE_CONFIG_H name
Only used by lib/nghttp2_npn.c where the presence of config.h does not
seem to make a difference though.
2016-02-13 20:11:50 +01:00
Tatsuhiro Tsujikawa 61dda40b44 Don't pass NULL to memcpy 2016-02-12 22:31:47 +09:00
Tatsuhiro Tsujikawa 00e722f02c Add warning 2016-02-11 23:20:31 +09:00
Tatsuhiro Tsujikawa 304ff6a6f9 Don't send extension frame in closing state 2016-02-07 21:12:36 +09:00
Tatsuhiro Tsujikawa fc39f2d9d2 Merge branch 'master' into simple-extensions 2016-02-07 21:09:08 +09:00
Tatsuhiro Tsujikawa 4c05558273 Evaluate nghttp2_session_want_read and nghttp2_session_want_write when determining session is about to close 2016-02-03 00:25:11 +09:00
Reza Tavakoli 5a6f312182 Fixing window makefile version detection 2016-01-26 13:57:21 +03:30
Tatsuhiro Tsujikawa 4a78f59e7b Rename nghttp2_session.sent_stream_id as last_sent_stream_id
This is more accurate, and there is symmetric relation between
last_sent_stream_id and last_recv_stream_id, which is bettern fit in
my sense.
2016-01-23 14:47:39 +09:00
Tatsuhiro Tsujikawa 4ceb9fd767 Cancel stream if flow control window gets overflow
Previously, we did terminate session, but it did not actually cancel
streams.  Now we just cancel streams in this case.
2016-01-23 00:24:12 +09:00
Tatsuhiro Tsujikawa c7de58d865 Validate :authroity, host, and :scheme value more strictly 2016-01-16 15:11:48 +09:00
Tatsuhiro Tsujikawa 15ea11d5db Fix bug that HTTP upgrade was not working 2016-01-12 21:05:05 +09:00
Tatsuhiro Tsujikawa afc6f556d1 Update doc 2016-01-11 17:47:46 +09:00
Tatsuhiro Tsujikawa e14da859b6 Merge branch 'master' into simple-extensions 2016-01-11 16:39:35 +09:00
Tatsuhiro Tsujikawa bb6f842b37 Check request/response submission error based side of session
Disallow request from server, and response from client respectively.
When the violation is detected, return NGHTTP2_ERR_PROTO from
nghttp2_submit_request, nghttp2_submit_response,
nghttp2_submit_headers.

We also did some refactoring, and now self-dependency detection is
placed where it is only required.
2016-01-11 16:18:39 +09:00
Tatsuhiro Tsujikawa 9cea986819 Strict outgoing idle stream detection
Previously, we use session->next_stream_id to detect that given stream
ID was idle or not.  But this was suboptimal, since it was updated
when stream ID was assigned, and it did not necessarily mean that it
actually has been sent to the peer.  Now we introduced
session->sent_stream_id, which only updated when HEADERS/PUSH_PROMISE
has sent.  Using sent_stream_id instead of next_stream_id tightens
idle stream detection, and misbehaved peer which sends frame with
stream ID that has not been generated.

This commit also overhauls test code which involves opening streams.
Now we have some wrapper functions for nghttp2_session_open_stream()
which also take care of updating next_stream_id and
last_recv_stream_id.  They are crucial for some tests.
2016-01-11 00:31:52 +09:00
Tatsuhiro Tsujikawa 0caefe20ef Merge branch 'master' into simple-extensions 2016-01-09 19:08:28 +09:00
kumagi f3a37b2ef1 fix typos: heder->header alreay->already reponse->response 2016-01-05 22:19:33 +09:00
Tatsuhiro Tsujikawa 8716dd05d4 Return error from nghttp2_submit_{headers,request} when self dependency is made
Return NGHTTP2_ERR_INVALID_ARGUMENT from nghttp2_submit_headers() if
given stream ID and pri_spec->stream_id are the same (thus trying to
depend on itself).

Also return NGHTTP2_ERR_INVALID_ARGUMENT from nghttp2_submit_request()
and nghttp2_submit_headers() with stream_id == 1, when new stream ID
equals to pri_spec->stream_id.

Previously, these cases are not checked, and just sent to peer.
2015-12-25 21:37:18 +09:00
Tatsuhiro Tsujikawa 894c1bd02e Create idle stream on client side
With the presence of idle stream related API (e.g.,
nghttp2_create_idle_stream()), it is more predictable for client to
create idle streams with its dependency to another idle stream.
Previously, we didn't create complete parent idle stream in this case.
Now we create idle streams as we do on server side.
2015-12-25 00:10:37 +09:00
Tatsuhiro Tsujikawa 92a56d034f Fix bug that idle/closed stream may be destroyed while it is referenced 2015-12-23 16:38:30 +09:00
Tatsuhiro Tsujikawa ca4a40b8e0 Don't schedule response HEADERS with priority tree
Previously we scheduled the transmission of response HEADERS using
priority tree in the belief that it allows more better utilization of
bandwidth for prioritized streams.  But to reduce the overhead of
reconstruction of priority queue when connection level flow control
window is depleted, we just don't check priority tree in this case.
This means that response HEADERS frames are not sent even though they
are not flow controlled.  This could waste bandwidth.  To improve this
situation, we stop scheduling response HEADERS with priority tree for
now.  Now they are just sent in the order they submitted.  The
response body DATA continued to be scheduled with priority tree as
before.
2015-12-21 21:33:58 +09:00
Tatsuhiro Tsujikawa cb73ba948d Simplify HEADERS handling; handle push response in one function 2015-12-20 23:47:16 +09:00
Tatsuhiro Tsujikawa e957147249 Make obvious implementation error connection error 2015-12-20 23:29:24 +09:00
Tatsuhiro Tsujikawa 010726a875 Simplify error handling in nghttp2_session_on_headers_received
return session_inflate_handle_invalid_stream(...) case is for streams
for INITIAL state, but this is rare case.  In general, we'd like to
reduce RST_STREAM transmission, and it is suffice to ignore this frame
for now.
2015-12-20 23:20:14 +09:00
Tatsuhiro Tsujikawa 19146211d7 Update doc 2015-12-20 13:20:21 +09:00
Tatsuhiro Tsujikawa 9f0083309e Fix strange use of session_detect_idle_stream 2015-12-20 13:19:29 +09:00
Tatsuhiro Tsujikawa 80f7abb565 Fix crash caused by the regression in 9f8fc7b2bb 2015-12-17 22:25:28 +09:00
Tatsuhiro Tsujikawa 9f8fc7b2bb Strict error handling for frames which are not allowed after closed (remote)
This makes h2spec strict mode a bit happier.  We still one failing
test with h2spec -S (strict mode).
2015-12-17 21:31:20 +09:00
Tatsuhiro Tsujikawa 9cfda0c070 Update doc 2015-12-17 18:04:16 +09:00
Tatsuhiro Tsujikawa 228d92244a Optimize nghttp2_pq swap 2015-12-15 22:07:51 +09:00
Tatsuhiro Tsujikawa 68c5deea5a Clarify the condition when opening new stream from remote is allowed 2015-12-11 21:23:49 +09:00
Tatsuhiro Tsujikawa f14ac74316 At least check stream ID is valid when PUSH_PROMISE is received in goaway mode 2015-12-10 23:54:54 +09:00
Tatsuhiro Tsujikawa 0c70ff5658 Simplify 2015-12-10 23:18:02 +09:00
Tatsuhiro Tsujikawa 7cc2d22ab5 Fix compile error with gcc 2015-12-08 23:33:26 +09:00
Tatsuhiro Tsujikawa abcdbf0039 Take into account remainder due to integer division when calculating cycle 2015-12-08 23:15:55 +09:00
Tatsuhiro Tsujikawa 4bcc14fc67 Reschedule stream when only weight is changed
Previously, we only updated stream's weight field when only weight was
changed by PRIORITY frame.  If stream is queued, it would be better to
actually reschedule it based on new weight.  This could be especially
useful if weight is increased.
2015-12-07 23:14:22 +09:00
Tatsuhiro Tsujikawa 72f815d535 Update descendant_last_cycle on nghttp2_stream_next_outbound_item
Previously, we updated descendant_last_cycle in
nghttp2_stream_reschedule, which is called after non-zero DATA frame.
But this was not optimal since we still had old descendant_last_cycle,
and new stream was scheduled based on it.  Now descendant_last_cycle
is updated in nghttp2_stream_next_outbound_item, which is called when
stream with highest priority is selected from queue.  And new stream
is scheduled based on it.  This commit also removes 0-reset of
descendant_last_cycle and cycle in nghttp2_stream_reschedule.  This
could help making them lower, so that they are not overflow.  But
there is a pattern that it doesn't work, and we are not sure they are
really useful at this moment.
2015-12-07 22:48:50 +09:00
Tatsuhiro Tsujikawa 9c84f60ba0 Merge branch 'master' into simple-extensions 2015-12-04 23:48:40 +09:00
Tatsuhiro Tsujikawa a151a44caf Set max number of outgoing concurrent streams to 100 by default
Instead of using nonsensical large value for max outgoing concurrent
streams, use more sensible value, 100.
2015-12-03 23:45:03 +09:00
Tatsuhiro Tsujikawa 478a423bcf Reduce nghttp2_stream size 2015-12-03 22:53:02 +09:00
Tatsuhiro Tsujikawa 93d8636fb0 Keep incoming streams only at server side
We should only keep incoming closed streams because we only keep at
most max concurrent streams, which only applied to incoming streams.
2015-12-03 22:48:41 +09:00
Tatsuhiro Tsujikawa 2288ee8060 Create stream object for pushed resource during nghttp2_submit_push_promise()
Previously, stream object for pushed resource was not created during
nghttp2_submit_push_promise().  It was created just before
nghttp2_before_frame_send_callback was called for that PUSH_PROMISE
frame.  This means that application could not call
nghttp2_submit_response for the pushed resource before
nghttp2_before_frame_send_callback was called.  This could be solved
by callback chaining, but for web server with back pressure from
backend stream, it is a bit unnecessarily hard to use.

This commit changes nghttp2_submit_push_promise() behaviour so that
stream object is created during that call.  It makes application call
nghttp2_submit_response right after successful
nghttp2_submit_push_promise call.
2015-12-02 21:16:30 +09:00
Tatsuhiro Tsujikawa 2754d9e2bb Update doc 2015-11-28 15:24:13 +09:00
Tatsuhiro Tsujikawa 12b2e0a2b3 Add nghttp2_session_create_idle_stream() API
See GH-436
2015-11-28 15:23:44 +09:00
Tatsuhiro Tsujikawa aacac613af Assert dep_stream is non-null to shut up scan-build 2015-11-28 00:50:29 +09:00
Tatsuhiro Tsujikawa a70445e122 Retain stream in reserved state on client side
Application may use it using nghttp2_stream_* functions, and traverse
its dependency.
2015-11-27 22:54:55 +09:00
Tatsuhiro Tsujikawa f23e34fa3c Handle response in nghttp2_on_begin_frame_callback
Previously, nghttp2_session_end_request_headers_received assumes
stream is still writable (in other words, local endpoint has not sent
END_STREAM).  But this assumption is false, because application can
send response in nghttp2_on_begin_frame_callback.  Probably, this
assumption was made before the callback was introduced.  This commit
addresses this issue.  Since all
nghttp2_session_end_*_headers_received functions are identical, we
refactored them into one function.
2015-11-27 22:50:13 +09:00
Tatsuhiro Tsujikawa 3d1d54e2ce Remove dead code 2015-11-27 21:13:44 +09:00
Tatsuhiro Tsujikawa faad041868 Use seq to break a tie for stream weight
Because of the nature of heap based priority queue, and our compare
function, streams with the same weight and same parent are handled in
the reverse order they pushed to the queue.  To allow stream pushed
earlier to be served first, secondary key "seq" is introduced to break
a tie.  "seq" is monotonically increased integer per parent stream,
and it is assigned to stream when it is pused to the queue, and gets
incremented.
2015-11-25 22:26:56 +09:00
Tatsuhiro Tsujikawa b08d5b1975 Explicitly treat stream_id 0 as error in nghttp2_session_change_stream_priority 2015-11-24 22:34:36 +09:00
Tatsuhiro Tsujikawa b53b1381b7 Fix bug that nghttp2_session_find_stream(session, 0) returned NULL
Previously, nghttp2_session_find_stream(session, 0) returned NULL
despite the fact that documentation said that it should return root
stream.  Now it is corrected, and it returns root stream as
documented.
2015-11-24 22:30:12 +09:00
Tatsuhiro Tsujikawa 8f970dec0e Update doc 2015-11-23 21:05:25 +09:00
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 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 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 83cc2511e3 Remove flags parameter from nghttp2_pack_extension_callback
It has no usecase at the moment.  It is most likely that applications
know the flags when it submitted extension frame, no need to modify it
later.  Possibly feature bloat.
2015-11-17 21:29:21 +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 eb4e402aae Merge branch 'master' into simple-extensions 2015-11-14 22:31:52 +09:00
Tatsuhiro Tsujikawa c6ef1c02b9 Switch to clang-format-3.6 2015-11-13 00:53:29 +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 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 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 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 5d611d2e24 Merge branch 'master' into simple-extensions 2015-10-29 23:24:34 +09:00
Tatsuhiro Tsujikawa 41002a77d4 Remove bogus debug log 2015-10-29 23:01:02 +09:00
Tatsuhiro Tsujikawa 1c37abc0dd Add nghttp2_session_request_allowed() API function
This function is useful for the client application to know that there
is a chance that request can be sent.  If this function returns 0,
there is zero chance to make a request.

This commit also set error_code passed to
nghttp2_on_stream_close_callback to NGHTTP2_REFUSED_STREAM if request
is not sent.
2015-10-29 22:53:30 +09:00
Alexis La Goutte b4f363ef53 Fix Value stored to 'rv' is never read found by Clang Analyzer 2015-10-26 15:22:13 +01:00
Tatsuhiro Tsujikawa 5d3d377c03 Add missing NGHTTP2_EXTERN to public functions 2015-10-25 16:51:50 +09:00
Tatsuhiro Tsujikawa 4960583637 Increase NGHTTP2_MAX_OBQ_FLOOD_ITEM to avoid false positives 2015-10-25 16:23:29 +09:00
Tatsuhiro Tsujikawa 25bf567cd7 Don't always expect dynamic table size update
The encoder is not required to send dynamic table size update if the
table size is not changed from the previous value after accepting new
maximum value.
2015-10-24 17:49:51 +09:00
Tatsuhiro Tsujikawa 5bc3dfa1cd Shrink to the minimum table size seen in local SETTINGS 2015-10-24 17:49:50 +09:00
Tatsuhiro Tsujikawa ce74a30990 Use -fvisibility=hidden for internal functions
This will improve performance since we can avoid indirect call of
internal functions.  The downside is we now require libnghttp2 static
library to run unit tests.
2015-10-23 00:08:15 +09:00
Tatsuhiro Tsujikawa 46d7c30c17 Update doc 2015-10-21 00:18:27 +09:00
Tatsuhiro Tsujikawa 837e716306 Fix compile error with gcc 2015-10-15 00:30:42 +09:00
Tatsuhiro Tsujikawa 061a557839 Add nghttp2_option_set_user_recv_extension_type to opt-in incoming extension type 2015-10-15 00:17:07 +09:00
Tatsuhiro Tsujikawa 3785cf07ba Add simple HTTP/2 extension framework
Application can utilize this framework to send/receive user defined
extension frames.  These frames are expected not to change existing
protocol behaviour.
2015-10-11 17:46:23 +09:00
Tatsuhiro Tsujikawa 3f4b6f2b1c Clean up 2015-10-11 17:29:29 +09:00
Tatsuhiro Tsujikawa ba08948307 Merge branch 'master' of https://github.com/alagoutte/nghttp2 into alagoutte-master 2015-10-04 22:02:47 +09:00
Alexis La Goutte 81addc77b4 Add (and fix) -Wredundant-decls 2015-10-04 14:48:32 +02:00
Tatsuhiro Tsujikawa b1de6ca390 Update doc 2015-10-04 10:36:09 +09:00
Tatsuhiro Tsujikawa 45d4c9dece Add new error code NGHTTP2_ERR_PAUSE to send_data_callback
If application returns NGHTTP2_ERR_PAUSE from send_data_callback, it
means application processed all data, but wants to make
nghttp2_session_mem_send or nghttp2_session_send return immediately.
This is useful if application writes to fixed sized buffers, and there
is no room to write more data.
2015-10-03 17:16:42 +09:00
Tatsuhiro Tsujikawa cea76226b1 Avoid excessive WINDOW_UPDATE queuing 2015-10-01 01:19:57 +09:00
Tatsuhiro Tsujikawa d22ced77c0 Return fatal error if flooding is detected to close session immediately
This change adds new return error code from nghttp2_session_mem_recv
and nghttp2_session_recv functions, namely NGHTTP2_ERR_FLOODED.  It is
fatal error, and is returned when flooding was detected.
2015-09-30 22:19:03 +09:00
Tatsuhiro Tsujikawa 0cb8c82125 Detect flooding and tear down session 2015-09-30 00:44:08 +09:00
Tatsuhiro Tsujikawa ad5d73738c Return type of nghttp2_submit_trailer is int 2015-09-29 00:06:20 +09:00
Tatsuhiro Tsujikawa ef3e2c7764 Don't send WINDOW_UPDATE with 0 increment 2015-09-27 00:22:33 +09:00
Tatsuhiro Tsujikawa b5427d9651 Remove unused nghttp2_memdup 2015-09-26 22:44:08 +09:00
Tatsuhiro Tsujikawa 2d5b42693d Don't expect NULL terminated name/value in nghttp2_hd_deflate_hd
If it is called through libnghttp2 internally, name/value pairs are
all NULL-terminated.  But it is one of public API, and we cannot
expect that applications always make NULL-terminated string for
name/value pairs.
2015-09-26 22:41:05 +09:00
Tatsuhiro Tsujikawa 637288359e Ignore 0 length header partial block if it is not final 2015-09-25 22:53:35 +09:00
Tatsuhiro Tsujikawa 93ba75b602 Fix bug that headers in CONTINUATION were ignored after HEADERS with padding 2015-09-25 22:28:03 +09:00
Tatsuhiro Tsujikawa 1f72648b0e Fix compile error with --enable-debug and --enable-werror 2015-09-25 22:19:18 +09:00
Tatsuhiro Tsujikawa d804780c25 Fix compile error with Android NDK and --enable-werror 2015-09-25 01:45:28 +09:00
Tatsuhiro Tsujikawa 913b95336b Fix warning 'this decimal constant is unsigned only in ISO C90' 2015-09-25 00:03:38 +09:00
Tatsuhiro Tsujikawa 170f2a144a Fix warning with gcc 2015-09-23 18:26:02 +09:00
Tatsuhiro Tsujikawa 28fe3e7e89 More warning flags for --enable-werror 2015-09-23 16:49:45 +09:00
Tatsuhiro Tsujikawa 230b1f927f Use hash table for dynamic table lookup 2015-09-19 21:29:40 +09:00
Tatsuhiro Tsujikawa eacd6eeed2 Check header block limit after new stream is opened 2015-09-16 00:40:31 +09:00
Tatsuhiro Tsujikawa 991352d201 Just assign stream->cycle to descendant_last_cycle 2015-09-14 22:20:08 +09:00
Tatsuhiro Tsujikawa 1bbef4be74 Avoid usage of typeof and replace __builtin_offsetof with offsetof 2015-09-10 21:27:14 +09:00
Tatsuhiro Tsujikawa 918f8cca36 Honor stream->weight even if stream->last_writelen is 0 2015-09-09 21:20:59 +09:00
Tatsuhiro Tsujikawa 22b39f0337 Revert "last_write_len must not be 0, which makes weight useless"
This reverts commit e260006182.
2015-09-09 21:16:53 +09:00
Tatsuhiro Tsujikawa e260006182 last_write_len must not be 0, which makes weight useless 2015-09-08 02:27:59 +09:00
Tatsuhiro Tsujikawa 4cad48da16 Reset cycle to 0 if stream has only 1 direct descendant 2015-08-29 23:44:58 +09:00
Tatsuhiro Tsujikawa 928a81885c Limit the number of incoming reserved (remote) streams
RFC 7540 does not enforce any limit on the number of incoming reserved
streams (in RFC 7540 terms, streams in reserved (remote) state).  This
only affects client side, since only server can push streams.
Malicious server can push arbitrary number of streams, and make
client's memory exhausted.  The new option,
nghttp2_set_max_reserved_remote_streams, can set the maximum number of
such incoming streams to avoid possible memory exhaustion.  If this
option is set, and pushed streams are automatically closed on
reception, without calling user provided callback, if they exceed the
given limit.  The default value is 200.  If session is configured as
server side, this option has no effect.  Server can control the number
of streams to push.
2015-08-23 21:43:41 +09:00
Tatsuhiro Tsujikawa 647e30619f Remove nghttp2_pq_increase_key 2015-08-21 23:35:17 +09:00
Tatsuhiro Tsujikawa 059280d1a5 Add stream public API
The intention of this stream API is give server application about
stream dependency information, so that it can utilize it for better
scheduling of stream processing.  We have no plan to add object
oriented API based on stream object.
2015-08-19 23:04:06 +09:00
Tatsuhiro Tsujikawa 2e643424ac Remove unused nghttp2_stream_roots declaration 2015-08-18 22:38:28 +09:00
Tatsuhiro Tsujikawa 71623b674e Optimize pq 2015-08-18 00:26:20 +09:00
Tatsuhiro Tsujikawa 6a511aef0a Use remove/push combination instead of <= for performance 2015-08-18 00:21:42 +09:00
Tatsuhiro Tsujikawa 5b59e46e2b Rewrite priority handling
We now use priority queue per stream, which contains the stream which
has ready to send a frame, or one of its descendants have a frame to
send.  We maintain invariant that if a stream is queued, then its
ancestors are also queued (except for root).  When we re-schedule
stream after transmission, we re-schedule all ancestors, so that
streams on the other path can get a chance to send.  This is basically
the same mechanism h2o project uses, but there are differences in the
details.
2015-08-17 22:35:50 +09:00
Tatsuhiro Tsujikawa 73b77964ef Reset last_cycle to 0 if queue gets empty 2015-08-15 01:08:20 +09:00
Tatsuhiro Tsujikawa d1e49a196d Remove restriction in regard to number of stream in dependency tree
Previously, the number of stream in one dependency tree (not including
root) is limited to 120.  This is due to the fact that we use
recursive calls to traverse trees.  Now we replaced recursive calls
with loop, we can remove this limitation.  Also now all streams are
descendant of root stream, rather than linked list of individual
subtree root.
2015-08-15 00:53:09 +09:00
Tatsuhiro Tsujikawa f7fa9eb21b Fix sum_norest_weight calculation bug in stream dependency tree 2015-08-14 01:27:50 +09:00
Tatsuhiro Tsujikawa 3e53cd189c clang-format-3.5 2015-08-08 23:36:02 +09:00
Tatsuhiro Tsujikawa e66bd490a4 Fix crash if response or data is submitted to closing stream 2015-07-31 21:11:16 +09:00
Tatsuhiro Tsujikawa 8c701bb139 Header table size UINT32_MAX must be accepted 2015-07-30 21:19:46 +09:00
Tatsuhiro Tsujikawa aa012f7a58 Use PROTOCOL_ERROR against DATA sent to idle stream 2015-07-23 02:02:27 +09:00
Tatsuhiro Tsujikawa 7f71fed963 Allow multiple in-flight SETTINGS 2015-07-23 00:36:00 +09:00
Tatsuhiro Tsujikawa f3288092e8 Strictly check occurrence of dynamic table size update
RFC 7541 requires that dynamic table size update must occur at the
beginning of the first header block, and is signaled as SETTINGS
acknowledgement.  This commit checks these conditions.  If dynamic
table size update appears other than the beginning of the first header
block, it is treated as error.  If SETTINGS ACK is received, and next
HEADERS header block does not have dynamic table size update, it is
treated as error.
2015-07-22 00:11:23 +09:00
Tatsuhiro Tsujikawa c70cfe64c4 Fix DATA is not consumed if nghttp2_http_on_data_chunk failed
This commit fixes the bug that DATA is not consumed if
nghttp2_http_on_data_chunk is failed.  It also simplify the handling
of missing stream in NGHTTP2_IB_READ_DATA state.
2015-07-08 22:56:39 +09:00
Tatsuhiro Tsujikawa 693fba3b64 Add more docs about NGHTTP2_ERR_DATA_EXIST and its condition
This commit documents NGHTTP2_ERR_DATA_EXIST also occurs if HEADERS
has been already attached to stream too.  This commit also fixes
possible assertion error, and now nghttp2_submit_headers() and
nghttp2_submit_response() may return NGHTTP2_ERR_DATA_EXIST.  But we
recommend to use nghttp2_submit_request() and
nghttp2_submit_response(), and using them will avoid this error.
2015-07-08 00:35:07 +09:00
Gabi Davar 1dd3564d15 one more. 2015-07-05 18:01:13 +03:00
Gabi Davar e3fd81995b remove redundant function decorators. 2015-07-05 07:09:27 +03:00
Gabi Davar d4e1b63c19 msvc build fixes and enchantments.
* fix build broken by recent changes
* place all build artifacts to OBJDIR
* explicitly add manifest (VC9/10)
* modernize python bindings creation
* some minor refactoring
2015-07-04 23:12:55 +03:00
Tatsuhiro Tsujikawa 3973d9ce12 Fix typo 2015-07-04 16:02:28 +09:00
Tatsuhiro Tsujikawa 9e82687cbe Fix compile error with --enable-werror 2015-06-26 23:21:01 +09:00
Tatsuhiro Tsujikawa 660f90e13f Add switch STREAM_DEP_DEBUG to enable runtime validation of depedency tree 2015-06-26 23:02:18 +09:00
Tatsuhiro Tsujikawa 2eec42df39 Merge branch 'master' of https://github.com/tatsuhiro-t/nghttp2 2015-06-26 00:03:04 +09:00
Tatsuhiro Tsujikawa bab99af565 Fix unusual control flow in stream_update_dep_set_rest 2015-06-25 22:31:15 +09:00
Anders Bakken 2e8e38ec35 Fix typo 2015-06-24 13:56:50 -07:00
Tatsuhiro Tsujikawa d6ca95a0c9 Fix sibling's item is not queued when ancestor's item is detached 2015-06-24 22:18:07 +09:00
Tatsuhiro Tsujikawa 1945d0f02a Fix assertion failure in nghttp2_stream.c
This is regression introduced in
46b70c1db8.
2015-06-23 23:04:53 +09:00
Tatsuhiro Tsujikawa 2224b98c9c Remove duplicated dependency validation in nghttp2_session_reprioritize_stream 2015-06-21 16:31:30 +09:00
Tatsuhiro Tsujikawa a7031da364 Fix bug that idle self-depending PRIORITY is not handled gracefully
Previously, we did not handle PRIORITY frame which depends on itself
and for idle stream.  As a result, nghttp2_session_mem_recv (or
nghttp2_session_recv) returne NGHTTP2_ERR_NOMEM.  The error code was
still misleading.  It was not out of memory, and we failed to insert
hash map because of duplicated key, which was treated as out of
memory.  This commit fixes this issue, by explicitly checking
dependency for incoming PRIORITY for all cases.
2015-06-21 16:02:32 +09:00
Tatsuhiro Tsujikawa 46b70c1db8 Optimize dependency based priority code to Firefox style tree
While this commit optimizes dependency routine to Firefox style tree,
the other use cases (e.g., linear chain) are also improved
dramatically as well.
2015-06-20 22:11:24 +09:00
Tatsuhiro Tsujikawa b5717cd288 Fix bug that data are not consumed for connection in race condition
When we know that stream is closed at time we read DATA frame header,
we use NGHTTP2_IB_IGN_DATA, and consume data for connection if
nghttp2_option_set_no_auto_window_update() is used.  However, if
stream is closed while we are in NGHTTP2_IB_READ_DATA, those bytes are
not consumed for connection, nor notified to application via callback,
so it eventually fills up connection window and connection will
freeze.  This commit fixes this issue by consuming these data for
connection when stream is closed or does not exist.
2015-06-11 23:34:30 +09:00
Tatsuhiro Tsujikawa 43b3640836 Slight code cleanup 2015-06-05 22:06:49 +09:00
Tatsuhiro Tsujikawa 708eb2a217 Increase maximum number of streams in one dep tree including idle nodes 2015-06-05 22:06:14 +09:00
Tatsuhiro Tsujikawa 1f7e6ea3fe Define NGHTTP2_EXTERN to __declspec(dllimport) when using nghttp2
The private global variable nghttp2_enable_strict_preface is also
marked as NGHTTP2_EXTERN, but it is test purpose only (test with
.dll), and not part of public API.  It could be removed in the future
release.
2015-05-28 22:36:43 +09:00
Tatsuhiro Tsujikawa f0379aa428 Fix invalid memory free 2015-05-22 23:36:34 +09:00
Tatsuhiro Tsujikawa 1ddff5bbf9 Include stdint.h instead of inttypes.h when compiled with MSVC < 2013 2015-05-20 22:33:57 +09:00
Tatsuhiro Tsujikawa 3a4c8bc8f1 Document about small write 2015-05-19 22:56:23 +09:00
Tatsuhiro Tsujikawa 0b27f005e0 Merge branch 'master' into v1.0.0
Conflicts:
	src/HttpServer.cc
2015-05-15 23:24:19 +09:00
Etienne Cimon 32603d7eff Access violation in buffers
When adding a large amount of data that spans to multiple chunks, the pointer is incremented by the wrong value.
2015-05-14 10:45:17 -04:00
Tatsuhiro Tsujikawa 53bfc70c9e Include inttypes.h (or cintypes for C++) instead of stdint.h
From autoconf manual, section 5.6.1 Portability of Headers, says:

"""
The C99 standard says that inttypes.h includes stdint.h, so there's no
need to include stdint.h separately in a standard environment. Some
implementations have inttypes.h but not stdint.h (e.g., Solaris 7),
but we don't know of any implementation that has stdint.h but not
inttypes.h.
"""
2015-05-14 00:17:45 +09:00
Tatsuhiro Tsujikawa a8625e15f0 clang-format 2015-05-08 19:24:17 +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
Alexis La Goutte 1241c951d6 rv is only used in an assert.
The assert only evaluates to code if NDEBUG is undefined. Protect rv and its use accordingly

Issue reported by Joerg Mayer
https://code.wireshark.org/review/8260
2015-05-07 15:20:24 +02:00
Tatsuhiro Tsujikawa 73e79130d1 Update doc 2015-05-07 21:14:21 +09:00
Tatsuhiro Tsujikawa fc17c0a618 Fix global-buffer-overflow 2015-05-07 19:37:43 +09:00
Alexis La Goutte a62778d6b0 fix comma at end of enumerator list [-Wpedantic] 2015-04-30 07:49:55 +02:00
Tatsuhiro Tsujikawa f9a50333d2 Fix doc for nghttp2_select_next_protocol
We have to return this error code to notify OpenSSL that we have not
filled any values in |*out| and |*outlen|.
2015-04-28 23:12:27 +09:00
Tatsuhiro Tsujikawa 1c4df1832b Update doc, mainly for RFC numbers 2015-04-28 23:05:00 +09:00
Tatsuhiro Tsujikawa 1ad1fe6005 Merge branch 'master' into v1.0.0 2015-04-28 22:48:34 +09:00
Tatsuhiro Tsujikawa 9e1b068a4b Fix bug that promised stream was not reset on decompression error 2015-04-28 21:38:52 +09:00
Tatsuhiro Tsujikawa 42b2430fe1 Remove unnecessary assignment to item->cycle 2015-04-26 22:32:54 +09:00
Tatsuhiro Tsujikawa c8f67788e0 Remove unused local variable 2015-04-26 19:47:14 +09:00
Tatsuhiro Tsujikawa bbdff112a3 Make huffman decoding slightly faster using evil looking macro 2015-04-26 19:39:33 +09:00
Tatsuhiro Tsujikawa 02468b1ca1 Allocate field name and value in the same buffer if indname to dynamic table 2015-04-26 18:43:24 +09:00
Tatsuhiro Tsujikawa c41f413978 Fix compile error with --enable-werror 2015-04-25 02:23:01 +09:00
Tatsuhiro Tsujikawa e38dd37667 Update doc 2015-04-25 01:00:02 +09:00
Tatsuhiro Tsujikawa f2cf2b625c Replace priority queue with linear queue where possible
After reviewing codebase, only queue for DATA frames requires
priorities.  Other frames can be replaced multiple linear queues.
Replacing priority queue with linear queue allows us to simplify
codebase a bit; for example, now nghttp2_session.next_seq is gone.
2015-04-25 00:56:46 +09:00
Tatsuhiro Tsujikawa db4a68454a Merge branch 'master' into v1.0.0
Conflicts:
	lib/includes/nghttp2/nghttp2.h
2015-04-24 00:13:15 +09:00
Tatsuhiro Tsujikawa 6b0b8ea7d5 Update doc 2015-04-24 00:05:10 +09:00
Tatsuhiro Tsujikawa c925c32233 Fix bug that promised stream is not reset on temporal failure from on_header_callback 2015-04-23 23:57:39 +09:00
Tatsuhiro Tsujikawa 514558afc0 Allow NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE from nghttp2_on_begin_headers_callback
Since application most likely allocates the stream object in
nghttp2_on_begin_headers_callback, it is desirable to handle its
failure as stream error.  But previously it only signals success or
fatal error.  Submitting RST_STREAM does not prevent
nghttp2_on_header_callback from being invoked.  This commit improves
this situation by allowing NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE from
nghttp2_on_begin_headers_callback.  If that value is returned, library
submits RST_STREAM with error code INTERNAL_ERROR, and
nghttp2_on_header_callback and nghttp2_on_frame_recv_callback for that
frame are not invoked.  Note that for PUSH_PROMISE frame, the stream
to be reset is promised stream.
2015-04-23 23:43:30 +09:00
Tatsuhiro Tsujikawa b9f602b9a2 Update doc 2015-04-23 21:14:09 +09:00
Tatsuhiro Tsujikawa 58b7f4a096 Fix inline error with travis gcc-4.8 2015-04-22 23:59:23 +09:00
Tatsuhiro Tsujikawa 5937b4b6f7 Merge branch 'master' into v1.0.0 2015-04-19 23:13:38 +09:00
Tatsuhiro Tsujikawa 91ad7e150e Never indexing still can use header field name in dynamic table 2015-04-19 18:21:26 +09:00
Tatsuhiro Tsujikawa 85671a69bf Update doc 2015-04-18 16:49:34 +09:00
Tatsuhiro Tsujikawa a3fa257473 Fix compile error with Android NDK r10d + --enable-werror 2015-04-17 23:46:19 +09:00
Tatsuhiro Tsujikawa 1a12a9b397 Penalize cycle according to effective weight 2015-04-17 21:17:22 +09:00
Tatsuhiro Tsujikawa 57644e0256 Effectively revert 03c4092862
This is not mandated by spec.  Also it may work badly with Firefox
style dependency tree usage.
2015-04-17 21:04:17 +09:00
Tatsuhiro Tsujikawa 7323d4c639 Fix bug that nghttp2_session_set_next_stream_id accepts invalid stream_id 2015-04-17 00:12:47 +09:00
Tatsuhiro Tsujikawa e6ad2eb14f We can assert this 2015-04-16 22:58:25 +09:00
Tatsuhiro Tsujikawa d4a22edeb3 Don't do fancy stuff yet 2015-04-16 22:58:25 +09:00
Tatsuhiro Tsujikawa 1a8da6caec Update doc 2015-04-16 21:40:39 +09:00
Tatsuhiro Tsujikawa dc335b9025 Improve weight handling a bit 2015-04-16 21:38:13 +09:00
Tatsuhiro Tsujikawa 93afbc7d2f Rewrite static header table handling
We rewrite static header table handling in nghttp2_hd.c.  We expand
nghttp2_token to include all static header table entries, and fully
use them in header compression and decompression.  The lookup function
is now located in nghttp2_hd.c.  We add new nghttp2_hd_inflate_hd2()
function to export token value for header name, then we pass it to
nghttp2_http_on_header function, so that we don't have to look up
token there.  We carefully set enum value of token to static table
index, so looking up static table is now O(1), assuming we have token.
2015-04-15 23:58:56 +09:00
Tatsuhiro Tsujikawa 82e2c5bd22 Never index authorization and small cookie header field
nghttp2 library now use Literal Header Field never Indexed for
"authorization" header field and small "cookie" header field,
regardless of nghttp2_nv.flags.
2015-04-15 23:58:56 +09:00
Alexis La Goutte 5c42687759 fix comma at end of enumerator list [-Wpedantic] 2015-04-09 15:44:36 +02:00
Tatsuhiro Tsujikawa cf0576253f Merge branch 'master' into v1.0.0 2015-04-08 18:10:04 +09:00
Tatsuhiro Tsujikawa b2bb6f1db1 Fix android NDK build error 2015-04-07 21:25:05 +09:00
Tatsuhiro Tsujikawa d56ecd7414 Add nghttp2_session_consume_{connection,stream} to consume bytes independently
The existing nghttp2_session_consume() affects both connection and
stream level flow control windows.  The new functions only affects
either connection or stream.  There is some interesting use cases.
For example, we may want to pause a stream by not sending
WINDOW_UPDATE, meanwhile we want to continue to process other streams.
In this case, we use nghttp2_session_consume_connection() to tell
library that only connection level window is recovered.  The relevant
discussion: https://code.google.com/p/chromium/issues/detail?id=473259
2015-04-07 00:14:18 +09:00
Tatsuhiro Tsujikawa ef4e39be55 Update doc 2015-04-06 23:57:48 +09:00
Tatsuhiro Tsujikawa 3e50ef439d Announce h2, final HTTP/2 ALPN identifier 2015-04-05 23:15:20 +09:00
Tatsuhiro Tsujikawa 87602e5d72 Use NGHTTP2_PROTOCOL_ERROR for NGHTTP2_ERR_HTTP_{HEADER,MESSAGING} 2015-04-05 23:15:20 +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