MCPcopy Create free account
hub / github.com/apache/httpd / h2_proxy_session_setup

Function h2_proxy_session_setup

modules/http2/h2_proxy_session.c:732–793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

730#endif
731
732h2_proxy_session *h2_proxy_session_setup(const char *id, proxy_conn_rec *p_conn,
733 proxy_server_conf *conf,
734 int h2_front,
735 unsigned char window_bits_connection,
736 unsigned char window_bits_stream,
737 h2_proxy_request_done *done)
738{
739 if (!p_conn->data) {
740 apr_pool_t *pool = p_conn->scpool;
741 h2_proxy_session *session;
742 nghttp2_session_callbacks *cbs;
743 nghttp2_option *option;
744
745 session = apr_pcalloc(pool, sizeof(*session));
746 apr_pool_pre_cleanup_register(pool, p_conn, proxy_session_pre_close);
747 p_conn->data = session;
748
749 session->id = apr_pstrdup(p_conn->scpool, id);
750 session->c = p_conn->connection;
751 session->p_conn = p_conn;
752 session->conf = conf;
753 session->pool = p_conn->scpool;
754 session->state = H2_PROXYS_ST_INIT;
755 session->h2_front = h2_front;
756 session->window_bits_stream = window_bits_stream;
757 session->window_bits_connection = window_bits_connection;
758 session->streams = h2_proxy_ihash_create(pool, offsetof(h2_proxy_stream, id));
759 session->suspended = h2_proxy_iq_create(pool, 5);
760 session->done = done;
761
762 session->input = apr_brigade_create(session->pool, session->c->bucket_alloc);
763 session->output = apr_brigade_create(session->pool, session->c->bucket_alloc);
764
765 nghttp2_session_callbacks_new(&cbs);
766 nghttp2_session_callbacks_set_on_frame_recv_callback(cbs, on_frame_recv);
767 nghttp2_session_callbacks_set_on_data_chunk_recv_callback(cbs, stream_response_data);
768 nghttp2_session_callbacks_set_on_stream_close_callback(cbs, on_stream_close);
769 nghttp2_session_callbacks_set_on_header_callback(cbs, on_header);
770 nghttp2_session_callbacks_set_before_frame_send_callback(cbs, before_frame_send);
771 nghttp2_session_callbacks_set_send_callback(cbs, raw_send);
772#ifdef H2_NG2_INVALID_HEADER_CB
773 nghttp2_session_callbacks_set_on_invalid_header_callback(cbs, on_invalid_header_cb);
774#endif
775 nghttp2_option_new(&option);
776 nghttp2_option_set_peer_max_concurrent_streams(option, 100);
777 nghttp2_option_set_no_auto_window_update(option, 0);
778
779 nghttp2_session_client_new2(&session->ngh2, cbs, session, option);
780
781 nghttp2_option_del(option);
782 nghttp2_session_callbacks_del(cbs);
783
784 ping_new_session(session, p_conn);
785 ap_log_cerror(APLOG_MARK, APLOG_DEBUG, 0, session->c, APLOGNO(03362)
786 "setup session for %s", p_conn->hostname);
787 }
788 else {
789 h2_proxy_session *session = p_conn->data;

Callers 1

ctx_runFunction · 0.85

Calls 4

h2_proxy_ihash_createFunction · 0.85
h2_proxy_iq_createFunction · 0.85
ping_new_sessionFunction · 0.85
ping_reuse_sessionFunction · 0.85

Tested by

no test coverage detected