Lines Matching refs:ts
83 struct tunnel_stream *ts) in tunnel_stream_init() argument
90 ts->state = H2_TUNNEL_INIT; in tunnel_stream_init()
91 ts->stream_id = -1; in tunnel_stream_init()
92 Curl_bufq_init2(&ts->recvbuf, PROXY_H2_CHUNK_SIZE, H2_TUNNEL_RECV_CHUNKS, in tunnel_stream_init()
94 Curl_bufq_init(&ts->sendbuf, PROXY_H2_CHUNK_SIZE, H2_TUNNEL_SEND_CHUNKS); in tunnel_stream_init()
100 ts->authority = /* host:port with IPv6 support */ in tunnel_stream_init()
103 if(!ts->authority) in tunnel_stream_init()
109 static void tunnel_stream_clear(struct tunnel_stream *ts) in tunnel_stream_clear() argument
111 Curl_http_resp_free(ts->resp); in tunnel_stream_clear()
112 Curl_bufq_free(&ts->recvbuf); in tunnel_stream_clear()
113 Curl_bufq_free(&ts->sendbuf); in tunnel_stream_clear()
114 Curl_safefree(ts->authority); in tunnel_stream_clear()
115 memset(ts, 0, sizeof(*ts)); in tunnel_stream_clear()
116 ts->state = H2_TUNNEL_INIT; in tunnel_stream_clear()
120 struct tunnel_stream *ts, in h2_tunnel_go_state() argument
126 if(ts->state == new_state) in h2_tunnel_go_state()
129 switch(ts->state) { in h2_tunnel_go_state()
139 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'init'", ts->stream_id); in h2_tunnel_go_state()
140 tunnel_stream_clear(ts); in h2_tunnel_go_state()
144 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'connect'", ts->stream_id); in h2_tunnel_go_state()
145 ts->state = H2_TUNNEL_CONNECT; in h2_tunnel_go_state()
149 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'response'", ts->stream_id); in h2_tunnel_go_state()
150 ts->state = H2_TUNNEL_RESPONSE; in h2_tunnel_go_state()
155 ts->stream_id); in h2_tunnel_go_state()
162 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'failed'", ts->stream_id); in h2_tunnel_go_state()
163 ts->state = new_state; in h2_tunnel_go_state()
818 struct tunnel_stream *ts; in tunnel_send_callback() local
829 ts = nghttp2_session_get_stream_user_data(session, stream_id); in tunnel_send_callback()
830 if(!ts) in tunnel_send_callback()
832 DEBUGASSERT(ts == &ctx->tunnel); in tunnel_send_callback()
834 nread = Curl_bufq_read(&ts->sendbuf, buf, length, &result); in tunnel_send_callback()
840 if(ts->closed && Curl_bufq_is_empty(&ts->sendbuf)) in tunnel_send_callback()
844 ts->stream_id, nread); in tunnel_send_callback()
954 struct tunnel_stream *ts) in submit_CONNECT() argument
969 result = proxy_h2_submit(&ts->stream_id, cf, data, ctx->h2, req, in submit_CONNECT()
970 NULL, ts, tunnel_send_callback, cf); in submit_CONNECT()
973 ts->stream_id, nghttp2_strerror(ts->stream_id)); in submit_CONNECT()
986 struct tunnel_stream *ts) in inspect_response() argument
992 DEBUGASSERT(ts->resp); in inspect_response()
993 if(ts->resp->status/100 == 2) { in inspect_response()
994 infof(data, "CONNECT tunnel established, response %d", ts->resp->status); in inspect_response()
995 h2_tunnel_go_state(cf, ts, H2_TUNNEL_ESTABLISHED, data); in inspect_response()
999 if(ts->resp->status == 401) { in inspect_response()
1000 auth_reply = Curl_dynhds_cget(&ts->resp->headers, "WWW-Authenticate"); in inspect_response()
1002 else if(ts->resp->status == 407) { in inspect_response()
1003 auth_reply = Curl_dynhds_cget(&ts->resp->headers, "Proxy-Authenticate"); in inspect_response()
1009 result = Curl_http_input_auth(data, ts->resp->status == 407, in inspect_response()
1016 h2_tunnel_go_state(cf, ts, H2_TUNNEL_INIT, data); in inspect_response()
1027 struct tunnel_stream *ts) in H2_CONNECT() argument
1032 DEBUGASSERT(ts); in H2_CONNECT()
1033 DEBUGASSERT(ts->authority); in H2_CONNECT()
1035 switch(ts->state) { in H2_CONNECT()
1038 CURL_TRC_CF(data, cf, "[0] CONNECT start for %s", ts->authority); in H2_CONNECT()
1039 result = submit_CONNECT(cf, data, ts); in H2_CONNECT()
1042 h2_tunnel_go_state(cf, ts, H2_TUNNEL_CONNECT, data); in H2_CONNECT()
1051 h2_tunnel_go_state(cf, ts, H2_TUNNEL_FAILED, data); in H2_CONNECT()
1055 if(ts->has_final_response) { in H2_CONNECT()
1056 h2_tunnel_go_state(cf, ts, H2_TUNNEL_RESPONSE, data); in H2_CONNECT()
1065 DEBUGASSERT(ts->has_final_response); in H2_CONNECT()
1066 result = inspect_response(cf, data, ts); in H2_CONNECT()
1081 } while(ts->state == H2_TUNNEL_INIT); in H2_CONNECT()
1085 h2_tunnel_go_state(cf, ts, H2_TUNNEL_FAILED, data); in H2_CONNECT()
1097 struct tunnel_stream *ts = &ctx->tunnel; in cf_h2_proxy_connect() local
1119 DEBUGASSERT(ts->authority); in cf_h2_proxy_connect()
1131 result = H2_CONNECT(cf, data, ts); in cf_h2_proxy_connect()
1134 *done = (result == CURLE_OK) && (ts->state == H2_TUNNEL_ESTABLISHED); in cf_h2_proxy_connect()