• Home
  • Raw
  • Download

Lines Matching refs:cf

82 static CURLcode tunnel_stream_init(struct Curl_cfilter *cf,  in tunnel_stream_init()  argument
96 result = Curl_http_proxy_get_destination(cf, &hostname, &port, &ipv6_ip); in tunnel_stream_init()
118 static void h2_tunnel_go_state(struct Curl_cfilter *cf, in h2_tunnel_go_state() argument
123 (void)cf; in h2_tunnel_go_state()
138 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'init'", ts->stream_id); in h2_tunnel_go_state()
143 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'connect'", ts->stream_id); in h2_tunnel_go_state()
148 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'response'", ts->stream_id); in h2_tunnel_go_state()
153 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'established'", in h2_tunnel_go_state()
161 CURL_TRC_CF(data, cf, "[%d] new tunnel state 'failed'", ts->stream_id); in h2_tunnel_go_state()
189 #define CF_CTX_CALL_DATA(cf) \ argument
190 ((struct cf_h2_proxy_ctx *)(cf)->ctx)->call_data
214 static void drain_tunnel(struct Curl_cfilter *cf, in drain_tunnel() argument
220 (void)cf; in drain_tunnel()
225 CURL_TRC_CF(data, cf, "[%d] DRAIN dselect_bits=%x", in drain_tunnel()
236 struct Curl_cfilter *cf = reader_ctx; in proxy_nw_in_reader() local
239 if(cf) { in proxy_nw_in_reader()
240 struct Curl_easy *data = CF_DATA_CURRENT(cf); in proxy_nw_in_reader()
241 nread = Curl_conn_cf_recv(cf->next, data, (char *)buf, buflen, err); in proxy_nw_in_reader()
242 CURL_TRC_CF(data, cf, "[0] nw_in_reader(len=%zu) -> %zd, %d", in proxy_nw_in_reader()
255 struct Curl_cfilter *cf = writer_ctx; in proxy_h2_nw_out_writer() local
258 if(cf) { in proxy_h2_nw_out_writer()
259 struct Curl_easy *data = CF_DATA_CURRENT(cf); in proxy_h2_nw_out_writer()
260 nwritten = Curl_conn_cf_send(cf->next, data, (const char *)buf, buflen, in proxy_h2_nw_out_writer()
262 CURL_TRC_CF(data, cf, "[0] nw_out_writer(len=%zu) -> %zd, %d", in proxy_h2_nw_out_writer()
271 static int proxy_h2_client_new(struct Curl_cfilter *cf, in proxy_h2_client_new() argument
274 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_client_new()
288 rc = nghttp2_session_client_new2(&ctx->h2, cbs, cf, o); in proxy_h2_client_new()
320 static CURLcode cf_h2_proxy_ctx_init(struct Curl_cfilter *cf, in cf_h2_proxy_ctx_init() argument
323 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_ctx_init()
334 if(tunnel_stream_init(cf, &ctx->tunnel)) in cf_h2_proxy_ctx_init()
357 rc = proxy_h2_client_new(cf, cbs); in cf_h2_proxy_ctx_init()
397 CURL_TRC_CF(data, cf, "[0] init proxy ctx -> %d", result); in cf_h2_proxy_ctx_init()
407 static CURLcode proxy_h2_nw_out_flush(struct Curl_cfilter *cf, in proxy_h2_nw_out_flush() argument
410 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_nw_out_flush()
418 nwritten = Curl_bufq_pass(&ctx->outbufq, proxy_h2_nw_out_writer, cf, in proxy_h2_nw_out_flush()
422 CURL_TRC_CF(data, cf, "[0] flush nw send buffer(%zu) -> EAGAIN", in proxy_h2_nw_out_flush()
428 CURL_TRC_CF(data, cf, "[0] nw send buffer flushed"); in proxy_h2_nw_out_flush()
437 static int proxy_h2_process_pending_input(struct Curl_cfilter *cf, in proxy_h2_process_pending_input() argument
441 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_process_pending_input()
449 CURL_TRC_CF(data, cf, "[0] %zu bytes to nghttp2 -> %zd", blen, rv); in proxy_h2_process_pending_input()
459 CURL_TRC_CF(data, cf, "[0] all data in connection buffer processed"); in proxy_h2_process_pending_input()
463 CURL_TRC_CF(data, cf, "[0] process_pending_input: %zu bytes left " in proxy_h2_process_pending_input()
471 static CURLcode proxy_h2_progress_ingress(struct Curl_cfilter *cf, in proxy_h2_progress_ingress() argument
474 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_progress_ingress()
480 CURL_TRC_CF(data, cf, "[0] process %zu bytes in connection buffer", in proxy_h2_progress_ingress()
482 if(proxy_h2_process_pending_input(cf, data, &result) < 0) in proxy_h2_progress_ingress()
493 nread = Curl_bufq_slurp(&ctx->inbufq, proxy_nw_in_reader, cf, &result); in proxy_h2_progress_ingress()
494 CURL_TRC_CF(data, cf, "[0] read %zu bytes nw data -> %zd, %d", in proxy_h2_progress_ingress()
508 if(proxy_h2_process_pending_input(cf, data, &result)) in proxy_h2_progress_ingress()
513 connclose(cf->conn, "GOAWAY received"); in proxy_h2_progress_ingress()
519 static CURLcode proxy_h2_progress_egress(struct Curl_cfilter *cf, in proxy_h2_progress_egress() argument
522 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_progress_egress()
530 CURL_TRC_CF(data, cf, "[0] nghttp2_session_send error (%s)%d", in proxy_h2_progress_egress()
534 return proxy_h2_nw_out_flush(cf, data); in proxy_h2_progress_egress()
541 struct Curl_cfilter *cf = userp; in on_session_send() local
542 struct cf_h2_proxy_ctx *ctx = cf->ctx; in on_session_send()
543 struct Curl_easy *data = CF_DATA_CURRENT(cf); in on_session_send()
552 proxy_h2_nw_out_writer, cf, &result); in on_session_send()
644 struct Curl_cfilter *cf = userp; in proxy_h2_on_frame_send() local
645 struct Curl_easy *data = CF_DATA_CURRENT(cf); in proxy_h2_on_frame_send()
649 if(data && Curl_trc_cf_is_verbose(cf, data)) { in proxy_h2_on_frame_send()
654 CURL_TRC_CF(data, cf, "[%d] -> %s", frame->hd.stream_id, buffer); in proxy_h2_on_frame_send()
664 struct Curl_cfilter *cf = userp; in proxy_h2_on_frame_recv() local
665 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_on_frame_recv()
666 struct Curl_easy *data = CF_DATA_CURRENT(cf); in proxy_h2_on_frame_recv()
672 if(Curl_trc_cf_is_verbose(cf, data)) { in proxy_h2_on_frame_recv()
677 CURL_TRC_CF(data, cf, "[%d] <- %s",frame->hd.stream_id, buffer); in proxy_h2_on_frame_recv()
694 drain_tunnel(cf, data, &ctx->tunnel); in proxy_h2_on_frame_recv()
695 CURL_TRC_CF(data, cf, "[%d] un-holding after SETTINGS", in proxy_h2_on_frame_recv()
709 CURL_TRC_CF(data, cf, "[%d] rcvd FRAME not for tunnel", stream_id); in proxy_h2_on_frame_recv()
721 CURL_TRC_CF(data, cf, "[%d] got http status: %d", in proxy_h2_on_frame_recv()
734 CURL_TRC_CF(data, cf, "[%d] unpausing after win update", in proxy_h2_on_frame_recv()
751 struct Curl_cfilter *cf = userp; in proxy_h2_on_header() local
752 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_on_header()
753 struct Curl_easy *data = CF_DATA_CURRENT(cf); in proxy_h2_on_header()
762 CURL_TRC_CF(data, cf, "[%d] header for non-tunnel stream: " in proxy_h2_on_header()
792 CURL_TRC_CF(data, cf, "[%d] status: HTTP/2 %03d", in proxy_h2_on_header()
806 CURL_TRC_CF(data, cf, "[%d] header: %.*s: %.*s", in proxy_h2_on_header()
819 struct Curl_cfilter *cf = userp; in tunnel_send_callback() local
820 struct cf_h2_proxy_ctx *ctx = cf->ctx; in tunnel_send_callback()
821 struct Curl_easy *data = CF_DATA_CURRENT(cf); in tunnel_send_callback()
847 CURL_TRC_CF(data, cf, "[%d] tunnel_send_callback -> %zd", in tunnel_send_callback()
856 struct Curl_cfilter *cf = userp; in tunnel_recv_callback() local
857 struct cf_h2_proxy_ctx *ctx = cf->ctx; in tunnel_recv_callback()
882 struct Curl_cfilter *cf = userp; in proxy_h2_on_stream_close() local
883 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_on_stream_close()
884 struct Curl_easy *data = CF_DATA_CURRENT(cf); in proxy_h2_on_stream_close()
892 CURL_TRC_CF(data, cf, "[%d] proxy_h2_on_stream_close, %s (err %d)", in proxy_h2_on_stream_close()
901 struct Curl_cfilter *cf, in proxy_h2_submit() argument
917 (void)cf; in proxy_h2_submit()
967 static CURLcode submit_CONNECT(struct Curl_cfilter *cf, in submit_CONNECT() argument
971 struct cf_h2_proxy_ctx *ctx = cf->ctx; in submit_CONNECT()
975 result = Curl_http_proxy_create_CONNECT(&req, cf, data, 2); in submit_CONNECT()
981 result = proxy_h2_submit(&ts->stream_id, cf, data, ctx->h2, req, in submit_CONNECT()
982 NULL, ts, tunnel_send_callback, cf); in submit_CONNECT()
984 CURL_TRC_CF(data, cf, "[%d] send, nghttp2_submit_request error: %s", in submit_CONNECT()
996 static CURLcode inspect_response(struct Curl_cfilter *cf, in inspect_response() argument
1002 (void)cf; in inspect_response()
1007 h2_tunnel_go_state(cf, ts, H2_TUNNEL_ESTABLISHED, data); in inspect_response()
1019 CURL_TRC_CF(data, cf, "[0] CONNECT: fwd auth header '%s'", in inspect_response()
1028 h2_tunnel_go_state(cf, ts, H2_TUNNEL_INIT, data); in inspect_response()
1037 static CURLcode H2_CONNECT(struct Curl_cfilter *cf, in H2_CONNECT() argument
1041 struct cf_h2_proxy_ctx *ctx = cf->ctx; in H2_CONNECT()
1050 CURL_TRC_CF(data, cf, "[0] CONNECT start for %s", ts->authority); in H2_CONNECT()
1051 result = submit_CONNECT(cf, data, ts); in H2_CONNECT()
1054 h2_tunnel_go_state(cf, ts, H2_TUNNEL_CONNECT, data); in H2_CONNECT()
1059 result = proxy_h2_progress_ingress(cf, data); in H2_CONNECT()
1061 result = proxy_h2_progress_egress(cf, data); in H2_CONNECT()
1063 h2_tunnel_go_state(cf, ts, H2_TUNNEL_FAILED, data); in H2_CONNECT()
1068 h2_tunnel_go_state(cf, ts, H2_TUNNEL_RESPONSE, data); in H2_CONNECT()
1078 result = inspect_response(cf, data, ts); in H2_CONNECT()
1097 h2_tunnel_go_state(cf, ts, H2_TUNNEL_FAILED, data); in H2_CONNECT()
1101 static CURLcode cf_h2_proxy_connect(struct Curl_cfilter *cf, in cf_h2_proxy_connect() argument
1105 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_connect()
1111 if(cf->connected) { in cf_h2_proxy_connect()
1117 if(!cf->next->connected) { in cf_h2_proxy_connect()
1118 result = Curl_conn_cf_connect(cf->next, data, blocking, done); in cf_h2_proxy_connect()
1125 CF_DATA_SAVE(save, cf, data); in cf_h2_proxy_connect()
1127 result = cf_h2_proxy_ctx_init(cf, data); in cf_h2_proxy_connect()
1143 result = H2_CONNECT(cf, data, ts); in cf_h2_proxy_connect()
1147 cf->connected = *done; in cf_h2_proxy_connect()
1148 CF_DATA_RESTORE(cf, save); in cf_h2_proxy_connect()
1152 static void cf_h2_proxy_close(struct Curl_cfilter *cf, struct Curl_easy *data) in cf_h2_proxy_close() argument
1154 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_close()
1159 CF_DATA_SAVE(save, cf, data); in cf_h2_proxy_close()
1161 CF_DATA_RESTORE(cf, save); in cf_h2_proxy_close()
1163 if(cf->next) in cf_h2_proxy_close()
1164 cf->next->cft->do_close(cf->next, data); in cf_h2_proxy_close()
1167 static void cf_h2_proxy_destroy(struct Curl_cfilter *cf, in cf_h2_proxy_destroy() argument
1170 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_destroy()
1175 cf->ctx = NULL; in cf_h2_proxy_destroy()
1179 static bool cf_h2_proxy_data_pending(struct Curl_cfilter *cf, in cf_h2_proxy_data_pending() argument
1182 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_data_pending()
1187 return cf->next? cf->next->cft->has_data_pending(cf->next, data) : FALSE; in cf_h2_proxy_data_pending()
1190 static int cf_h2_proxy_get_select_socks(struct Curl_cfilter *cf, in cf_h2_proxy_get_select_socks() argument
1194 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_get_select_socks()
1198 CF_DATA_SAVE(save, cf, data); in cf_h2_proxy_get_select_socks()
1199 sock[0] = Curl_conn_cf_get_socket(cf, data); in cf_h2_proxy_get_select_socks()
1207 CF_DATA_RESTORE(cf, save); in cf_h2_proxy_get_select_socks()
1211 static ssize_t h2_handle_tunnel_close(struct Curl_cfilter *cf, in h2_handle_tunnel_close() argument
1215 struct cf_h2_proxy_ctx *ctx = cf->ctx; in h2_handle_tunnel_close()
1219 CURL_TRC_CF(data, cf, "[%d] REFUSED_STREAM, try again on a new " in h2_handle_tunnel_close()
1221 connclose(cf->conn, "REFUSED_STREAM"); /* don't use this anymore */ in h2_handle_tunnel_close()
1240 CURL_TRC_CF(data, cf, "[%d] handle_tunnel_close -> %zd, %d", in h2_handle_tunnel_close()
1245 static ssize_t tunnel_recv(struct Curl_cfilter *cf, struct Curl_easy *data, in tunnel_recv() argument
1248 struct cf_h2_proxy_ctx *ctx = cf->ctx; in tunnel_recv()
1262 nread = h2_handle_tunnel_close(cf, data, err); in tunnel_recv()
1277 CURL_TRC_CF(data, cf, "[%d] tunnel_recv(len=%zu) -> %zd, %d", in tunnel_recv()
1282 static ssize_t cf_h2_proxy_recv(struct Curl_cfilter *cf, in cf_h2_proxy_recv() argument
1286 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_recv()
1295 CF_DATA_SAVE(save, cf, data); in cf_h2_proxy_recv()
1298 *err = proxy_h2_progress_ingress(cf, data); in cf_h2_proxy_recv()
1303 nread = tunnel_recv(cf, data, buf, len, err); in cf_h2_proxy_recv()
1306 CURL_TRC_CF(data, cf, "[%d] increase window by %zd", in cf_h2_proxy_recv()
1311 result = proxy_h2_progress_egress(cf, data); in cf_h2_proxy_recv()
1317 CURL_TRC_CF(data, cf, "[%d] egress blocked, DRAIN", in cf_h2_proxy_recv()
1319 drain_tunnel(cf, data, &ctx->tunnel); in cf_h2_proxy_recv()
1331 drain_tunnel(cf, data, &ctx->tunnel); in cf_h2_proxy_recv()
1333 CURL_TRC_CF(data, cf, "[%d] cf_recv(len=%zu) -> %zd %d", in cf_h2_proxy_recv()
1335 CF_DATA_RESTORE(cf, save); in cf_h2_proxy_recv()
1339 static ssize_t cf_h2_proxy_send(struct Curl_cfilter *cf, in cf_h2_proxy_send() argument
1343 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_send()
1354 CF_DATA_SAVE(save, cf, data); in cf_h2_proxy_send()
1396 result = proxy_h2_progress_ingress(cf, data); in cf_h2_proxy_send()
1405 result = proxy_h2_progress_egress(cf, data); in cf_h2_proxy_send()
1433 CURL_TRC_CF(data, cf, "[%d] remote flow " in cf_h2_proxy_send()
1441 CURL_TRC_CF(data, cf, "[%d] cf_send(len=%zu) BLOCK: win %u/%zu " in cf_h2_proxy_send()
1446 drain_tunnel(cf, data, &ctx->tunnel); in cf_h2_proxy_send()
1459 CURL_TRC_CF(data, cf, "[0] send: nothing to do in this session"); in cf_h2_proxy_send()
1470 drain_tunnel(cf, data, &ctx->tunnel); in cf_h2_proxy_send()
1472 CURL_TRC_CF(data, cf, "[%d] cf_send(len=%zu) -> %zd, %d, " in cf_h2_proxy_send()
1480 CF_DATA_RESTORE(cf, save); in cf_h2_proxy_send()
1484 static bool proxy_h2_connisalive(struct Curl_cfilter *cf, in proxy_h2_connisalive() argument
1488 struct cf_h2_proxy_ctx *ctx = cf->ctx; in proxy_h2_connisalive()
1492 if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending)) in proxy_h2_connisalive()
1503 nread = Curl_bufq_slurp(&ctx->inbufq, proxy_nw_in_reader, cf, &result); in proxy_h2_connisalive()
1505 if(proxy_h2_process_pending_input(cf, data, &result) < 0) in proxy_h2_connisalive()
1521 static bool cf_h2_proxy_is_alive(struct Curl_cfilter *cf, in cf_h2_proxy_is_alive() argument
1525 struct cf_h2_proxy_ctx *ctx = cf->ctx; in cf_h2_proxy_is_alive()
1529 CF_DATA_SAVE(save, cf, data); in cf_h2_proxy_is_alive()
1530 result = (ctx && ctx->h2 && proxy_h2_connisalive(cf, data, input_pending)); in cf_h2_proxy_is_alive()
1531 CURL_TRC_CF(data, cf, "[0] conn alive -> %d, input_pending=%d", in cf_h2_proxy_is_alive()
1533 CF_DATA_RESTORE(cf, save); in cf_h2_proxy_is_alive()
1555 CURLcode Curl_cf_h2_proxy_insert_after(struct Curl_cfilter *cf, in Curl_cf_h2_proxy_insert_after() argument
1571 Curl_conn_cf_insert_after(cf, cf_h2_proxy); in Curl_cf_h2_proxy_insert_after()