Lines Matching refs:data
96 struct Curl_easy *data, in tunnel_reinit() argument
99 (void)data; in tunnel_reinit()
112 struct Curl_easy *data, in tunnel_init() argument
118 failf(data, "%s cannot be done over CONNECT", cf->conn->handler->scheme); in tunnel_init()
126 infof(data, "allocate connect buffer"); in tunnel_init()
130 Curl_httpchunk_init(data, &ts->ch, TRUE); in tunnel_init()
134 return tunnel_reinit(cf, data, ts); in tunnel_init()
140 struct Curl_easy *data) in h1_tunnel_go_state() argument
147 CURL_TRC_CF(data, cf, "new tunnel state 'init'"); in h1_tunnel_go_state()
148 tunnel_reinit(cf, data, ts); in h1_tunnel_go_state()
152 CURL_TRC_CF(data, cf, "new tunnel state 'connect'"); in h1_tunnel_go_state()
159 CURL_TRC_CF(data, cf, "new tunnel state 'receive'"); in h1_tunnel_go_state()
164 CURL_TRC_CF(data, cf, "new tunnel state 'response'"); in h1_tunnel_go_state()
169 CURL_TRC_CF(data, cf, "new tunnel state 'established'"); in h1_tunnel_go_state()
170 infof(data, "CONNECT phase completed"); in h1_tunnel_go_state()
171 data->state.authproxy.done = TRUE; in h1_tunnel_go_state()
172 data->state.authproxy.multipass = FALSE; in h1_tunnel_go_state()
176 CURL_TRC_CF(data, cf, "new tunnel state 'failed'"); in h1_tunnel_go_state()
181 data->info.httpcode = 0; /* clear it as it might've been used for the in h1_tunnel_go_state()
186 Curl_safefree(data->state.aptr.proxyuserpwd); in h1_tunnel_go_state()
188 data->state.hconnect = FALSE; in h1_tunnel_go_state()
195 struct Curl_easy *data) in tunnel_free() argument
200 h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); in tunnel_free()
203 Curl_httpchunk_free(data, &ts->ch); in tunnel_free()
217 struct Curl_easy *data, in start_CONNECT() argument
227 Curl_safefree(data->req.newurl); in start_CONNECT()
229 result = Curl_http_proxy_create_CONNECT(&req, cf, data, 1); in start_CONNECT()
233 infof(data, "Establish HTTP proxy tunnel to %s", req->authority); in start_CONNECT()
242 result = Curl_creader_set_null(data); in start_CONNECT()
246 failf(data, "Failed sending CONNECT to proxy"); in start_CONNECT()
253 struct Curl_easy *data, in send_CONNECT() argument
269 nwritten = cf->next->cft->do_send(cf->next, data, buf, blen, FALSE, &result); in send_CONNECT()
279 Curl_debug(data, CURLINFO_HEADER_OUT, buf, (size_t)nwritten); in send_CONNECT()
283 failf(data, "Failed sending CONNECT to proxy"); in send_CONNECT()
289 struct Curl_easy *data, in on_resp_header() argument
294 struct SingleRequest *k = &data->req; in on_resp_header()
307 CURL_TRC_CF(data, cf, "CONNECT: fwd auth header '%s'", header); in on_resp_header()
308 result = Curl_http_input_auth(data, proxy, auth); in on_resp_header()
320 infof(data, "Ignoring Content-Length in CONNECT %03d response", in on_resp_header()
336 infof(data, "Ignoring Transfer-Encoding in " in on_resp_header()
342 infof(data, "CONNECT responded chunked"); in on_resp_header()
345 Curl_httpchunk_reset(data, &ts->ch, TRUE); in on_resp_header()
358 data->info.httpproxycode = k->httpcode = (header[9] - '0') * 100 + in on_resp_header()
365 struct Curl_easy *data, in recv_CONNECT_resp() argument
370 struct SingleRequest *k = &data->req; in recv_CONNECT_resp()
381 if(!Curl_conn_data_pending(data, cf->sockindex)) in recv_CONNECT_resp()
390 result = Curl_conn_recv(data, cf->sockindex, &byte, 1, &nread); in recv_CONNECT_resp()
395 if(Curl_pgrsUpdate(data)) in recv_CONNECT_resp()
404 if(data->set.proxyauth && data->state.authproxy.avail && in recv_CONNECT_resp()
405 data->state.aptr.proxyuserpwd) { in recv_CONNECT_resp()
409 infof(data, "Proxy CONNECT connection closed"); in recv_CONNECT_resp()
413 failf(data, "Proxy CONNECT aborted"); in recv_CONNECT_resp()
438 result = Curl_httpchunk_read(data, &ts->ch, &byte, 1, &consumed); in recv_CONNECT_resp()
441 if(Curl_httpchunk_is_done(data, &ts->ch)) { in recv_CONNECT_resp()
443 infof(data, "chunk reading DONE"); in recv_CONNECT_resp()
451 failf(data, "CONNECT response too large"); in recv_CONNECT_resp()
464 Curl_debug(data, CURLINFO_HEADER_IN, linep, line_len); in recv_CONNECT_resp()
469 result = Curl_client_write(data, writetype, linep, line_len); in recv_CONNECT_resp()
473 result = Curl_bump_headersize(data, line_len, TRUE); in recv_CONNECT_resp()
485 if((407 == k->httpcode) && !data->state.authproblem) { in recv_CONNECT_resp()
492 infof(data, "Ignore %" FMT_OFF_T " bytes of response-body", ts->cl); in recv_CONNECT_resp()
495 infof(data, "Ignore chunked response-body"); in recv_CONNECT_resp()
501 CURL_TRC_CF(data, cf, "CONNECT: no content-length or chunked"); in recv_CONNECT_resp()
514 result = on_resp_header(cf, data, ts, linep); in recv_CONNECT_resp()
524 if(!result && *done && data->info.httpproxycode/100 != 2) { in recv_CONNECT_resp()
527 result = Curl_http_auth_act(data); in recv_CONNECT_resp()
535 struct Curl_easy *data, in CONNECT_host() argument
556 if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("Host"))) { in CONNECT_host()
570 struct Curl_easy *data, in start_CONNECT() argument
574 struct hyptransfer *h = &data->hyp; in start_CONNECT()
575 curl_socket_t tunnelsocket = Curl_conn_cf_get_socket(cf, data); in start_CONNECT()
591 failf(data, "Couldn't create hyper IO"); in start_CONNECT()
596 h->io_ctx.data = data; in start_CONNECT()
603 data->state.hconnect = TRUE; in start_CONNECT()
609 failf(data, "Couldn't create hyper executor"); in start_CONNECT()
617 failf(data, "Couldn't create hyper client options"); in start_CONNECT()
630 failf(data, "Couldn't create hyper client handshake"); in start_CONNECT()
638 failf(data, "Couldn't hyper_executor_push the handshake"); in start_CONNECT()
646 failf(data, "Couldn't hyper_executor_poll the handshake"); in start_CONNECT()
656 failf(data, "Couldn't hyper_request_new"); in start_CONNECT()
662 failf(data, "error setting method"); in start_CONNECT()
670 Curl_safefree(data->req.newurl); in start_CONNECT()
672 result = CONNECT_host(cf, data, &authority, &host_header); in start_CONNECT()
676 infof(data, "Establish HTTP proxy tunnel to %s", authority); in start_CONNECT()
680 failf(data, "error setting path"); in start_CONNECT()
684 if(data->set.verbose) { in start_CONNECT()
690 Curl_debug(data, CURLINFO_HEADER_OUT, se, strlen(se)); in start_CONNECT()
694 result = Curl_http_output_auth(data, conn, "CONNECT", HTTPREQ_GET, in start_CONNECT()
704 failf(data, "error setting HTTP version"); in start_CONNECT()
711 failf(data, "hyper_request_headers"); in start_CONNECT()
716 result = Curl_hyper_header(data, headers, host_header); in start_CONNECT()
722 if(data->state.aptr.proxyuserpwd) { in start_CONNECT()
723 result = Curl_hyper_header(data, headers, in start_CONNECT()
724 data->state.aptr.proxyuserpwd); in start_CONNECT()
729 if(!Curl_checkProxyheaders(data, conn, STRCONST("User-Agent")) && in start_CONNECT()
730 data->set.str[STRING_USERAGENT] && *data->set.str[STRING_USERAGENT]) { in start_CONNECT()
734 data->set.str[STRING_USERAGENT]); in start_CONNECT()
737 result = Curl_hyper_header(data, headers, Curl_dyn_ptr(&ua)); in start_CONNECT()
743 if(!Curl_checkProxyheaders(data, conn, STRCONST("Proxy-Connection"))) { in start_CONNECT()
744 result = Curl_hyper_header(data, headers, in start_CONNECT()
750 result = Curl_add_custom_headers(data, TRUE, headers); in start_CONNECT()
754 result = Curl_creader_set_null(data); in start_CONNECT()
760 failf(data, "hyper_clientconn_send"); in start_CONNECT()
767 failf(data, "Couldn't hyper_executor_push the send"); in start_CONNECT()
794 struct Curl_easy *data, in send_CONNECT() argument
798 struct hyptransfer *h = &data->hyp; in send_CONNECT()
825 failf(data, "Hyper: %.*s", (int)errlen, errbuf); in send_CONNECT()
832 struct Curl_easy *data, in recv_CONNECT_resp() argument
836 struct hyptransfer *h = &data->hyp; in recv_CONNECT_resp()
841 result = Curl_hyper_stream(data, cf->conn, &didwhat, in recv_CONNECT_resp()
843 *done = data->req.done; in recv_CONNECT_resp()
864 struct Curl_easy *data, in H1_CONNECT() argument
879 check = Curl_timeleft(data, NULL, TRUE); in H1_CONNECT()
881 failf(data, "Proxy CONNECT aborted due to timeout"); in H1_CONNECT()
889 CURL_TRC_CF(data, cf, "CONNECT start"); in H1_CONNECT()
890 result = start_CONNECT(cf, data, ts); in H1_CONNECT()
893 h1_tunnel_go_state(cf, ts, H1_TUNNEL_CONNECT, data); in H1_CONNECT()
898 CURL_TRC_CF(data, cf, "CONNECT send"); in H1_CONNECT()
899 result = send_CONNECT(cf, data, ts, &done); in H1_CONNECT()
902 h1_tunnel_go_state(cf, ts, H1_TUNNEL_RECEIVE, data); in H1_CONNECT()
907 CURL_TRC_CF(data, cf, "CONNECT receive"); in H1_CONNECT()
908 result = recv_CONNECT_resp(cf, data, ts, &done); in H1_CONNECT()
909 if(Curl_pgrsUpdate(data)) { in H1_CONNECT()
917 h1_tunnel_go_state(cf, ts, H1_TUNNEL_RESPONSE, data); in H1_CONNECT()
921 CURL_TRC_CF(data, cf, "CONNECT response"); in H1_CONNECT()
922 if(data->req.newurl) { in H1_CONNECT()
927 Curl_req_soft_reset(&data->req, data); in H1_CONNECT()
934 CURL_TRC_CF(data, cf, "CONNECT need to close+open"); in H1_CONNECT()
935 infof(data, "Connect me again please"); in H1_CONNECT()
936 Curl_conn_cf_close(cf, data); in H1_CONNECT()
938 result = Curl_conn_cf_connect(cf->next, data, FALSE, &done); in H1_CONNECT()
943 h1_tunnel_go_state(cf, ts, H1_TUNNEL_INIT, data); in H1_CONNECT()
952 } while(data->req.newurl); in H1_CONNECT()
955 if(data->info.httpproxycode/100 != 2) { in H1_CONNECT()
957 Curl_safefree(data->req.newurl); in H1_CONNECT()
960 h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); in H1_CONNECT()
961 failf(data, "CONNECT tunnel failed, response %d", data->req.httpcode); in H1_CONNECT()
965 h1_tunnel_go_state(cf, ts, H1_TUNNEL_ESTABLISHED, data); in H1_CONNECT()
966 infof(data, "CONNECT tunnel established, response %d", in H1_CONNECT()
967 data->info.httpproxycode); in H1_CONNECT()
972 h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); in H1_CONNECT()
977 struct Curl_easy *data, in cf_h1_proxy_connect() argument
988 CURL_TRC_CF(data, cf, "connect"); in cf_h1_proxy_connect()
989 result = cf->next->cft->do_connect(cf->next, data, blocking, done); in cf_h1_proxy_connect()
995 result = tunnel_init(cf, data, &ts); in cf_h1_proxy_connect()
1004 result = H1_CONNECT(cf, data, ts); in cf_h1_proxy_connect()
1007 Curl_safefree(data->state.aptr.proxyuserpwd); in cf_h1_proxy_connect()
1014 Curl_req_soft_reset(&data->req, data); in cf_h1_proxy_connect()
1015 Curl_client_reset(data); in cf_h1_proxy_connect()
1016 Curl_pgrsSetUploadCounter(data, 0); in cf_h1_proxy_connect()
1017 Curl_pgrsSetDownloadCounter(data, 0); in cf_h1_proxy_connect()
1019 tunnel_free(cf, data); in cf_h1_proxy_connect()
1025 struct Curl_easy *data, in cf_h1_proxy_adjust_pollset() argument
1033 curl_socket_t sock = Curl_conn_cf_get_socket(cf, data); in cf_h1_proxy_adjust_pollset()
1040 Curl_pollset_set_out_only(data, ps, sock); in cf_h1_proxy_adjust_pollset()
1042 Curl_pollset_set_in_only(data, ps, sock); in cf_h1_proxy_adjust_pollset()
1045 Curl_pollset_set_out_only(data, ps, sock); in cf_h1_proxy_adjust_pollset()
1050 struct Curl_easy *data) in cf_h1_proxy_destroy() argument
1052 CURL_TRC_CF(data, cf, "destroy"); in cf_h1_proxy_destroy()
1053 tunnel_free(cf, data); in cf_h1_proxy_destroy()
1057 struct Curl_easy *data) in cf_h1_proxy_close() argument
1059 CURL_TRC_CF(data, cf, "close"); in cf_h1_proxy_close()
1063 h1_tunnel_go_state(cf, cf->ctx, H1_TUNNEL_INIT, data); in cf_h1_proxy_close()
1066 cf->next->cft->do_close(cf->next, data); in cf_h1_proxy_close()
1091 struct Curl_easy *data) in Curl_cf_h1_proxy_insert_after() argument
1096 (void)data; in Curl_cf_h1_proxy_insert_after()