Insert '_' before header name nghttp2_http_flag to consistent with token

This commit is contained in:
Tatsuhiro Tsujikawa 2015-02-20 19:30:34 +09:00
parent 3dbd2d31bd
commit 83952ef0af
2 changed files with 17 additions and 17 deletions

View File

@ -238,12 +238,12 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_nv *nv,
switch (token) { switch (token) {
case NGHTTP2_TOKEN__AUTHORITY: case NGHTTP2_TOKEN__AUTHORITY:
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_AUTHORITY)) { if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__AUTHORITY)) {
return -1; return -1;
} }
break; break;
case NGHTTP2_TOKEN__METHOD: case NGHTTP2_TOKEN__METHOD:
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_METHOD)) { if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__METHOD)) {
return -1; return -1;
} }
if (streq("HEAD", nv->value, nv->valuelen)) { if (streq("HEAD", nv->value, nv->valuelen)) {
@ -255,7 +255,7 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_nv *nv,
} }
stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT; stream->http_flags |= NGHTTP2_HTTP_FLAG_METH_CONNECT;
if (stream->http_flags & if (stream->http_flags &
(NGHTTP2_HTTP_FLAG_PATH | NGHTTP2_HTTP_FLAG_SCHEME)) { (NGHTTP2_HTTP_FLAG__PATH | NGHTTP2_HTTP_FLAG__SCHEME)) {
return -1; return -1;
} }
} }
@ -264,7 +264,7 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_nv *nv,
if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
return -1; return -1;
} }
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_PATH)) { if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__PATH)) {
return -1; return -1;
} }
break; break;
@ -272,7 +272,7 @@ static int http_request_on_header(nghttp2_stream *stream, nghttp2_nv *nv,
if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
return -1; return -1;
} }
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_SCHEME)) { if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__SCHEME)) {
return -1; return -1;
} }
break; break;
@ -331,7 +331,7 @@ static int http_response_on_header(nghttp2_stream *stream, nghttp2_nv *nv,
switch (token) { switch (token) {
case NGHTTP2_TOKEN__STATUS: { case NGHTTP2_TOKEN__STATUS: {
if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG_STATUS)) { if (!check_pseudo_header(stream, nv, NGHTTP2_HTTP_FLAG__STATUS)) {
return -1; return -1;
} }
if (nv->valuelen != 3) { if (nv->valuelen != 3) {
@ -395,14 +395,14 @@ int nghttp2_http_on_header(nghttp2_session *session, nghttp2_stream *stream,
int nghttp2_http_on_request_headers(nghttp2_stream *stream, int nghttp2_http_on_request_headers(nghttp2_stream *stream,
nghttp2_frame *frame) { nghttp2_frame *frame) {
if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) { if (stream->http_flags & NGHTTP2_HTTP_FLAG_METH_CONNECT) {
if ((stream->http_flags & NGHTTP2_HTTP_FLAG_AUTHORITY) == 0) { if ((stream->http_flags & NGHTTP2_HTTP_FLAG__AUTHORITY) == 0) {
return -1; return -1;
} }
stream->content_length = -1; stream->content_length = -1;
} else if ((stream->http_flags & NGHTTP2_HTTP_FLAG_REQ_HEADERS) != } else if ((stream->http_flags & NGHTTP2_HTTP_FLAG_REQ_HEADERS) !=
NGHTTP2_HTTP_FLAG_REQ_HEADERS || NGHTTP2_HTTP_FLAG_REQ_HEADERS ||
(stream->http_flags & (stream->http_flags &
(NGHTTP2_HTTP_FLAG_AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) { (NGHTTP2_HTTP_FLAG__AUTHORITY | NGHTTP2_HTTP_FLAG_HOST)) == 0) {
return -1; return -1;
} }
@ -417,7 +417,7 @@ int nghttp2_http_on_request_headers(nghttp2_stream *stream,
} }
int nghttp2_http_on_response_headers(nghttp2_stream *stream) { int nghttp2_http_on_response_headers(nghttp2_stream *stream) {
if ((stream->http_flags & NGHTTP2_HTTP_FLAG_STATUS) == 0) { if ((stream->http_flags & NGHTTP2_HTTP_FLAG__STATUS) == 0) {
return -1; return -1;
} }

View File

@ -103,19 +103,19 @@ typedef enum {
typedef enum { typedef enum {
NGHTTP2_HTTP_FLAG_NONE = 0, NGHTTP2_HTTP_FLAG_NONE = 0,
/* header field seen so far */ /* header field seen so far */
NGHTTP2_HTTP_FLAG_AUTHORITY = 1, NGHTTP2_HTTP_FLAG__AUTHORITY = 1,
NGHTTP2_HTTP_FLAG_PATH = 1 << 1, NGHTTP2_HTTP_FLAG__PATH = 1 << 1,
NGHTTP2_HTTP_FLAG_METHOD = 1 << 2, NGHTTP2_HTTP_FLAG__METHOD = 1 << 2,
NGHTTP2_HTTP_FLAG_SCHEME = 1 << 3, NGHTTP2_HTTP_FLAG__SCHEME = 1 << 3,
/* host is not pseudo header, but we require either host or /* host is not pseudo header, but we require either host or
:authority */ :authority */
NGHTTP2_HTTP_FLAG_HOST = 1 << 4, NGHTTP2_HTTP_FLAG_HOST = 1 << 4,
NGHTTP2_HTTP_FLAG_STATUS = 1 << 5, NGHTTP2_HTTP_FLAG__STATUS = 1 << 5,
/* required header fields for HTTP request except for CONNECT /* required header fields for HTTP request except for CONNECT
method. */ method. */
NGHTTP2_HTTP_FLAG_REQ_HEADERS = NGHTTP2_HTTP_FLAG_METHOD | NGHTTP2_HTTP_FLAG_REQ_HEADERS = NGHTTP2_HTTP_FLAG__METHOD |
NGHTTP2_HTTP_FLAG_PATH | NGHTTP2_HTTP_FLAG__PATH |
NGHTTP2_HTTP_FLAG_SCHEME, NGHTTP2_HTTP_FLAG__SCHEME,
NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED = 1 << 6, NGHTTP2_HTTP_FLAG_PSEUDO_HEADER_DISALLOWED = 1 << 6,
/* HTTP method flags */ /* HTTP method flags */
NGHTTP2_HTTP_FLAG_METH_CONNECT = 1 << 7, NGHTTP2_HTTP_FLAG_METH_CONNECT = 1 << 7,