Lines Matching refs:cf
95 static CURLcode tunnel_reinit(struct Curl_cfilter *cf, in tunnel_reinit() argument
100 (void)cf; in tunnel_reinit()
111 static CURLcode tunnel_init(struct Curl_cfilter *cf, in tunnel_init() argument
117 if(cf->conn->handler->flags & PROTOPT_NOTCPPROXY) { in tunnel_init()
118 failf(data, "%s cannot be done over CONNECT", cf->conn->handler->scheme); in tunnel_init()
133 connkeep(cf->conn, "HTTP proxy CONNECT"); in tunnel_init()
134 return tunnel_reinit(cf, data, ts); in tunnel_init()
137 static void h1_tunnel_go_state(struct Curl_cfilter *cf, 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()
176 CURL_TRC_CF(data, cf, "new tunnel state 'failed'"); in h1_tunnel_go_state()
194 static void tunnel_free(struct Curl_cfilter *cf, in tunnel_free() argument
197 if(cf) { in tunnel_free()
198 struct h1_tunnel_state *ts = cf->ctx; in tunnel_free()
200 h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); in tunnel_free()
205 cf->ctx = NULL; in tunnel_free()
216 static CURLcode start_CONNECT(struct Curl_cfilter *cf, in start_CONNECT() argument
229 result = Curl_http_proxy_create_CONNECT(&req, cf, data, 1); in start_CONNECT()
238 http_minor = (cf->conn->http_proxy.proxytype == CURLPROXY_HTTP_1_0) ? 0 : 1; in start_CONNECT()
252 static CURLcode send_CONNECT(struct Curl_cfilter *cf, in send_CONNECT() argument
269 nwritten = cf->next->cft->do_send(cf->next, data, buf, blen, FALSE, &result); in send_CONNECT()
288 static CURLcode on_resp_header(struct Curl_cfilter *cf, in on_resp_header() argument
295 (void)cf; in on_resp_header()
307 CURL_TRC_CF(data, cf, "CONNECT: fwd auth header '%s'", header); in on_resp_header()
364 static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf, in recv_CONNECT_resp() argument
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()
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()
534 static CURLcode CONNECT_host(struct Curl_cfilter *cf, in CONNECT_host() argument
546 result = Curl_http_proxy_get_destination(cf, &hostname, &port, &ipv6_ip); in CONNECT_host()
556 if(!Curl_checkProxyheaders(data, cf->conn, STRCONST("Host"))) { in CONNECT_host()
569 static CURLcode start_CONNECT(struct Curl_cfilter *cf, in start_CONNECT() argument
573 struct connectdata *conn = cf->conn; in start_CONNECT()
575 curl_socket_t tunnelsocket = Curl_conn_cf_get_socket(cf, data); in start_CONNECT()
597 h->io_ctx.sockindex = cf->sockindex; in start_CONNECT()
672 result = CONNECT_host(cf, data, &authority, &host_header); in start_CONNECT()
793 static CURLcode send_CONNECT(struct Curl_cfilter *cf, in send_CONNECT() argument
799 struct connectdata *conn = cf->conn; in send_CONNECT()
831 static CURLcode recv_CONNECT_resp(struct Curl_cfilter *cf, in recv_CONNECT_resp() argument
841 result = Curl_hyper_stream(data, cf->conn, &didwhat, in recv_CONNECT_resp()
863 static CURLcode H1_CONNECT(struct Curl_cfilter *cf, in H1_CONNECT() argument
867 struct connectdata *conn = cf->conn; 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()
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()
934 CURL_TRC_CF(data, cf, "CONNECT need to close+open"); 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()
960 h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); in H1_CONNECT()
965 h1_tunnel_go_state(cf, ts, H1_TUNNEL_ESTABLISHED, data); in H1_CONNECT()
972 h1_tunnel_go_state(cf, ts, H1_TUNNEL_FAILED, data); in H1_CONNECT()
976 static CURLcode cf_h1_proxy_connect(struct Curl_cfilter *cf, in cf_h1_proxy_connect() argument
981 struct h1_tunnel_state *ts = cf->ctx; in cf_h1_proxy_connect()
983 if(cf->connected) { in cf_h1_proxy_connect()
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()
998 cf->ctx = ts; in cf_h1_proxy_connect()
1004 result = H1_CONNECT(cf, data, ts); in cf_h1_proxy_connect()
1010 *done = (result == CURLE_OK) && tunnel_is_established(cf->ctx); in cf_h1_proxy_connect()
1012 cf->connected = TRUE; in cf_h1_proxy_connect()
1019 tunnel_free(cf, data); in cf_h1_proxy_connect()
1024 static void cf_h1_proxy_adjust_pollset(struct Curl_cfilter *cf, in cf_h1_proxy_adjust_pollset() argument
1028 struct h1_tunnel_state *ts = cf->ctx; in cf_h1_proxy_adjust_pollset()
1030 if(!cf->connected) { in cf_h1_proxy_adjust_pollset()
1033 curl_socket_t sock = Curl_conn_cf_get_socket(cf, data); in cf_h1_proxy_adjust_pollset()
1049 static void cf_h1_proxy_destroy(struct Curl_cfilter *cf, 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()
1056 static void cf_h1_proxy_close(struct Curl_cfilter *cf, in cf_h1_proxy_close() argument
1059 CURL_TRC_CF(data, cf, "close"); in cf_h1_proxy_close()
1060 if(cf) { in cf_h1_proxy_close()
1061 cf->connected = FALSE; in cf_h1_proxy_close()
1062 if(cf->ctx) { in cf_h1_proxy_close()
1063 h1_tunnel_go_state(cf, cf->ctx, H1_TUNNEL_INIT, data); in cf_h1_proxy_close()
1065 if(cf->next) in cf_h1_proxy_close()
1066 cf->next->cft->do_close(cf->next, data); in cf_h1_proxy_close()
1093 struct Curl_cfilter *cf; in Curl_cf_h1_proxy_insert_after() local
1097 result = Curl_cf_create(&cf, &Curl_cft_h1_proxy, NULL); in Curl_cf_h1_proxy_insert_after()
1099 Curl_conn_cf_insert_after(cf_at, cf); in Curl_cf_h1_proxy_insert_after()