Replace HTTP/2.0 with HTTP/2
This commit is contained in:
parent
705051ceb7
commit
ab2dc5967d
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
62
README.rst
62
README.rst
|
@ -1,8 +1,8 @@
|
||||||
nghttp2 - HTTP/2.0 C Library
|
nghttp2 - HTTP/2 C Library
|
||||||
============================
|
============================
|
||||||
|
|
||||||
This is an experimental implementation of Hypertext Transfer Protocol
|
This is an experimental implementation of Hypertext Transfer Protocol
|
||||||
version 2.0.
|
version 2.
|
||||||
|
|
||||||
Development Status
|
Development Status
|
||||||
------------------
|
------------------
|
||||||
|
@ -150,12 +150,12 @@ http://tatsuhiro-t.github.io/nghttp2/
|
||||||
Client, Server and Proxy programs
|
Client, Server and Proxy programs
|
||||||
---------------------------------
|
---------------------------------
|
||||||
|
|
||||||
The src directory contains HTTP/2.0 client, server and proxy programs.
|
The src directory contains HTTP/2 client, server and proxy programs.
|
||||||
|
|
||||||
nghttp - client
|
nghttp - client
|
||||||
+++++++++++++++
|
+++++++++++++++
|
||||||
|
|
||||||
``nghttp`` is a HTTP/2.0 client. It can connect to the HTTP/2.0 server
|
``nghttp`` is a HTTP/2 client. It can connect to the HTTP/2 server
|
||||||
with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension.
|
with prior knowledge, HTTP Upgrade and NPN/ALPN TLS extension.
|
||||||
|
|
||||||
It has verbose output mode for framing information. Here is sample
|
It has verbose output mode for framing information. Here is sample
|
||||||
|
@ -279,8 +279,8 @@ nghttpd - server
|
||||||
By default, it uses SSL/TLS connection. Use ``--no-tls`` option to
|
By default, it uses SSL/TLS connection. Use ``--no-tls`` option to
|
||||||
disable it.
|
disable it.
|
||||||
|
|
||||||
``nghttpd`` only accepts the HTTP/2.0 connection via NPN/ALPN or direct
|
``nghttpd`` only accepts the HTTP/2 connection via NPN/ALPN or direct
|
||||||
HTTP/2.0 connection. No HTTP Upgrade is supported.
|
HTTP/2 connection. No HTTP Upgrade is supported.
|
||||||
|
|
||||||
``-p`` option allows users to configure server push.
|
``-p`` option allows users to configure server push.
|
||||||
|
|
||||||
|
@ -338,15 +338,15 @@ nghttpx - proxy
|
||||||
``nghttpx`` is a multi-threaded reverse proxy for
|
``nghttpx`` is a multi-threaded reverse proxy for
|
||||||
h2-10, SPDY and HTTP/1.1. It has several operation modes:
|
h2-10, SPDY and HTTP/1.1. It has several operation modes:
|
||||||
|
|
||||||
================== ============================== ============== =============
|
================== ============================ ============== =============
|
||||||
Mode option Frontend Backend Note
|
Mode option Frontend Backend Note
|
||||||
================== ============================== ============== =============
|
================== ============================ ============== =============
|
||||||
default mode HTTP/2.0, SPDY, HTTP/1.1 (TLS) HTTP/1.1 Reverse proxy
|
default mode HTTP/2, SPDY, HTTP/1.1 (TLS) HTTP/1.1 Reverse proxy
|
||||||
``--http2-proxy`` HTTP/2.0, SPDY, HTTP/1.1 (TLS) HTTP/1.1 SPDY proxy
|
``--http2-proxy`` HTTP/2, SPDY, HTTP/1.1 (TLS) HTTP/1.1 SPDY proxy
|
||||||
``--http2-bridge`` HTTP/2.0, SPDY, HTTP/1.1 (TLS) HTTP/2.0 (TLS)
|
``--http2-bridge`` HTTP/2, SPDY, HTTP/1.1 (TLS) HTTP/2 (TLS)
|
||||||
``--client`` HTTP/2.0, HTTP/1.1 HTTP/2.0 (TLS)
|
``--client`` HTTP/2, HTTP/1.1 HTTP/2 (TLS)
|
||||||
``--client-proxy`` HTTP/2.0, HTTP/1.1 HTTP/2.0 (TLS) Forward proxy
|
``--client-proxy`` HTTP/2, HTTP/1.1 HTTP/2 (TLS) Forward proxy
|
||||||
================== ============================== ============== =============
|
================== ============================ ============== =============
|
||||||
|
|
||||||
The interesting mode at the moment is the default mode. It works like
|
The interesting mode at the moment is the default mode. It works like
|
||||||
a reverse proxy and listens for h2-10, SPDY and HTTP/1.1 and
|
a reverse proxy and listens for h2-10, SPDY and HTTP/1.1 and
|
||||||
|
@ -356,7 +356,7 @@ The default mode, ``--http2-proxy`` and ``--http2-bridge`` modes use
|
||||||
SSL/TLS in the frontend connection by default. To disable SSL/TLS, use
|
SSL/TLS in the frontend connection by default. To disable SSL/TLS, use
|
||||||
``--frontend-no-tls`` option. If that option is used, SPDY is disabled
|
``--frontend-no-tls`` option. If that option is used, SPDY is disabled
|
||||||
in the frontend and incoming HTTP/1.1 connection can be upgraded to
|
in the frontend and incoming HTTP/1.1 connection can be upgraded to
|
||||||
HTTP/2.0 through HTTP Upgrade.
|
HTTP/2 through HTTP Upgrade.
|
||||||
|
|
||||||
The ``--http2-bridge``, ``--client`` and ``--client-proxy`` modes use
|
The ``--http2-bridge``, ``--client`` and ``--client-proxy`` modes use
|
||||||
SSL/TLS in the backend connection by deafult. To disable SSL/TLS, use
|
SSL/TLS in the backend connection by deafult. To disable SSL/TLS, use
|
||||||
|
@ -371,13 +371,13 @@ In the default mode, (without any of ``--http2-proxy``,
|
||||||
``--http2-bridge``, ``--client-proxy`` and ``--client`` options),
|
``--http2-bridge``, ``--client-proxy`` and ``--client`` options),
|
||||||
``nghttpx`` works as reverse proxy to the backend server::
|
``nghttpx`` works as reverse proxy to the backend server::
|
||||||
|
|
||||||
Client <-- (HTTP/2.0, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Web Server
|
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Web Server
|
||||||
[reverse proxy]
|
[reverse proxy]
|
||||||
|
|
||||||
With ``--http2-proxy`` option, it works as so called secure proxy (aka
|
With ``--http2-proxy`` option, it works as so called secure proxy (aka
|
||||||
SPDY proxy)::
|
SPDY proxy)::
|
||||||
|
|
||||||
Client <-- (HTTP/2.0, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Proxy
|
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/1.1) --> Proxy
|
||||||
[secure proxy] (e.g., Squid)
|
[secure proxy] (e.g., Squid)
|
||||||
|
|
||||||
The ``Client`` in the above is needs to be configured to use
|
The ``Client`` in the above is needs to be configured to use
|
||||||
|
@ -401,42 +401,42 @@ Then run Chrome with the following arguments::
|
||||||
|
|
||||||
$ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn
|
$ google-chrome --proxy-pac-url=file:///path/to/proxy.pac --use-npn
|
||||||
|
|
||||||
With ``--http2-bridge``, it accepts HTTP/2.0, SPDY and HTTP/1.1
|
With ``--http2-bridge``, it accepts HTTP/2, SPDY and HTTP/1.1
|
||||||
connections and communicates with backend in HTTP/2.0::
|
connections and communicates with backend in HTTP/2::
|
||||||
|
|
||||||
Client <-- (HTTP/2.0, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2.0) --> Web or HTTP/2.0 Proxy etc
|
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2) --> Web or HTTP/2 Proxy etc
|
||||||
(e.g., nghttpx -s)
|
(e.g., nghttpx -s)
|
||||||
|
|
||||||
With ``--client-proxy`` option, it works as forward proxy and expects
|
With ``--client-proxy`` option, it works as forward proxy and expects
|
||||||
that the backend is HTTP/2.0 proxy::
|
that the backend is HTTP/2 proxy::
|
||||||
|
|
||||||
Client <-- (HTTP/2.0, HTTP/1.1) --> nghttpx <-- (HTTP/2.0) --> HTTP/2.0 Proxy
|
Client <-- (HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/2) --> HTTP/2 Proxy
|
||||||
[forward proxy] (e.g., nghttpx -s)
|
[forward proxy] (e.g., nghttpx -s)
|
||||||
|
|
||||||
The ``Client`` needs to be configured to use nghttpx as forward
|
The ``Client`` needs to be configured to use nghttpx as forward
|
||||||
proxy. The frontend HTTP/1.1 connection can be upgraded to HTTP/2.0
|
proxy. The frontend HTTP/1.1 connection can be upgraded to HTTP/2
|
||||||
through HTTP Upgrade. With the above configuration, one can use
|
through HTTP Upgrade. With the above configuration, one can use
|
||||||
HTTP/1.1 client to access and test their HTTP/2.0 servers.
|
HTTP/1.1 client to access and test their HTTP/2 servers.
|
||||||
|
|
||||||
With ``--client`` option, it works as reverse proxy and expects that
|
With ``--client`` option, it works as reverse proxy and expects that
|
||||||
the backend is HTTP/2.0 Web server::
|
the backend is HTTP/2 Web server::
|
||||||
|
|
||||||
Client <-- (HTTP/2.0, HTTP/1.1) --> nghttpx <-- (HTTP/2.0) --> Web Server
|
Client <-- (HTTP/2, HTTP/1.1) --> nghttpx <-- (HTTP/2) --> Web Server
|
||||||
[reverse proxy]
|
[reverse proxy]
|
||||||
|
|
||||||
The frontend HTTP/1.1 connection can be upgraded to HTTP/2.0
|
The frontend HTTP/1.1 connection can be upgraded to HTTP/2
|
||||||
through HTTP Upgrade.
|
through HTTP Upgrade.
|
||||||
|
|
||||||
For the operation modes which talk to the backend in HTTP/2.0 over
|
For the operation modes which talk to the backend in HTTP/2 over
|
||||||
SSL/TLS, the backend connections can be tunneled through HTTP
|
SSL/TLS, the backend connections can be tunneled through HTTP
|
||||||
proxy. The proxy is specified using ``--backend-http-proxy-uri``
|
proxy. The proxy is specified using ``--backend-http-proxy-uri``
|
||||||
option. The following figure illustrates the example of
|
option. The following figure illustrates the example of
|
||||||
``--http2-bridge`` and ``--backend-http-proxy-uri`` options to talk to
|
``--http2-bridge`` and ``--backend-http-proxy-uri`` options to talk to
|
||||||
the outside HTTP/2.0 proxy through HTTP proxy::
|
the outside HTTP/2 proxy through HTTP proxy::
|
||||||
|
|
||||||
Client <-- (HTTP/2.0, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2.0) --
|
Client <-- (HTTP/2, SPDY, HTTP/1.1) --> nghttpx <-- (HTTP/2) --
|
||||||
|
|
||||||
--===================---> HTTP/2.0 Proxy
|
--===================---> HTTP/2 Proxy
|
||||||
(HTTP proxy tunnel) (e.g., nghttpx -s)
|
(HTTP proxy tunnel) (e.g., nghttpx -s)
|
||||||
|
|
||||||
Benchmarking tool
|
Benchmarking tool
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
dnl nghttp2 - HTTP/2.0 C Library
|
dnl nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
dnl Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
dnl Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
You can adapt this file completely to your liking, but it should at least
|
You can adapt this file completely to your liking, but it should at least
|
||||||
contain the root `toctree` directive.
|
contain the root `toctree` directive.
|
||||||
|
|
||||||
nghttp2 - HTTP/2.0 C Library
|
nghttp2 - HTTP/2 C Library
|
||||||
============================
|
============================
|
||||||
|
|
||||||
This is an experimental implementation of Hypertext Transfer Protocol
|
This is an experimental implementation of Hypertext Transfer Protocol
|
||||||
version 2.0.
|
version 2.
|
||||||
|
|
||||||
The project is hosted at `github.com/tatsuhiro-t/nghttp2 <https://github.com/tatsuhiro-t/nghttp2>`_.
|
The project is hosted at `github.com/tatsuhiro-t/nghttp2 <https://github.com/tatsuhiro-t/nghttp2>`_.
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
Tutorial: HTTP/2.0 client
|
Tutorial: HTTP/2 client
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
In this tutorial, we are going to write very primitive HTTP/2.0
|
In this tutorial, we are going to write very primitive HTTP/2
|
||||||
client. The complete source code, `libevent-client.c`_, is attached at
|
client. The complete source code, `libevent-client.c`_, is attached at
|
||||||
the end of this page. It also resides in examples directory in the
|
the end of this page. It also resides in examples directory in the
|
||||||
archive or repository.
|
archive or repository.
|
||||||
|
@ -19,7 +19,7 @@ function ``main()`` and ``run()``, which is not so relevant to nghttp2
|
||||||
library use. The one thing you should look at is setup NPN callback.
|
library use. The one thing you should look at is setup NPN callback.
|
||||||
The NPN callback is used for the client to select the next application
|
The NPN callback is used for the client to select the next application
|
||||||
protocol over the SSL/TLS transport. In this tutorial, we use
|
protocol over the SSL/TLS transport. In this tutorial, we use
|
||||||
`nghttp2_select_next_protocol()` function to select the HTTP/2.0
|
`nghttp2_select_next_protocol()` function to select the HTTP/2
|
||||||
protocol the library supports::
|
protocol the library supports::
|
||||||
|
|
||||||
static int select_next_proto_cb(SSL* ssl,
|
static int select_next_proto_cb(SSL* ssl,
|
||||||
|
@ -52,7 +52,7 @@ The callback is set to the SSL_CTX object using
|
||||||
}
|
}
|
||||||
|
|
||||||
We use ``http2_session_data`` structure to store the data related to
|
We use ``http2_session_data`` structure to store the data related to
|
||||||
the HTTP/2.0 session::
|
the HTTP/2 session::
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
nghttp2_session *session;
|
nghttp2_session *session;
|
||||||
|
@ -176,7 +176,7 @@ The `delete_http2_session_data()` destroys ``session_data`` and frees
|
||||||
its bufferevent, so it closes underlying connection as well. It also
|
its bufferevent, so it closes underlying connection as well. It also
|
||||||
calls `nghttp2_session_del()` to delete nghttp2 session object.
|
calls `nghttp2_session_del()` to delete nghttp2 session object.
|
||||||
|
|
||||||
We begin HTTP/2.0 communication by sending client connection header,
|
We begin HTTP/2 communication by sending client connection header,
|
||||||
which is 24 bytes magic byte sequence
|
which is 24 bytes magic byte sequence
|
||||||
(:macro:`NGHTTP2_CLIENT_CONNECTION_HEADER`) followed by SETTINGS
|
(:macro:`NGHTTP2_CLIENT_CONNECTION_HEADER`) followed by SETTINGS
|
||||||
frame. The transmission of client connection header is done in
|
frame. The transmission of client connection header is done in
|
||||||
|
@ -371,7 +371,7 @@ request based on priority and stream ID must be monotonically
|
||||||
increased, the stream ID is not assigned just before transmission.
|
increased, the stream ID is not assigned just before transmission.
|
||||||
The one of the purpose of this callback is get the stream ID assigned
|
The one of the purpose of this callback is get the stream ID assigned
|
||||||
to the frame. First we check that the frame is HEADERS frame. Since
|
to the frame. First we check that the frame is HEADERS frame. Since
|
||||||
HEADERS has several meanings in HTTP/2.0, we check that it is request
|
HEADERS has several meanings in HTTP/2, we check that it is request
|
||||||
HEADERS (which means that the first HEADERS frame to create a stream).
|
HEADERS (which means that the first HEADERS frame to create a stream).
|
||||||
The assigned stream ID is ``frame->hd.stream_id``. Recall that we
|
The assigned stream ID is ``frame->hd.stream_id``. Recall that we
|
||||||
passed ``stream_data`` in the *stream_user_data* parameter of
|
passed ``stream_data`` in the *stream_user_data* parameter of
|
||||||
|
@ -479,6 +479,6 @@ If the stream ID matches the one we initiated, it means that its
|
||||||
stream is going to be closed. Since we have finished to get the
|
stream is going to be closed. Since we have finished to get the
|
||||||
resource we want (or the stream was reset by RST_STREAM from the
|
resource we want (or the stream was reset by RST_STREAM from the
|
||||||
remote peer), we call `nghttp2_session_terminate_session()` to
|
remote peer), we call `nghttp2_session_terminate_session()` to
|
||||||
commencing the closure of the HTTP/2.0 session gracefully. If you have
|
commencing the closure of the HTTP/2 session gracefully. If you have
|
||||||
some data associated for the stream to be closed, you may delete it
|
some data associated for the stream to be closed, you may delete it
|
||||||
here.
|
here.
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
Tutorial: HTTP/2.0 server
|
Tutorial: HTTP/2 server
|
||||||
=========================
|
=========================
|
||||||
|
|
||||||
In this tutorial, we are going to write single-threaded, event-based
|
In this tutorial, we are going to write single-threaded, event-based
|
||||||
HTTP/2.0 web server, which supports HTTPS only. It can handle
|
HTTP/2 web server, which supports HTTPS only. It can handle
|
||||||
concurrent multiple requests, but only GET method is supported. The
|
concurrent multiple requests, but only GET method is supported. The
|
||||||
complete source code, `libevent-server.c`_, is attached at the end of
|
complete source code, `libevent-server.c`_, is attached at the end of
|
||||||
this page. It also resides in examples directory in the archive or
|
this page. It also resides in examples directory in the archive or
|
||||||
|
@ -57,7 +57,7 @@ life time::
|
||||||
|
|
||||||
The wire format of NPN is a sequence of length prefixed string. The
|
The wire format of NPN is a sequence of length prefixed string. The
|
||||||
exactly one byte is used to specify the length of each protocol
|
exactly one byte is used to specify the length of each protocol
|
||||||
identifier. In this tutorial, we advertise the HTTP/2.0 protocol the
|
identifier. In this tutorial, we advertise the HTTP/2 protocol the
|
||||||
nghttp2 library supports. The nghttp2 library exports its identifier
|
nghttp2 library supports. The nghttp2 library exports its identifier
|
||||||
in :macro:`NGHTTP2_PROTO_VERSION_ID`. The ``next_proto_cb()`` function
|
in :macro:`NGHTTP2_PROTO_VERSION_ID`. The ``next_proto_cb()`` function
|
||||||
is the server-side NPN callback. In OpenSSL implementation, we just
|
is the server-side NPN callback. In OpenSSL implementation, we just
|
||||||
|
@ -73,7 +73,7 @@ We use ``app_content`` structure to store the application-wide data::
|
||||||
};
|
};
|
||||||
|
|
||||||
We use ``http2_session_data`` structure to store the session-level
|
We use ``http2_session_data`` structure to store the session-level
|
||||||
(which corresponds to 1 HTTP/2.0 connection) data::
|
(which corresponds to 1 HTTP/2 connection) data::
|
||||||
|
|
||||||
typedef struct http2_session_data {
|
typedef struct http2_session_data {
|
||||||
struct http2_stream_data root;
|
struct http2_stream_data root;
|
||||||
|
@ -94,7 +94,7 @@ data::
|
||||||
int fd;
|
int fd;
|
||||||
} http2_stream_data;
|
} http2_stream_data;
|
||||||
|
|
||||||
1 HTTP/2.0 session can have multiple streams. We manage these
|
1 HTTP/2 session can have multiple streams. We manage these
|
||||||
multiple streams by intrusive doubly linked list to add and remove the
|
multiple streams by intrusive doubly linked list to add and remove the
|
||||||
object in O(1). The first element of this list is pointed by the
|
object in O(1). The first element of this list is pointed by the
|
||||||
``root->next`` in ``http2_session_data``. Initially, ``root->next``
|
``root->next`` in ``http2_session_data``. Initially, ``root->next``
|
||||||
|
@ -226,10 +226,10 @@ it::
|
||||||
|
|
||||||
We check that the received byte string matches
|
We check that the received byte string matches
|
||||||
:macro:`NGHTTP2_CLIENT_CONNECTION_HEADER`. When they match, the
|
:macro:`NGHTTP2_CLIENT_CONNECTION_HEADER`. When they match, the
|
||||||
connection state is ready for starting HTTP/2.0 communication. First
|
connection state is ready for starting HTTP/2 communication. First
|
||||||
we change the callback functions for the bufferevent object. We use
|
we change the callback functions for the bufferevent object. We use
|
||||||
same ``eventcb`` as before. But we specify new ``readcb`` and
|
same ``eventcb`` as before. But we specify new ``readcb`` and
|
||||||
``writecb`` function to handle HTTP/2.0 communication. We describe
|
``writecb`` function to handle HTTP/2 communication. We describe
|
||||||
these 2 functions later.
|
these 2 functions later.
|
||||||
|
|
||||||
We initialize nghttp2 session object which is done in
|
We initialize nghttp2 session object which is done in
|
||||||
|
@ -435,7 +435,7 @@ of header block in HEADERS or PUSH_PROMISE frame is started::
|
||||||
}
|
}
|
||||||
|
|
||||||
We only interested in HEADERS frame in this function. Since HEADERS
|
We only interested in HEADERS frame in this function. Since HEADERS
|
||||||
frame has several roles in HTTP/2.0 protocol, we check that it is a
|
frame has several roles in HTTP/2 protocol, we check that it is a
|
||||||
request HEADERS, which opens new stream. If frame is request HEADERS,
|
request HEADERS, which opens new stream. If frame is request HEADERS,
|
||||||
then we create ``http2_stream_data`` object to store stream related
|
then we create ``http2_stream_data`` object to store stream related
|
||||||
data. We associate created ``http2_stream_data`` object to the stream
|
data. We associate created ``http2_stream_data`` object to the stream
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -146,7 +146,7 @@ static size_t GZIP_LEN = sizeof(GZIP) - 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check response is content-encoding: gzip. We need this because
|
* Check response is content-encoding: gzip. We need this because
|
||||||
* HTTP/2.0 client is required to support gzip.
|
* HTTP/2 client is required to support gzip.
|
||||||
*/
|
*/
|
||||||
static void check_gzip(struct Request *req, nghttp2_nv *nva, size_t nvlen)
|
static void check_gzip(struct Request *req, nghttp2_nv *nva, size_t nvlen)
|
||||||
{
|
{
|
||||||
|
@ -395,7 +395,7 @@ static void setup_nghttp2_callbacks(nghttp2_session_callbacks *callbacks)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Callback function for TLS NPN. Since this program only supports
|
* Callback function for TLS NPN. Since this program only supports
|
||||||
* HTTP/2.0 protocol, if server does not offer HTTP/2.0 the nghttp2
|
* HTTP/2 protocol, if server does not offer HTTP/2 the nghttp2
|
||||||
* library supports, we terminate program.
|
* library supports, we terminate program.
|
||||||
*/
|
*/
|
||||||
static int select_next_proto_cb(SSL* ssl,
|
static int select_next_proto_cb(SSL* ssl,
|
||||||
|
@ -404,11 +404,11 @@ static int select_next_proto_cb(SSL* ssl,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
int rv;
|
int rv;
|
||||||
/* nghttp2_select_next_protocol() selects HTTP/2.0 protocol the
|
/* nghttp2_select_next_protocol() selects HTTP/2 protocol the
|
||||||
nghttp2 library supports. */
|
nghttp2 library supports. */
|
||||||
rv = nghttp2_select_next_protocol(out, outlen, in, inlen);
|
rv = nghttp2_select_next_protocol(out, outlen, in, inlen);
|
||||||
if(rv <= 0) {
|
if(rv <= 0) {
|
||||||
die("Server did not advertise HTTP/2.0 protocol");
|
die("Server did not advertise HTTP/2 protocol");
|
||||||
}
|
}
|
||||||
return SSL_TLSEXT_ERR_OK;
|
return SSL_TLSEXT_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -190,7 +190,7 @@ static ssize_t send_callback(nghttp2_session *session,
|
||||||
|
|
||||||
/* nghttp2_before_frame_send_callback: Called when nghttp2 library is
|
/* nghttp2_before_frame_send_callback: Called when nghttp2 library is
|
||||||
about to send a frame. We use this callback to get stream ID of new
|
about to send a frame. We use this callback to get stream ID of new
|
||||||
stream. Since HEADERS in HTTP/2.0 has several roles, we check that
|
stream. Since HEADERS in HTTP/2 has several roles, we check that
|
||||||
it is a HTTP request HEADERS. */
|
it is a HTTP request HEADERS. */
|
||||||
static int before_frame_send_callback
|
static int before_frame_send_callback
|
||||||
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
(nghttp2_session *session, const nghttp2_frame *frame, void *user_data)
|
||||||
|
@ -308,7 +308,7 @@ static int on_stream_close_callback(nghttp2_session *session,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NPN TLS extension client callback. We check that server advertised
|
/* NPN TLS extension client callback. We check that server advertised
|
||||||
the HTTP/2.0 protocol the nghttp2 library supports. If not, exit
|
the HTTP/2 protocol the nghttp2 library supports. If not, exit
|
||||||
the program. */
|
the program. */
|
||||||
static int select_next_proto_cb(SSL* ssl,
|
static int select_next_proto_cb(SSL* ssl,
|
||||||
unsigned char **out, unsigned char *outlen,
|
unsigned char **out, unsigned char *outlen,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -549,7 +549,7 @@ static void initialize_nghttp2_session(http2_session_data *session_data)
|
||||||
nghttp2_session_server_new(&session_data->session, &callbacks, session_data);
|
nghttp2_session_server_new(&session_data->session, &callbacks, session_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send HTTP/2.0 client connection header, which includes 24 bytes
|
/* Send HTTP/2 client connection header, which includes 24 bytes
|
||||||
magic octets and SETTINGS frame */
|
magic octets and SETTINGS frame */
|
||||||
static int send_server_connection_header(http2_session_data *session_data)
|
static int send_server_connection_header(http2_session_data *session_data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013, 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013, 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -52,7 +52,7 @@ struct nghttp2_session;
|
||||||
/**
|
/**
|
||||||
* @struct
|
* @struct
|
||||||
*
|
*
|
||||||
* The primary structure to hold the resources needed for a HTTP/2.0
|
* The primary structure to hold the resources needed for a HTTP/2
|
||||||
* session. The details of this structure are intentionally hidden
|
* session. The details of this structure are intentionally hidden
|
||||||
* from the public API.
|
* from the public API.
|
||||||
*/
|
*/
|
||||||
|
@ -332,7 +332,7 @@ typedef struct {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum
|
* @enum
|
||||||
* The control frame types in HTTP/2.0.
|
* The control frame types in HTTP/2.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
/**
|
/**
|
||||||
|
@ -380,7 +380,7 @@ typedef enum {
|
||||||
/**
|
/**
|
||||||
* @enum
|
* @enum
|
||||||
*
|
*
|
||||||
* The flags for HTTP/2.0 frames. This enum defines all flags for
|
* The flags for HTTP/2 frames. This enum defines all flags for
|
||||||
* frames, assuming that the same flag name has the same mask.
|
* frames, assuming that the same flag name has the same mask.
|
||||||
*/
|
*/
|
||||||
typedef enum {
|
typedef enum {
|
||||||
|
@ -616,7 +616,7 @@ typedef struct {
|
||||||
* @enum
|
* @enum
|
||||||
*
|
*
|
||||||
* The category of HEADERS, which indicates the role of the frame. In
|
* The category of HEADERS, which indicates the role of the frame. In
|
||||||
* HTTP/2.0 spec, request, response, push response and other arbitrary
|
* HTTP/2 spec, request, response, push response and other arbitrary
|
||||||
* headers (e.g., trailers) are all called just HEADERS. To give the
|
* headers (e.g., trailers) are all called just HEADERS. To give the
|
||||||
* application the role of incoming HEADERS frame, we define several
|
* application the role of incoming HEADERS frame, we define several
|
||||||
* categories.
|
* categories.
|
||||||
|
@ -2023,7 +2023,7 @@ void nghttp2_priority_spec_dep_init(nghttp2_priority_spec *pri_spec,
|
||||||
* appearing in different header fields, it has to concatenate them
|
* appearing in different header fields, it has to concatenate them
|
||||||
* using NULL byte (0x0) before passing them to this function.
|
* using NULL byte (0x0) before passing them to this function.
|
||||||
*
|
*
|
||||||
* HTTP/2.0 specification has requirement about header fields in the
|
* HTTP/2 specification has requirement about header fields in the
|
||||||
* request HEADERS. See the specification for more details.
|
* request HEADERS. See the specification for more details.
|
||||||
*
|
*
|
||||||
* This function creates copies of all name/value pairs in |nva|. It
|
* This function creates copies of all name/value pairs in |nva|. It
|
||||||
|
@ -2042,7 +2042,7 @@ void nghttp2_priority_spec_dep_init(nghttp2_priority_spec *pri_spec,
|
||||||
* `nghttp2_session_get_stream_user_data()`.
|
* `nghttp2_session_get_stream_user_data()`.
|
||||||
*
|
*
|
||||||
* Since the library reorders the frames and tries to send the highest
|
* Since the library reorders the frames and tries to send the highest
|
||||||
* prioritized one first and the HTTP/2.0 specification requires the
|
* prioritized one first and the HTTP/2 specification requires the
|
||||||
* stream ID must be strictly increasing, the stream ID of this
|
* stream ID must be strictly increasing, the stream ID of this
|
||||||
* request cannot be known until it is about to sent. To know the
|
* request cannot be known until it is about to sent. To know the
|
||||||
* stream ID of the request, the application can use
|
* stream ID of the request, the application can use
|
||||||
|
@ -2078,7 +2078,7 @@ int nghttp2_submit_request(nghttp2_session *session,
|
||||||
* appearing in different header fields, it has to concatenate them
|
* appearing in different header fields, it has to concatenate them
|
||||||
* using NULL byte (0x0) before passing them to this function.
|
* using NULL byte (0x0) before passing them to this function.
|
||||||
*
|
*
|
||||||
* HTTP/2.0 specification has requirement about header fields in the
|
* HTTP/2 specification has requirement about header fields in the
|
||||||
* response HEADERS. See the specification for more details.
|
* response HEADERS. See the specification for more details.
|
||||||
*
|
*
|
||||||
* This function creates copies of all name/value pairs in |nva|. It
|
* This function creates copies of all name/value pairs in |nva|. It
|
||||||
|
@ -2299,7 +2299,7 @@ int nghttp2_submit_settings(nghttp2_session *session, uint8_t flags,
|
||||||
* :type:`nghttp2_on_frame_send_callback` of this frame.
|
* :type:`nghttp2_on_frame_send_callback` of this frame.
|
||||||
*
|
*
|
||||||
* Since the library reorders the frames and tries to send the highest
|
* Since the library reorders the frames and tries to send the highest
|
||||||
* prioritized one first and the HTTP/2.0 specification requires the
|
* prioritized one first and the HTTP/2 specification requires the
|
||||||
* stream ID must be strictly increasing, the promised stream ID
|
* stream ID must be strictly increasing, the promised stream ID
|
||||||
* cannot be known until it is about to sent. To know the promised
|
* cannot be known until it is about to sent. To know the promised
|
||||||
* stream ID, the application can use
|
* stream ID, the application can use
|
||||||
|
@ -2434,7 +2434,7 @@ int nghttp2_nv_compare_name(const nghttp2_nv *lhs, const nghttp2_nv *rhs);
|
||||||
*
|
*
|
||||||
* The selection algorithm is as follows:
|
* The selection algorithm is as follows:
|
||||||
*
|
*
|
||||||
* 1. If peer's list contains HTTP/2.0 protocol the library supports,
|
* 1. If peer's list contains HTTP/2 protocol the library supports,
|
||||||
* it is selected and returns 1. The following step is not taken.
|
* it is selected and returns 1. The following step is not taken.
|
||||||
*
|
*
|
||||||
* 2. If peer's list contains ``http/1.1``, this function selects
|
* 2. If peer's list contains ``http/1.1``, this function selects
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ libdir=@libdir@
|
||||||
includedir=@includedir@
|
includedir=@includedir@
|
||||||
|
|
||||||
Name: libnghttp2
|
Name: libnghttp2
|
||||||
Description: HTTP/2.0 C library
|
Description: HTTP/2 C library
|
||||||
URL: https://github.com/tatsuhiro-t/nghttp2
|
URL: https://github.com/tatsuhiro-t/nghttp2
|
||||||
Version: @VERSION@
|
Version: @VERSION@
|
||||||
Libs: -L${libdir} -lnghttp2
|
Libs: -L${libdir} -lnghttp2
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -42,7 +42,7 @@ int nghttp2_select_next_protocol(unsigned char **out, unsigned char *outlen,
|
||||||
http_selected = 1;
|
http_selected = 1;
|
||||||
*out = (unsigned char*)&in[i+1];
|
*out = (unsigned char*)&in[i+1];
|
||||||
*outlen = in[i];
|
*outlen = in[i];
|
||||||
/* Go through to the next iteration, because "HTTP/2.0" may be
|
/* Go through to the next iteration, because "HTTP/2" may be
|
||||||
there */
|
there */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012, 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
@ -674,7 +674,7 @@ cdef class _HTTP2SessionCore:
|
||||||
path = handler.path.decode('utf-8')
|
path = handler.path.decode('utf-8')
|
||||||
except:
|
except:
|
||||||
path = handler.path
|
path = handler.path
|
||||||
sys.stderr.write('{} - - [{}] "{} {} HTTP/2.0" {} - {}\n'.format\
|
sys.stderr.write('{} - - [{}] "{} {} HTTP/2" {} - {}\n'.format\
|
||||||
(handler.client_address[0],
|
(handler.client_address[0],
|
||||||
datestr, method, path, handler.status,
|
datestr, method, path, handler.status,
|
||||||
'P' if handler.pushed else '-'))
|
'P' if handler.pushed else '-'))
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
# Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ from distutils.extension import Extension
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'python-nghttp2',
|
name = 'python-nghttp2',
|
||||||
description = 'Python HTTP/2.0 library on top of nghttp2',
|
description = 'Python HTTP/2 library on top of nghttp2',
|
||||||
author = 'Tatsuhiro Tsujikawa',
|
author = 'Tatsuhiro Tsujikawa',
|
||||||
author_email = 'tatsuhiro.t@gmail.com',
|
author_email = 'tatsuhiro.t@gmail.com',
|
||||||
url = 'http://tatsuhiro-t.github.io/nghttp2/',
|
url = 'http://tatsuhiro-t.github.io/nghttp2/',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -761,7 +761,7 @@ int Http2Handler::verify_npn_result()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(sessions_->get_config()->verbose) {
|
if(sessions_->get_config()->verbose) {
|
||||||
std::cerr << "Client did not advertise HTTP/2.0 protocol."
|
std::cerr << "Client did not advertise HTTP/2 protocol."
|
||||||
<< " (nghttp2 expects " << NGHTTP2_PROTO_VERSION_ID << ")"
|
<< " (nghttp2 expects " << NGHTTP2_PROTO_VERSION_ID << ")"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# nghttp2 - HTTP/2.0 C Library
|
# nghttp2 - HTTP/2 C Library
|
||||||
|
|
||||||
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
# Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -316,7 +316,7 @@ static int perform_from_http1text(void)
|
||||||
|
|
||||||
static void print_help(void)
|
static void print_help(void)
|
||||||
{
|
{
|
||||||
printf("HPACK HTTP/2.0 header encoder\n"
|
printf("HPACK HTTP/2 header encoder\n"
|
||||||
"Usage: deflatehd [OPTIONS] < INPUT\n"
|
"Usage: deflatehd [OPTIONS] < INPUT\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Reads JSON data or HTTP/1-style header fields from stdin and\n"
|
"Reads JSON data or HTTP/1-style header fields from stdin and\n"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -58,7 +58,7 @@ void copy_url_component(std::string& dest, const http_parser_url *u, int field,
|
||||||
const char* url);
|
const char* url);
|
||||||
|
|
||||||
// Returns true if the header field |name| with length |namelen| bytes
|
// Returns true if the header field |name| with length |namelen| bytes
|
||||||
// is valid for HTTP/2.0.
|
// is valid for HTTP/2.
|
||||||
bool check_http2_allowed_header(const uint8_t *name, size_t namelen);
|
bool check_http2_allowed_header(const uint8_t *name, size_t namelen);
|
||||||
|
|
||||||
// Calls check_http2_allowed_header with |name| and strlen(name),
|
// Calls check_http2_allowed_header with |name| and strlen(name),
|
||||||
|
@ -66,7 +66,7 @@ bool check_http2_allowed_header(const uint8_t *name, size_t namelen);
|
||||||
bool check_http2_allowed_header(const char *name);
|
bool check_http2_allowed_header(const char *name);
|
||||||
|
|
||||||
// Checks that headers |nva| do not contain disallowed header fields
|
// Checks that headers |nva| do not contain disallowed header fields
|
||||||
// in HTTP/2.0 spec. This function returns true if |nva| does not
|
// in HTTP/2 spec. This function returns true if |nva| does not
|
||||||
// contains such headers.
|
// contains such headers.
|
||||||
bool check_http2_headers(const Headers& nva);
|
bool check_http2_headers(const Headers& nva);
|
||||||
|
|
||||||
|
@ -151,7 +151,7 @@ nghttp2_nv make_nv_ls(const char(&name)[N], const std::string& value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Appends headers in |headers| to |nv|. Certain headers, including
|
// Appends headers in |headers| to |nv|. Certain headers, including
|
||||||
// disallowed headers in HTTP/2.0 spec and headers which require
|
// disallowed headers in HTTP/2 spec and headers which require
|
||||||
// special handling (i.e. via), are not copied.
|
// special handling (i.e. via), are not copied.
|
||||||
void copy_norm_headers_to_nva
|
void copy_norm_headers_to_nva
|
||||||
(std::vector<nghttp2_nv>& nva, const Headers& headers);
|
(std::vector<nghttp2_nv>& nva, const Headers& headers);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -206,7 +206,7 @@ static int perform(void)
|
||||||
|
|
||||||
static void print_help(void)
|
static void print_help(void)
|
||||||
{
|
{
|
||||||
printf("HPACK HTTP/2.0 header decoder\n"
|
printf("HPACK HTTP/2 header decoder\n"
|
||||||
"Usage: inflatehd [OPTIONS] < INPUT\n"
|
"Usage: inflatehd [OPTIONS] < INPUT\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Reads JSON data from stdin and outputs inflated name/value pairs\n"
|
"Reads JSON data from stdin and outputs inflated name/value pairs\n"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -1388,7 +1388,7 @@ void print_stats(const HttpClient& client)
|
||||||
namespace {
|
namespace {
|
||||||
void print_protocol_nego_error()
|
void print_protocol_nego_error()
|
||||||
{
|
{
|
||||||
std::cerr << "HTTP/2.0 protocol was not selected."
|
std::cerr << "HTTP/2 protocol was not selected."
|
||||||
<< " (nghttp2 expects " << NGHTTP2_PROTO_VERSION_ID << ")"
|
<< " (nghttp2 expects " << NGHTTP2_PROTO_VERSION_ID << ")"
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
}
|
}
|
||||||
|
@ -1805,10 +1805,10 @@ Options:
|
||||||
-m, --multiply=<N> Request each URI <N> times. By default, same URI
|
-m, --multiply=<N> Request each URI <N> times. By default, same URI
|
||||||
is not requested twice. This option disables it
|
is not requested twice. This option disables it
|
||||||
too.
|
too.
|
||||||
-u, --upgrade Perform HTTP Upgrade for HTTP/2.0. This option
|
-u, --upgrade Perform HTTP Upgrade for HTTP/2. This option is
|
||||||
is ignored if the request URI has https scheme.
|
ignored if the request URI has https scheme. If
|
||||||
If -d is used, the HTTP upgrade request is
|
-d is used, the HTTP upgrade request is performed
|
||||||
performed with OPTIONS method.
|
with OPTIONS method.
|
||||||
-p, --weight=<WEIGHT>
|
-p, --weight=<WEIGHT>
|
||||||
Sets priority group weight. Default: )"
|
Sets priority group weight. Default: )"
|
||||||
<< NGHTTP2_DEFAULT_WEIGHT << R"(
|
<< NGHTTP2_DEFAULT_WEIGHT << R"(
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
* Copyright (c) 2013 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -374,13 +374,13 @@ void fill_default_config()
|
||||||
// Timeout for pooled (idle) connections
|
// Timeout for pooled (idle) connections
|
||||||
mod_config()->downstream_idle_read_timeout.tv_sec = 60;
|
mod_config()->downstream_idle_read_timeout.tv_sec = 60;
|
||||||
|
|
||||||
// window bits for HTTP/2.0 and SPDY upstream/downstream connection
|
// window bits for HTTP/2 and SPDY upstream/downstream connection
|
||||||
// per stream. 2**16-1 = 64KiB-1, which is HTTP/2.0 default. Please
|
// per stream. 2**16-1 = 64KiB-1, which is HTTP/2 default. Please
|
||||||
// note that SPDY/3 default is 64KiB.
|
// note that SPDY/3 default is 64KiB.
|
||||||
mod_config()->http2_upstream_window_bits = 16;
|
mod_config()->http2_upstream_window_bits = 16;
|
||||||
mod_config()->http2_downstream_window_bits = 16;
|
mod_config()->http2_downstream_window_bits = 16;
|
||||||
|
|
||||||
// HTTP/2.0 SPDY/3.1 has connection-level flow control. The default
|
// HTTP/2 SPDY/3.1 has connection-level flow control. The default
|
||||||
// window size for HTTP/2 is 64KiB - 1. SPDY/3's default is 64KiB
|
// window size for HTTP/2 is 64KiB - 1. SPDY/3's default is 64KiB
|
||||||
mod_config()->http2_upstream_connection_window_bits = 16;
|
mod_config()->http2_upstream_connection_window_bits = 16;
|
||||||
mod_config()->http2_downstream_connection_window_bits = 16;
|
mod_config()->http2_downstream_connection_window_bits = 16;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -189,9 +189,9 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
|
||||||
data, readlen) != 0) {
|
data, readlen) != 0) {
|
||||||
if(LOG_ENABLED(INFO)) {
|
if(LOG_ENABLED(INFO)) {
|
||||||
CLOG(INFO, handler) << "This is HTTP/1.1 connection, "
|
CLOG(INFO, handler) << "This is HTTP/1.1 connection, "
|
||||||
<< "but may be upgraded to HTTP/2.0 later.";
|
<< "but may be upgraded to HTTP/2 later.";
|
||||||
}
|
}
|
||||||
// Reset header length for later HTTP/2.0 upgrade
|
// Reset header length for later HTTP/2 upgrade
|
||||||
handler->set_left_connhd_len(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN);
|
handler->set_left_connhd_len(NGHTTP2_CLIENT_CONNECTION_HEADER_LEN);
|
||||||
handler->set_bev_cb(upstream_readcb, upstream_writecb, upstream_eventcb);
|
handler->set_bev_cb(upstream_readcb, upstream_writecb, upstream_eventcb);
|
||||||
if(handler->on_read() != 0) {
|
if(handler->on_read() != 0) {
|
||||||
|
@ -208,7 +208,7 @@ void upstream_http1_connhd_readcb(bufferevent *bev, void *arg)
|
||||||
handler->set_left_connhd_len(leftlen);
|
handler->set_left_connhd_len(leftlen);
|
||||||
if(leftlen == 0) {
|
if(leftlen == 0) {
|
||||||
if(LOG_ENABLED(INFO)) {
|
if(LOG_ENABLED(INFO)) {
|
||||||
CLOG(INFO, handler) << "direct HTTP/2.0 connection";
|
CLOG(INFO, handler) << "direct HTTP/2 connection";
|
||||||
}
|
}
|
||||||
handler->direct_http2_upgrade();
|
handler->direct_http2_upgrade();
|
||||||
handler->set_bev_cb(upstream_readcb, upstream_writecb, upstream_eventcb);
|
handler->set_bev_cb(upstream_readcb, upstream_writecb, upstream_eventcb);
|
||||||
|
@ -291,7 +291,7 @@ ClientHandler::ClientHandler(bufferevent *bev,
|
||||||
evbuffer_add_cb(output, tls_raw_writecb, this);
|
evbuffer_add_cb(output, tls_raw_writecb, this);
|
||||||
} else {
|
} else {
|
||||||
// For non-TLS version, first create HttpsUpstream. It may be
|
// For non-TLS version, first create HttpsUpstream. It may be
|
||||||
// upgraded to HTTP/2.0 through HTTP Upgrade or direct HTTP/2.0
|
// upgraded to HTTP/2 through HTTP Upgrade or direct HTTP/2
|
||||||
// connection.
|
// connection.
|
||||||
upstream_ = util::make_unique<HttpsUpstream>(this);
|
upstream_ = util::make_unique<HttpsUpstream>(this);
|
||||||
set_bev_cb(upstream_http1_connhd_readcb, nullptr, upstream_eventcb);
|
set_bev_cb(upstream_http1_connhd_readcb, nullptr, upstream_eventcb);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -71,10 +71,10 @@ public:
|
||||||
Http2Session* get_http2_session() const;
|
Http2Session* get_http2_session() const;
|
||||||
size_t get_left_connhd_len() const;
|
size_t get_left_connhd_len() const;
|
||||||
void set_left_connhd_len(size_t left);
|
void set_left_connhd_len(size_t left);
|
||||||
// Call this function when HTTP/2.0 connection header is received at
|
// Call this function when HTTP/2 connection header is received at
|
||||||
// the start of the connection.
|
// the start of the connection.
|
||||||
void direct_http2_upgrade();
|
void direct_http2_upgrade();
|
||||||
// Performs HTTP/2.0 Upgrade from the connection managed by
|
// Performs HTTP/2 Upgrade from the connection managed by
|
||||||
// |http|. If this function fails, the connection must be
|
// |http|. If this function fails, the connection must be
|
||||||
// terminated. This function returns 0 if it succeeds, or -1.
|
// terminated. This function returns 0 if it succeeds, or -1.
|
||||||
int perform_http2_upgrade(HttpsUpstream *http);
|
int perform_http2_upgrade(HttpsUpstream *http);
|
||||||
|
@ -94,7 +94,7 @@ private:
|
||||||
// HTTP2. Not deleted by this object.
|
// HTTP2. Not deleted by this object.
|
||||||
Http2Session *http2session_;
|
Http2Session *http2session_;
|
||||||
SSL *ssl_;
|
SSL *ssl_;
|
||||||
// The number of bytes of HTTP/2.0 client connection header to read
|
// The number of bytes of HTTP/2 client connection header to read
|
||||||
size_t left_connhd_len_;
|
size_t left_connhd_len_;
|
||||||
int fd_;
|
int fd_;
|
||||||
bool should_close_after_write_;
|
bool should_close_after_write_;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
* Copyright (c) 2014 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
@ -79,7 +79,7 @@ public:
|
||||||
// Returns true if the upgrade is succeded as a result of the call
|
// Returns true if the upgrade is succeded as a result of the call
|
||||||
// check_upgrade_fulfilled().
|
// check_upgrade_fulfilled().
|
||||||
bool get_upgraded() const;
|
bool get_upgraded() const;
|
||||||
// Returns true if the request is HTTP Upgrade for HTTP/2.0
|
// Returns true if the request is HTTP Upgrade for HTTP/2
|
||||||
bool http2_upgrade_request() const;
|
bool http2_upgrade_request() const;
|
||||||
// downstream request API
|
// downstream request API
|
||||||
const Headers& get_request_headers() const;
|
const Headers& get_request_headers() const;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* nghttp2 - HTTP/2.0 C Library
|
* nghttp2 - HTTP/2 C Library
|
||||||
*
|
*
|
||||||
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
* Copyright (c) 2012 Tatsuhiro Tsujikawa
|
||||||
*
|
*
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue