free(ctx->content_type);
ctx->content_type = NULL;
}
+ ctx->headers = NULL;
+ ctx->headers_pool = NULL;
}
static void http_status_reinit_error(struct http_ctx *ctx, int stream_id)
} else {
ctx->current_stream = set_error_status(ctx, stream_id, 200, NULL);
}
+
+
+ ctx->headers_pool = mm_ctx_mempool2(MM_DEFAULT_BLKSIZE);
+ ctx->headers = mm_calloc(&ctx->headers_pool, num_of_headers, sizeof(char*));
return 0;
}
return 0;
}
+
+ // TODO: alloc and store headers to ctx->headers array
+
if (!strcasecmp(":path", (const char *)name)) {
int rc = check_uri(ctx, stream_id, (const char *)value);
if (rc < 0) {
ctx->uri_path = NULL;
ctx->content_type = NULL;
array_init(ctx->stream_status);
-
+ ctx->headers_pool = NULL;
+ ctx->headers = NULL;
nghttp2_session_server_new(&ctx->h2, callbacks, ctx);
nghttp2_submit_settings(ctx->h2, NGHTTP2_FLAG_NONE,
ssize_t buf_size;
array_t(struct http_stream_status*) stream_status;
struct http_stream_status *current_stream;
+ knot_mm_t *headers_pool;
+ char **headers;
};
#if ENABLE_DOH2
req->qsource.stream_id = -1;
#if ENABLE_DOH2
if (req->qsource.flags.http) {
+ req->pool_headers = http_ctx->headers_pool;
struct http_ctx *http_ctx = session_http_get_server_ctx(session);
req->qsource.stream_id = queue_head(http_ctx->streams);
+ req->qsource.headers = http_ctx->headers;
}
#endif
/* We need to store a copy of peer address. */
pool_release(worker, ctx->req.pool.ctx);
/* @note The 'task' is invalidated from now on. */
worker->stats.rconcurrent -= 1;
+ // TODO: release pool_headers
}
static struct qr_task *qr_task_create(struct request_ctx *ctx)
struct kr_request_qsource_flags flags; /**< See definition above. */
size_t size; /**< query packet size */
int32_t stream_id; /**< HTTP/2 stream ID for DoH requests */
+ char **headers;
} qsource;
struct {
unsigned rtt; /**< Current upstream RTT */
trace_callback_f trace_finish; /**< Request finish tracepoint */
int vars_ref; /**< Reference to per-request variable table. LUA_NOREF if not set. */
knot_mm_t pool;
+ knot_mm_t pool_headers;
unsigned int uid; /**< for logging purposes only */
struct {
addr_info_f is_tls_capable;