in protocols/http2_protocol.c [299:379]
void serf__http2_protocol_init(serf_connection_t *conn)
{
serf_http2_protocol_t *h2;
apr_pool_t *protocol_pool;
serf_bucket_t *tmp;
const bool WE_ARE_CLIENT = true;
apr_pool_create(&protocol_pool, conn->pool);
h2 = apr_pcalloc(protocol_pool, sizeof(*h2));
h2->pool = protocol_pool;
h2->conn = conn;
h2->io = &conn->io;
h2->pump = &conn->pump;
h2->allocator = conn->allocator;
h2->config = conn->config;
/* Defaults until negotiated */
h2->rl_default_window = HTTP2_DEFAULT_WINDOW_SIZE;
h2->rl_window = HTTP2_DEFAULT_WINDOW_SIZE;
h2->rl_next_streamid = WE_ARE_CLIENT ? 2 : 1;
h2->rl_max_framesize = HTTP2_DEFAULT_MAX_FRAMESIZE;
h2->rl_max_headersize = APR_UINT32_MAX;
h2->rl_max_concurrent = HTTP2_DEFAULT_MAX_CONCURRENT;
h2->rl_hpack_table_size = HTTP2_DEFAULT_HPACK_TABLE_SIZE;
h2->rl_push_enabled = TRUE;
h2->lr_default_window = HTTP2_DEFAULT_WINDOW_SIZE;
h2->lr_window = HTTP2_DEFAULT_WINDOW_SIZE;
h2->lr_next_streamid = WE_ARE_CLIENT ? 1 : 2;
h2->lr_max_framesize = HTTP2_DEFAULT_MAX_FRAMESIZE;
h2->lr_max_headersize = APR_UINT32_MAX;
h2->lr_max_concurrent = HTTP2_DEFAULT_MAX_CONCURRENT;
h2->lr_hpack_table_size = HTTP2_DEFAULT_HPACK_TABLE_SIZE;
h2->lr_push_enabled = TRUE;
h2->rl_window_upd_below = 16 * 1024 * 1024; /* 16 MB*/
h2->rl_window_upd_to = 128 * 1024 * 1024; /* 128 MB */
h2->setting_acks = 0;
h2->enforce_flow_control = TRUE;
h2->continuation_bucket = NULL;
h2->continuation_streamid = 0;
h2->first = h2->last = NULL;
h2->hpack_tbl = serf__hpack_table_create(TRUE,
HTTP2_DEFAULT_HPACK_TABLE_SIZE,
protocol_pool);
apr_pool_cleanup_register(protocol_pool, h2, http2_protocol_cleanup,
apr_pool_cleanup_null);
conn->perform_read = http2_outgoing_read;
conn->perform_write = http2_outgoing_write;
conn->perform_hangup = http2_outgoing_hangup;
conn->perform_teardown = http2_outgoing_teardown;
conn->perform_pre_teardown = http2_outgoing_pre_teardown;
conn->perform_cancel_request = http2_cancel_request;
conn->perform_prioritize_request = http2_prioritize_request;
conn->protocol_baton = h2;
/* Disable HTTP/1.1 guessing that affects writability */
conn->probable_keepalive_limit = 0;
conn->max_outstanding_requests = 0;
/* Send the HTTP/2 Connection Preface */
tmp = SERF_BUCKET_SIMPLE_STRING(HTTP2_CONNECTION_PREFIX, h2->allocator);
serf_pump__add_output(h2->pump, tmp, false);
/* And now a settings frame */
tmp = serf__bucket_http2_frame_create(NULL, HTTP2_FRAME_TYPE_SETTINGS,
0,
NULL, NULL, NULL, /* stream: 0 */
h2->lr_max_framesize,
h2->allocator);
serf_http2__enqueue_frame(h2, tmp, FALSE);
/* And an initial window update */
http2_send_window_update(h2, NULL);
}