[go: nahoru, domu]

Skip to content

Commit

Permalink
proxy: Don't drop the date header if present
Browse files Browse the repository at this point in the history
  • Loading branch information
deweerdt committed Nov 9, 2017
1 parent 10747d2 commit d511644
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
3 changes: 1 addition & 2 deletions include/h2o/http2_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,7 @@ size_t h2o_hpack_encode_string(uint8_t *dst, const char *s, size_t len);
void h2o_hpack_flatten_request(h2o_buffer_t **buf, h2o_hpack_header_table_t *header_table, uint32_t stream_id,
size_t max_frame_size, h2o_req_t *req, uint32_t parent_stream_id);
void h2o_hpack_flatten_response(h2o_buffer_t **buf, h2o_hpack_header_table_t *header_table, uint32_t stream_id,
size_t max_frame_size, h2o_res_t *res, const h2o_iovec_t *server_name,
size_t content_length);
size_t max_frame_size, h2o_res_t *res, const h2o_iovec_t *server_name, size_t content_length);
static h2o_hpack_header_table_entry_t *h2o_hpack_header_table_get(h2o_hpack_header_table_t *table, size_t index);

/* frames */
Expand Down
2 changes: 1 addition & 1 deletion lib/core/token_table.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ h2o_token_t h2o__tokens[] = {{{H2O_STRLIT(":authority")}, 1, 0, 0, 0, 0, 0, 0},
{{H2O_STRLIT("content-range")}, 30, 0, 0, 0, 0, 0, 0},
{{H2O_STRLIT("content-type")}, 31, 0, 0, 0, 0, 0, 0},
{{H2O_STRLIT("cookie")}, 32, 0, 0, 0, 0, 0, 1},
{{H2O_STRLIT("date")}, 33, 0, 1, 0, 0, 0, 0},
{{H2O_STRLIT("date")}, 33, 0, 0, 0, 0, 0, 0},
{{H2O_STRLIT("etag")}, 34, 0, 0, 0, 0, 0, 0},
{{H2O_STRLIT("expect")}, 35, 0, 0, 1, 0, 0, 0},
{{H2O_STRLIT("expires")}, 36, 0, 0, 0, 0, 0, 0},
Expand Down
7 changes: 3 additions & 4 deletions lib/http1.c
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,10 @@ static size_t flatten_headers(char *buf, h2o_req_t *req, const char *connection)

/* send essential headers with the first chars uppercased for max. interoperability (#72) */
if (req->res.content_length != SIZE_MAX) {
dst += sprintf(dst, "HTTP/1.1 %d %s\r\nConnection: %s\r\nContent-Length: %zu\r\n", req->res.status,
req->res.reason, connection, req->res.content_length);
dst += sprintf(dst, "HTTP/1.1 %d %s\r\nConnection: %s\r\nContent-Length: %zu\r\n", req->res.status, req->res.reason,
connection, req->res.content_length);
} else {
dst += sprintf(dst, "HTTP/1.1 %d %s\r\nConnection: %s\r\n", req->res.status, req->res.reason,
connection);
dst += sprintf(dst, "HTTP/1.1 %d %s\r\nConnection: %s\r\n", req->res.status, req->res.reason, connection);
}
if (ctx->globalconf->server_name.len) {
dst += sprintf(dst, "Server: %s\r\n", ctx->globalconf->server_name.base);
Expand Down
3 changes: 1 addition & 2 deletions lib/http2/hpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,8 +878,7 @@ void h2o_hpack_flatten_request(h2o_buffer_t **buf, h2o_hpack_header_table_t *hea
}

void h2o_hpack_flatten_response(h2o_buffer_t **buf, h2o_hpack_header_table_t *header_table, uint32_t stream_id,
size_t max_frame_size, h2o_res_t *res, const h2o_iovec_t *server_name,
size_t content_length)
size_t max_frame_size, h2o_res_t *res, const h2o_iovec_t *server_name, size_t content_length)
{
size_t capacity = calc_headers_capacity(res->headers.entries, res->headers.size);
capacity += H2O_HTTP2_FRAME_HEADER_SIZE; /* for the first header */
Expand Down
2 changes: 1 addition & 1 deletion misc/tokens.pl
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ sub normalize_name {
30 0 0 0 0 0 0 content-range
31 0 0 0 0 0 0 content-type
32 0 0 0 0 0 1 cookie
33 0 1 0 0 0 0 date
33 0 0 0 0 0 0 date
34 0 0 0 0 0 0 etag
35 0 0 1 0 0 0 expect
36 0 0 0 0 0 0 expires
Expand Down

0 comments on commit d511644

Please sign in to comment.