[go: nahoru, domu]

Skip to content

Commit

Permalink
Merge branch 'master' into i110/http2client
Browse files Browse the repository at this point in the history
  • Loading branch information
i110 committed May 10, 2018
2 parents a53eefc + ff0d866 commit a697525
Show file tree
Hide file tree
Showing 29 changed files with 304 additions and 210 deletions.
16 changes: 14 additions & 2 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ Revision history for H2O.
- [fastcgi] accept `default` as a keyword of the extensions attribute #1414 (Ichito Nagata)
- [fastcgi] add verbose mode to fastcgi-cgi gateway #1466 (Kazuho Oku)
- [fastcgi][mruby][proxy] do not delay sending the headers until some chunk of body becomes available #1508 (Ichito Nagata)
- [fastcgi] index file name must be part of SCRIPT_NAME #1650 (Ichito Nagata)
- [http1][http2] support for server-timing #1646 (Ichito Nagata)
- [http2] support `critical` attribute in preload link header #1436 (Kazuho Oku, Frederik Deweerdt)
- [http2] do not compress cookies less than 20 bytes long #1389 (Julien Benoist)
- [http2] stop opening new push streams after receiving GOAWAY #1555 (Ichito Nagata)
- [http2] fix conformance issues #1579 #1582 #1599 (Kazuho Oku)
- [http2] continue to process active streams after sending GOAWAY upon graceful shutdown #1556 (Ichito Nagata)
- [mime] add .mjs as javascript file type #1398 (Jxck)
- [mime] more predefined types #1398 #1632 #1708 #1723 (Jxck, proyb6, OGINO Masanori)
- [mime] mark */*+json as compressible #1709 (OGINO Masanori)
- [mruby] allow running asynchronous operations unbounded to the Rack request being processed #1173 (Ichito Nagata)
- [mruby] drop the link rel=preload header with a x-http2-push-only attribute #1310 (Frederik Deweerdt)
- [mruby] add channel clas sand task method for parallel processing #1336 (Ritta Narita)
Expand All @@ -28,21 +31,30 @@ Revision history for H2O.
- [mruby] introduce `client-warning` header for error notification #1562 (Ichito Nagata)
- [mruby] allow fiber switch in constructor #1574 (Kazuho Oku)
- [mruby] fix crash when the rack handler returns a non-number status code #1576 (Kazuho Oku)
- [mruby] update mruby and modules #1462
- [mruby] allow loading a file that shares the basename with one of the preloaded files #1662 (Ichito Nagata)
- [mruby] add support for redis #1152 (Ichito Nagata)
- [mruby] replace iijson with mattn-json #1684 (Yannick Koechlin, Kazuho Oku)
- [mruby] update mruby and modules #1462 #1685
- [proxy] load balancing support (round-robin, least-conn) #1277 #1361 (Justin Zhu)
- [proxy] cap the amount of request body being buffered #1357 (Frederik Deweerdt)
- [proxy] cap the amount of response body being buffered #1358 (Frederik Deweerdt)
- [proxy] introduce separate timeouts for connection establishment and first-byte #1402 (Frederik Deweerdt)
- [proxy] forward the error to the client when upstream closes the connection abruptly #1490 (Ichito Nagata)
- [proxy] add option to skip supplementation of a `Date` header #1495 (Frederik Deweerdt)
- [proxy] do not abort when receiving an invalid transfer-encoding header from upstream #1688 (Ichito Nagata)
- [proxy] fix I/O error when receiving multiple informational responses #1716 (Frederik Deweerdt)
- [reproxy] connection pooling for reproxy #1434 (Ichito Nagata)
- [ssl] support redis as a data store for session cache / ticket #1087 (Ichito Nagata)
- [ssl] fix bug that prevents record size growing to maximum when latency optimization is disabled #1545 (Ichito Nagata)
- [ssl] unbundle libressl #1546 (Kazuho Oku)
- [ssl] add support for 425 Too Early status code #1344 (Kazuho Oku)
- [ssl] fix compatibility issues with libressl 2.7 #1707 (AIZAWA Hina)
- [ssl] update picotls to support TLS 1.3 draft-26 #1718 #xxx (Kazuho Oku)
- [libh2o] enable ECDH in the exmaple server #1602 (Varbin)
- [libh2o] emit less system calls in websocket #1590 (Baodong Chen)
- [libh2o] build examples using evloop #1589 (Baodong Chen)
- [libh2o] add API to release thread-local data #1624 (Baodong Chen)
- [libh2o] `h2o_gettimeofday` to obtain current time in microsecond order #1726 (Ichito Nagata)
- [misc] include process id in crash backtrace #1254 (Kazuho Oku)
- [misc] backtracing for BSD #1503 (Frederik Deweerdt)
- [misc] fix build issues for Android #1521 (Joel Winarske)
Expand Down
2 changes: 1 addition & 1 deletion examples/libh2o/redis-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <inttypes.h>
#include <unistd.h>
#include "h2o/redis.h"
#include "hiredis.h"
#include "h2o/hiredis_.h"

static h2o_loop_t *loop;
static int exit_loop;
Expand Down
2 changes: 1 addition & 1 deletion fuzz/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ static int create_accepted(int sfd, char *buf, size_t len, h2o_barrier_t **barri
{
int fd;
h2o_socket_t *sock;
struct timeval connected_at = *h2o_get_timestamp(&ctx, NULL, NULL);
struct timeval connected_at = h2o_gettimeofday(ctx.loop);

/* Create an HTTP[/2] client that will send the fuzzed request */
fd = feeder(sfd, buf, len, barrier);
Expand Down
8 changes: 4 additions & 4 deletions h2o.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
7D67C721204F8C0E0049E935 /* httpclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D67C720204F8C0E0049E935 /* httpclient.c */; };
7D67C722204F8C0E0049E935 /* httpclient.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D67C720204F8C0E0049E935 /* httpclient.c */; };
7D67C724204F8CA50049E935 /* httpclient.h in Headers */ = {isa = PBXBuildFile; fileRef = 7D67C723204F8C9B0049E935 /* httpclient.h */; };
7D0E5D5A20761BD800DA3E5A /* hiredis_.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DF88EF820761972005DB8D8 /* hiredis_.h */; };
7D9372FE202AC70F005FE6AB /* server_timing.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D9372FD202AC70F005FE6AB /* server_timing.c */; };
7D9372FF202AC717005FE6AB /* server_timing.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D9372FD202AC70F005FE6AB /* server_timing.c */; };
7D937300202AC717005FE6AB /* server_timing.c in Sources */ = {isa = PBXBuildFile; fileRef = 7D9372FD202AC70F005FE6AB /* server_timing.c */; };
Expand Down Expand Up @@ -841,6 +842,7 @@
7D9372FD202AC70F005FE6AB /* server_timing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server_timing.c; sourceTree = "<group>"; };
7D937301202AC7BA005FE6AB /* server_timing.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server_timing.c; sourceTree = "<group>"; };
7D9FA5381FC323AC00189F88 /* channel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = channel.c; sourceTree = "<group>"; };
7DF88EF820761972005DB8D8 /* hiredis_.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = hiredis_.h; sourceTree = "<group>"; };
D08137381FD400F4004679DF /* least_conn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = least_conn.c; sourceTree = "<group>"; };
D08137391FD400F4004679DF /* roundrobin.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = roundrobin.c; sourceTree = "<group>"; };
D081373D1FD40431004679DF /* least_conn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = least_conn.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1539,6 +1541,7 @@
107923A319A3215F00C52AD6 /* websocket.h */,
104B9A2C1A4BE029009EEE64 /* version.h */,
08790DE11D8275C100A04BC1 /* redis.h */,
7DF88EF820761972005DB8D8 /* hiredis_.h */,
);
path = h2o;
sourceTree = "<group>";
Expand Down Expand Up @@ -2170,6 +2173,7 @@
107923A519A3215F00C52AD6 /* http1.h in Headers */,
10A3D3D31B4CDF1200327CF9 /* memcached.h in Headers */,
08790DE01D8015A400A04BC1 /* sds.h in Headers */,
7D0E5D5A20761BD800DA3E5A /* hiredis_.h in Headers */,
106C22FA1C040F7800405689 /* tunnel.h in Headers */,
08790DE21D8275DE00A04BC1 /* redis.h in Headers */,
0812AB211D7FCFEB00004F23 /* async.h in Headers */,
Expand Down Expand Up @@ -2942,7 +2946,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -3086,7 +3089,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = macosx;
};
name = "libuv-release";
Expand Down Expand Up @@ -3220,7 +3222,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
Expand Down Expand Up @@ -3261,7 +3262,6 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.9;
SDKROOT = macosx;
};
name = "evloop-release";
Expand Down
28 changes: 13 additions & 15 deletions include/h2o.h
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,6 @@ struct st_h2o_context_t {
void **_module_configs;

struct {
uint64_t uv_now_at;
struct timeval tv_at;
h2o_timestamp_string_t *value;
} _timestamp_cache;
Expand Down Expand Up @@ -1538,15 +1537,16 @@ void h2o_context_init_pathconf_context(h2o_context_t *ctx, h2o_pathconf_t *pathc
*
*/
void h2o_context_dispose_pathconf_context(h2o_context_t *ctx, h2o_pathconf_t *pathconf);

/**
* returns current timestamp
* @param ctx the context
* @param pool memory pool (used when ts != NULL)
* @param ts buffer to store the timestamp (optional)
* @return current time in UTC
*/
static struct timeval *h2o_get_timestamp(h2o_context_t *ctx, h2o_mem_pool_t *pool, h2o_timestamp_t *ts);
void h2o_context_update_timestamp_cache(h2o_context_t *ctx);
static h2o_timestamp_t h2o_get_timestamp(h2o_context_t *ctx, h2o_mem_pool_t *pool);
void h2o_context_update_timestamp_string_cache(h2o_context_t *ctx);
/**
* returns per-module context set
*/
Expand Down Expand Up @@ -2152,21 +2152,19 @@ inline void h2o_setup_next_prefilter(h2o_req_prefilter_t *self, h2o_req_t *req,
h2o_setup_next_ostream(req, slot);
}

inline struct timeval *h2o_get_timestamp(h2o_context_t *ctx, h2o_mem_pool_t *pool, h2o_timestamp_t *ts)
inline h2o_timestamp_t h2o_get_timestamp(h2o_context_t *ctx, h2o_mem_pool_t *pool)
{
uint64_t now = h2o_now(ctx->loop);

if (ctx->_timestamp_cache.uv_now_at != now) {
h2o_context_update_timestamp_cache(ctx);
}
time_t prev_sec = ctx->_timestamp_cache.tv_at.tv_sec;
ctx->_timestamp_cache.tv_at = h2o_gettimeofday(ctx->loop);
if (ctx->_timestamp_cache.tv_at.tv_sec != prev_sec)
h2o_context_update_timestamp_string_cache(ctx);

if (ts != NULL) {
ts->at = ctx->_timestamp_cache.tv_at;
h2o_mem_link_shared(pool, ctx->_timestamp_cache.value);
ts->str = ctx->_timestamp_cache.value;
}
h2o_timestamp_t ts;
ts.at = ctx->_timestamp_cache.tv_at;
h2o_mem_link_shared(pool, ctx->_timestamp_cache.value);
ts.str = ctx->_timestamp_cache.value;

return &ctx->_timestamp_cache.tv_at;
return ts;
}

inline void *h2o_context_get_handler_context(h2o_context_t *ctx, h2o_handler_t *handler)
Expand Down
27 changes: 27 additions & 0 deletions include/h2o/hiredis_.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* Copyright (c) 2018 Fastly Inc, Ichito Nagata
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
* deal in the Software without restriction, including without limitation the
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
* sell copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#include "hiredis.h"
#include "async.h"
#pragma GCC diagnostic pop
6 changes: 3 additions & 3 deletions include/h2o/http2_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -443,11 +443,11 @@ inline void h2o_http2_stream_set_state(h2o_http2_conn_t *conn, h2o_http2_stream_
else
h2o_http2_stream_update_open_slot(stream, &conn->num_streams.pull);
stream->state = new_state;
stream->req.timestamps.request_begin_at = *h2o_get_timestamp(conn->super.ctx, NULL, NULL);
stream->req.timestamps.request_begin_at = h2o_gettimeofday(conn->super.ctx->loop);
break;
case H2O_HTTP2_STREAM_STATE_RECV_BODY:
stream->state = new_state;
stream->req.timestamps.request_body_begin_at = *h2o_get_timestamp(conn->super.ctx, NULL, NULL);
stream->req.timestamps.request_body_begin_at = h2o_gettimeofday(conn->super.ctx->loop);
break;
case H2O_HTTP2_STREAM_STATE_REQ_PENDING:
stream->state = new_state;
Expand Down Expand Up @@ -487,7 +487,7 @@ inline void h2o_http2_stream_set_state(h2o_http2_conn_t *conn, h2o_http2_stream_
break;
}
stream->state = new_state;
stream->req.timestamps.response_end_at = *h2o_get_timestamp(conn->super.ctx, NULL, NULL);
stream->req.timestamps.response_end_at = h2o_gettimeofday(conn->super.ctx->loop);
--stream->_num_streams_slot->open;
stream->_num_streams_slot = NULL;
if (stream->blocked_by_server)
Expand Down
6 changes: 6 additions & 0 deletions include/h2o/socket/evloop.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ typedef struct st_h2o_evloop_t {
struct st_h2o_evloop_socket_t **tail_ref;
} _statechanged;
uint64_t _now;
struct timeval _tv_at;
h2o_linklist_t _timeouts; /* list of h2o_timeout_t */
h2o_sliding_counter_t exec_time_counter;
} h2o_evloop_t;
Expand All @@ -61,6 +62,11 @@ int h2o_evloop_run(h2o_evloop_t *loop, int32_t max_wait);

/* inline definitions */

static inline struct timeval h2o_gettimeofday(h2o_evloop_t *loop)
{
return loop->_tv_at;
}

static inline uint64_t h2o_now(h2o_evloop_t *loop)
{
return loop->_now;
Expand Down
7 changes: 7 additions & 0 deletions include/h2o/socket/uv-binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,13 @@ struct st_h2o_timeout_backend_properties_t {
h2o_socket_t *h2o_uv_socket_create(uv_handle_t *handle, uv_close_cb close_cb);
h2o_socket_t *h2o_uv__poll_create(h2o_loop_t *loop, int fd, uv_close_cb close_cb);

static inline struct timeval h2o_gettimeofday(uv_loop_t *loop)
{
struct timeval tv_at;
gettimeofday(&tv_at, NULL);
return tv_at;
}

static inline uint64_t h2o_now(uv_loop_t *loop)
{
return uv_now(loop);
Expand Down
2 changes: 1 addition & 1 deletion lib/common/http1client.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static void on_head(h2o_socket_t *sock, const char *err)

h2o_mem_init_pool(&pool);

headers = h2o_mem_alloc_pool(&pool, *headers, MAX_HEADERS);
headers = h2o_mem_alloc_pool(&pool, *headers, MAX_HEADERS);
header_names = h2o_mem_alloc_pool(&pool, *header_names, MAX_HEADERS);

/* continue parsing the responses until we see a final one */
Expand Down
3 changes: 1 addition & 2 deletions lib/common/redis.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@
* IN THE SOFTWARE.
*/
#include <errno.h>
#include "async.h"
#include "hiredis.h"
#include "h2o/redis.h"
#include "h2o/hiredis_.h"
#include "h2o/socket.h"

const char *const h2o_redis_error_connection = "Connection Error";
Expand Down
3 changes: 3 additions & 0 deletions lib/common/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@
#endif

#define OPENSSL_HOSTNAME_VALIDATION_LINKAGE static
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshorten-64-to-32"
#include "../../deps/ssl-conservatory/openssl/openssl_hostname_validation.c"
#pragma GCC diagnostic pop

struct st_h2o_socket_ssl_t {
SSL_CTX *ssl_ctx;
Expand Down
5 changes: 2 additions & 3 deletions lib/common/socket/evloop.c.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,8 @@ h2o_evloop_t *create_evloop(size_t sz)

void update_now(h2o_evloop_t *loop)
{
struct timeval tv;
gettimeofday(&tv, NULL);
loop->_now = (uint64_t)tv.tv_sec * 1000 + tv.tv_usec / 1000;
gettimeofday(&loop->_tv_at, NULL);
loop->_now = (uint64_t)loop->_tv_at.tv_sec * 1000 + loop->_tv_at.tv_usec / 1000;
}

int32_t adjust_max_wait(h2o_evloop_t *loop, int32_t max_wait)
Expand Down
2 changes: 1 addition & 1 deletion lib/common/url.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static h2o_iovec_t rebuild_path(h2o_mem_pool_t *pool, const char *src, size_t sr

/* dst can be 1 byte more than src if src is missing the prefixing '/' */
dst = h2o_mem_alloc_pool(pool, char, src_len + 1);
*norm_indexes = h2o_mem_alloc_pool(pool, *norm_indexes[0], (src_len + 1));
*norm_indexes = h2o_mem_alloc_pool(pool, *norm_indexes[0], (src_len + 1));

if (src[0] == '/')
src_off++;
Expand Down
8 changes: 8 additions & 0 deletions lib/core/configurator.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,12 @@ static int on_config_error_log_emit_request_errors(h2o_configurator_command_t *c
return 0;
}

static int on_config_stash(h2o_configurator_command_t *cmd, h2o_configurator_context_t *ctx, yoml_t *node)
{
/* do nothing */
return 0;
}

void h2o_configurator__init_core(h2o_globalconf_t *conf)
{
/* check if already initialized */
Expand Down Expand Up @@ -974,6 +980,8 @@ void h2o_configurator__init_core(h2o_globalconf_t *conf)
h2o_configurator_define_command(&c->super, "error-log.emit-request-errors",
H2O_CONFIGURATOR_FLAG_ALL_LEVELS | H2O_CONFIGURATOR_FLAG_EXPECT_SCALAR,
on_config_error_log_emit_request_errors);
h2o_configurator_define_command(&c->super, "stash", H2O_CONFIGURATOR_FLAG_ALL_LEVELS,
on_config_stash);
}
}

Expand Down
22 changes: 8 additions & 14 deletions lib/core/context.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,19 +203,13 @@ void h2o_context_request_shutdown(h2o_context_t *ctx)
ctx->globalconf->http2.callbacks.request_shutdown(ctx);
}

void h2o_context_update_timestamp_cache(h2o_context_t *ctx)
void h2o_context_update_timestamp_string_cache(h2o_context_t *ctx)
{
time_t prev_sec = ctx->_timestamp_cache.tv_at.tv_sec;
ctx->_timestamp_cache.uv_now_at = h2o_now(ctx->loop);
gettimeofday(&ctx->_timestamp_cache.tv_at, NULL);
if (ctx->_timestamp_cache.tv_at.tv_sec != prev_sec) {
struct tm gmt;
/* update the string cache */
if (ctx->_timestamp_cache.value != NULL)
h2o_mem_release_shared(ctx->_timestamp_cache.value);
ctx->_timestamp_cache.value = h2o_mem_alloc_shared(NULL, sizeof(h2o_timestamp_string_t), NULL);
gmtime_r(&ctx->_timestamp_cache.tv_at.tv_sec, &gmt);
h2o_time2str_rfc1123(ctx->_timestamp_cache.value->rfc1123, &gmt);
h2o_time2str_log(ctx->_timestamp_cache.value->log, ctx->_timestamp_cache.tv_at.tv_sec);
}
struct tm gmt;
if (ctx->_timestamp_cache.value != NULL)
h2o_mem_release_shared(ctx->_timestamp_cache.value);
ctx->_timestamp_cache.value = h2o_mem_alloc_shared(NULL, sizeof(h2o_timestamp_string_t), NULL);
gmtime_r(&ctx->_timestamp_cache.tv_at.tv_sec, &gmt);
h2o_time2str_rfc1123(ctx->_timestamp_cache.value->rfc1123, &gmt);
h2o_time2str_log(ctx->_timestamp_cache.value->log, ctx->_timestamp_cache.tv_at.tv_sec);
}
5 changes: 2 additions & 3 deletions lib/core/request.c
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ h2o_hostconf_t *h2o_req_setup(h2o_req_t *req)
h2o_context_t *ctx = req->conn->ctx;
h2o_hostconf_t *hostconf;

h2o_get_timestamp(ctx, &req->pool, &req->processed_at);
req->processed_at = h2o_get_timestamp(ctx, &req->pool);

/* find the host context */
if (req->input.authority.base != NULL) {
Expand Down Expand Up @@ -732,7 +732,6 @@ h2o_iovec_t h2o_push_path_in_link_header(h2o_req_t *req, const char *value, size

void h2o_resp_add_date_header(h2o_req_t *req)
{
h2o_timestamp_t ts;
h2o_get_timestamp(req->conn->ctx, &req->pool, &ts);
h2o_timestamp_t ts = h2o_get_timestamp(req->conn->ctx, &req->pool);
h2o_add_header(&req->pool, &req->res.headers, H2O_TOKEN_DATE, NULL, ts.str->rfc1123, strlen(ts.str->rfc1123));
}
Loading

0 comments on commit a697525

Please sign in to comment.