Lines Matching refs:data

88  * run out of space, the server is blocked from sending us any data.
96 struct Curl_easy *data)
99 iv[0].value = Curl_multi_max_concurrent_streams(data->multi);
105 iv[2].value = data->multi->push_cb != NULL;
111 struct Curl_easy *data)
116 ivlen = populate_settings(iv, data);
169 struct Curl_easy *data);
175 /*********** for HTTP/2 we store stream-local data here *************/
198 buffered data in stream->sendbuf to upload. */
212 struct Curl_easy *data,
222 if(data->state.select_bits != bits) {
223 CURL_TRC_CF(data, cf, "[%d] DRAIN select_bits=%x",
225 data->state.select_bits = bits;
226 Curl_expire(data, 0, EXPIRE_RUN_NOW);
231 struct Curl_easy *data,
238 DEBUGASSERT(data);
239 if(!data->req.p.http) {
240 failf(data, "initialization failure, transfer not http initialized");
243 stream = H2_STREAM_CTX(data);
269 H2_STREAM_LCTX(data) = stream;
284 struct Curl_easy *data, bool premature)
287 struct stream_ctx *stream = H2_STREAM_CTX(data);
301 CURL_TRC_CF(data, cf, "[%d] premature DATA_DONE, RST stream",
331 H2_STREAM_LCTX(data) = NULL;
361 struct Curl_easy *data = CF_DATA_CURRENT(cf);
363 return Curl_conn_cf_recv(cf->next, data, (char *)buf, buflen, err);
371 struct Curl_easy *data = CF_DATA_CURRENT(cf);
373 if(data) {
374 ssize_t nwritten = Curl_conn_cf_send(cf->next, data,
377 CURL_TRC_CF(data, cf, "[0] egress: wrote %zd bytes", nwritten);
411 struct Curl_easy *data,
428 failf(data, "Couldn't initialize nghttp2 callbacks");
448 failf(data, "Couldn't initialize nghttp2");
458 ssize_t binlen; /* length of the binsettings data */
460 binlen = populate_binsettings(binsettings, data);
462 failf(data, "nghttp2 unexpectedly failed on pack_settings_payload");
467 result = http2_data_setup(cf, data, &stream);
474 data->state.httpreq == HTTPREQ_HEAD,
477 failf(data, "nghttp2_session_upgrade2() failed: %s(%d)",
484 data);
486 infof(data, "http/2: failed to set user_data for stream %u",
490 CURL_TRC_CF(data, cf, "created session via Upgrade");
496 ivlen = populate_settings(iv, data);
500 failf(data, "nghttp2_submit_settings() failed: %s(%d)",
510 failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
518 CURL_TRC_CF(data, cf, "[0] created h2 session%s",
542 struct Curl_easy *data,
554 failf(data,
565 CURL_TRC_CF(data, cf, "process_pending_input: %zu bytes left "
582 * The server may send us data at any point (e.g. PING frames). Therefore,
586 * and distinguish between closed and data.
588 static bool http2_connisalive(struct Curl_cfilter *cf, struct Curl_easy *data,
595 if(!cf->next || !cf->next->cft->is_alive(cf->next, data, input_pending))
600 not in use by any other transfer, there shouldn't be any data here,
608 CURL_TRC_CF(data, cf, "%zd bytes stray data read before trying "
610 if(h2_process_pending_input(cf, data, &result) < 0)
627 struct Curl_easy *data)
634 failf(data, "nghttp2_submit_ping() failed: %s(%d)",
641 failf(data, "nghttp2_session_send() failed: %s(%d)",
658 struct Curl_easy *data)
664 (void)data;
671 CURL_TRC_CF(data, cf, "flush nw send buffer(%zu) -> EAGAIN",
681 * The implementation of nghttp2_send_callback type. Here we write |data| with
691 struct Curl_easy *data = CF_DATA_CURRENT(cf);
697 DEBUGASSERT(data);
706 failf(data, "Failed sending HTTP2 data");
721 struct Curl_easy *data;
732 if(!h || !GOOD_EASY_HANDLE(h->data))
735 struct stream_ctx *stream = H2_STREAM_CTX(h->data);
756 if(!h || !GOOD_EASY_HANDLE(h->data) || !header || !header[0] ||
760 stream = H2_STREAM_CTX(h->data);
777 struct Curl_easy *data)
779 struct Curl_easy *second = curl_easy_duphandle(data);
791 second->state.priority.weight = data->state.priority.weight;
797 static int set_transfer_url(struct Curl_easy *data,
844 if(data->state.url_alloc)
845 free(data->state.url);
846 data->state.url_alloc = TRUE;
847 data->state.url = url;
862 struct Curl_easy *data,
868 CURL_TRC_CF(data, cf, "[%d] PUSH_PROMISE received",
870 if(data->multi->push_cb) {
877 struct Curl_easy *newhandle = h2_duphandle(cf, data);
879 infof(data, "failed to duplicate handle");
884 heads.data = data;
887 CURL_TRC_CF(data, cf, "Got PUSH_PROMISE, ask application");
889 stream = H2_STREAM_CTX(data);
891 failf(data, "Internal NULL stream");
906 failf(data, "error setting up stream: %d", result);
913 Curl_set_in_callback(data, true);
914 rv = data->multi->push_cb(data, newhandle,
916 data->multi->push_userp);
917 Curl_set_in_callback(data, false);
935 rc = Curl_multi_add_perform(data->multi, newhandle, cf->conn);
937 infof(data, "failed to add handle to multi");
947 infof(data, "failed to set user_data for stream %u",
955 CURL_TRC_CF(data, cf, "Got PUSH_PROMISE, ignore it");
963 struct Curl_easy *data,
966 struct stream_ctx *stream = H2_STREAM_CTX(data);
981 struct Curl_easy *data,
985 struct stream_ctx *stream = H2_STREAM_CTX(data);
992 CURL_TRC_CF(data, cf, "[%d] No stream_ctx set", stream_id);
999 CURL_TRC_CF(data, cf, "[%d] DATA, buffered=%zu, window=%d/%d",
1015 drain_stream(cf, data, stream);
1051 result = recvbuf_write_hds(cf, data, STRCONST("\r\n"));
1058 drain_stream(cf, data, stream);
1061 rv = push_promise(cf, data, &frame->push_promise);
1070 CURL_TRC_CF(data, cf, "[%d] fail in PUSH_PROMISE received",
1082 drain_stream(cf, data, stream);
1085 if(CURL_WANT_SEND(data)) {
1086 drain_stream(cf, data, stream);
1104 (int)frame->data.padlen);
1171 struct Curl_easy *data = CF_DATA_CURRENT(cf);
1174 DEBUGASSERT(data);
1175 if(data && Curl_trc_cf_is_verbose(cf, data)) {
1180 CURL_TRC_CF(data, cf, "[%d] -> %s", frame->hd.stream_id, buffer);
1191 struct Curl_easy *data = CF_DATA_CURRENT(cf), *data_s;
1194 DEBUGASSERT(data);
1196 if(Curl_trc_cf_is_verbose(cf, data)) {
1201 CURL_TRC_CF(data, cf, "[%d] <- %s",frame->hd.stream_id, buffer);
1207 DEBUGASSERT(data);
1216 CURL_TRC_CF(data, cf, "[0] MAX_CONCURRENT_STREAMS: %d",
1218 CURL_TRC_CF(data, cf, "[0] ENABLE_PUSH: %s",
1220 if(data && max_conn != ctx->max_concurrent_streams) {
1222 CURL_TRC_CF(data, cf, "[0] notify MAX_CONCURRENT_STREAMS: %u",
1224 Curl_multi_connchanged(data->multi);
1231 if(CURL_WANT_SEND(data)) {
1232 struct stream_ctx *stream = H2_STREAM_CTX(data);
1234 drain_stream(cf, data, stream);
1243 if(data) {
1244 infof(data, "received GOAWAY, error=%d, last_stream=%u",
1246 Curl_multi_connchanged(data->multi);
1257 CURL_TRC_CF(data, cf, "[%d] No Curl_easy associated", stream_id);
1282 we have aborted a transfer artificially and there were more data
1303 /* if we receive data for another handle, wake that up */
1521 /* if we receive data for another handle, wake that up */
1545 /* if we receive data for another handle, wake that up */
1615 struct Curl_easy *data = CF_DATA_CURRENT(cf);
1617 failf(data, "%.*s", (int)len, msg);
1626 struct Curl_easy *data)
1631 struct SingleRequest *k = &data->req;
1633 ssize_t binlen; /* length of the binsettings data */
1635 binlen = populate_binsettings(binsettings, data);
1637 failf(data, "nghttp2 unexpectedly failed on pack_settings_payload");
1662 struct Curl_easy *data)
1666 struct stream_ctx *stream = H2_STREAM_CTX(data);
1671 CURL_TRC_CF(data, cf, "[%d] data done send", stream->id);
1680 drain_stream(cf, data, stream);
1689 struct Curl_easy *data,
1696 CURL_TRC_CF(data, cf, "[%d] REFUSED_STREAM, try again on a new "
1699 data->state.refused_stream = TRUE;
1704 failf(data, "HTTP/2 stream %u was not closed cleanly: %s (err %u)",
1711 failf(data, "HTTP/2 stream %u was reset", stream->id);
1717 failf(data, "HTTP/2 stream %u was closed cleanly, but before getting "
1741 Curl_debug(data, CURLINFO_HEADER_IN, Curl_dyn_ptr(&dbuf),
1743 *err = Curl_client_write(data, CLIENTWRITE_HEADER|CLIENTWRITE_TRAILER,
1758 CURL_TRC_CF(data, cf, "handle_stream_close -> %zd, %d", rv, *err);
1762 static int sweight_wanted(const struct Curl_easy *data)
1765 return data->set.priority.weight?
1766 data->set.priority.weight : NGHTTP2_DEFAULT_WEIGHT;
1769 static int sweight_in_effect(const struct Curl_easy *data)
1772 return data->state.priority.weight?
1773 data->state.priority.weight : NGHTTP2_DEFAULT_WEIGHT;
1782 static void h2_pri_spec(struct Curl_easy *data,
1785 struct Curl_data_priority *prio = &data->set.priority;
1789 sweight_wanted(data),
1790 data->set.priority.exclusive);
1791 data->state.priority = *prio;
1798 * Flush any out data pending in the network buffer.
1801 struct Curl_easy *data)
1804 struct stream_ctx *stream = H2_STREAM_CTX(data);
1808 ((sweight_wanted(data) != sweight_in_effect(data)) ||
1809 (data->set.priority.exclusive != data->state.priority.exclusive) ||
1810 (data->set.priority.parent != data->state.priority.parent)) ) {
1814 h2_pri_spec(data, &pri_spec);
1815 CURL_TRC_CF(data, cf, "[%d] Queuing PRIORITY", stream->id);
1829 CURL_TRC_CF(data, cf, "nghttp2_session_send error (%s)%d",
1833 return nw_out_flush(cf, data);
1836 static ssize_t stream_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
1854 CURL_TRC_CF(data, cf, "[%d] returning CLOSE", stream->id);
1855 nread = http2_handle_stream_close(cf, data, stream, err);
1860 CURL_TRC_CF(data, cf, "[%d] returning ERR", stream->id);
1872 CURL_TRC_CF(data, cf, "[%d] stream_recv(len=%zu) -> %zd, %d",
1878 struct Curl_easy *data)
1887 CURL_TRC_CF(data, cf, "Process %zu bytes in connection buffer",
1889 if(h2_process_pending_input(cf, data, &result) < 0)
1893 /* Receive data from the "lower" filters, e.g. network until
1897 stream = H2_STREAM_CTX(data);
1900 * the transfer loop can handle the data/close here. However,
1901 * this may leave data in underlying buffers that will not
1903 if(!cf->next || !cf->next->cft->has_data_pending(cf->next, data))
1910 failf(data, "Failed receiving HTTP2 data: %d(%s)", result,
1917 CURL_TRC_CF(data, cf, "[0] ingress: connection closed");
1922 CURL_TRC_CF(data, cf, "[0] ingress: read %zd bytes",
1926 if(h2_process_pending_input(cf, data, &result))
1937 static ssize_t cf_h2_recv(struct Curl_cfilter *cf, struct Curl_easy *data,
1941 struct stream_ctx *stream = H2_STREAM_CTX(data);
1951 failf(data, "[%zd-%zd], http/2 recv on a transfer never opened "
1952 "or already cleared", (ssize_t)data->id,
1958 CF_DATA_SAVE(save, cf, data);
1960 nread = stream_recv(cf, data, stream, buf, len, err);
1965 *err = h2_progress_ingress(cf, data);
1969 nread = stream_recv(cf, data, stream, buf, len, err);
1991 CURL_TRC_CF(data, cf, "[%d] DRAIN closed stream", stream->id);
1992 drain_stream(cf, data, stream);
1997 result = h2_progress_egress(cf, data);
1999 /* pending data to send, need to be called again. Ideally, we'd
2003 drain_stream(cf, data, stream);
2009 CURL_TRC_CF(data, cf, "[%d] cf_recv(len=%zu) -> %zd %d, "
2025 struct Curl_cfilter *cf, struct Curl_easy *data,
2041 *err = http2_data_setup(cf, data, &stream);
2051 /* need more data */
2056 *err = Curl_http_req_to_h2(&h2_headers, stream->h1.req, data);
2071 h2_pri_spec(data, &pri_spec);
2073 CURL_TRC_CF(data, cf, "send request NOT allowed (via nghttp2)");
2075 switch(data->state.httpreq) {
2080 if(data->state.infilesize != -1)
2081 stream->upload_left = data->state.infilesize;
2083 /* data sending without specifying the data amount up front */
2089 &data_prd, data);
2094 NULL, data);
2098 CURL_TRC_CF(data, cf, "send: nghttp2_submit_request error (%s)%u",
2106 if(Curl_trc_is_verbose(data)) {
2109 infof(data, "[HTTP/2] [%d] OPENED stream for %s",
2110 stream_id, data->state.url);
2114 infof(data, "[HTTP/2] [%d] [%.*s: %.*s]", stream_id,
2120 infof(data, "[HTTP/2] Warning: The cumulative length of all "
2128 if(data->set.max_recv_speed) {
2132 * allow for data in flight and avoid stalling. */
2133 curl_off_t n = (((data->set.max_recv_speed - 1) / H2_CHUNK_SIZE) + 1);
2156 CURL_TRC_CF(data, cf, "[%d] submit -> %zd, %d",
2164 static ssize_t cf_h2_send(struct Curl_cfilter *cf, struct Curl_easy *data,
2168 struct stream_ctx *stream = H2_STREAM_CTX(data);
2175 CF_DATA_SAVE(save, cf, data);
2179 /* the data in `buf` has already been submitted or added to the
2187 failf(data, "HTTP/2 send again with decreased length (%zd vs %zd)",
2202 * We silently discard the data sent, since this is not a transport
2204 CURL_TRC_CF(data, cf, "[%d] discarding data"
2210 infof(data, "stream %u closed", stream->id);
2225 /* req body data is buffered, resume the potentially suspended stream */
2235 nwritten = h2_submit(&stream, cf, data, buf, len, err);
2242 /* Call the nghttp2 send loop and flush to write ALL buffered data,
2244 result = h2_progress_egress(cf, data);
2248 infof(data, "stream %u closed", stream->id);
2263 * there is data left in our stream send buffer unwritten. This may
2269 /* Unable to send all data, due to connection blocked or H2 window
2278 CURL_TRC_CF(data, cf, "[%d] cf_send(len=%zu) BLOCK: win %u/%zu "
2291 nwritten = http2_handle_stream_close(cf, data, stream, err);
2294 CURL_TRC_CF(data, cf, "send: nothing to do in this session");
2302 CURL_TRC_CF(data, cf, "[%d] cf_send(len=%zu) -> %zd, %d, "
2315 CURL_TRC_CF(data, cf, "cf_send(len=%zu) -> %zd, %d, "
2326 struct Curl_easy *data,
2336 sock = Curl_conn_cf_get_socket(cf, data);
2337 Curl_pollset_check(data, ps, sock, &want_recv, &want_send);
2339 struct stream_ctx *stream = H2_STREAM_CTX(data);
2343 CF_DATA_SAVE(save, cf, data);
2352 Curl_pollset_set(data, ps, sock, want_recv, want_send);
2358 struct Curl_easy *data,
2372 result = Curl_conn_cf_connect(cf->next, data, blocking, done);
2379 CF_DATA_SAVE(save, cf, data);
2381 result = cf_h2_ctx_init(cf, data, FALSE);
2386 result = h2_progress_ingress(cf, data);
2392 result = h2_progress_egress(cf, data);
2403 CURL_TRC_CF(data, cf, "cf_connect() -> %d, %d, ", result, *done);
2408 static void cf_h2_close(struct Curl_cfilter *cf, struct Curl_easy *data)
2415 CF_DATA_SAVE(save, cf, data);
2420 cf->next->cft->do_close(cf->next, data);
2423 static void cf_h2_destroy(struct Curl_cfilter *cf, struct Curl_easy *data)
2427 (void)data;
2435 struct Curl_easy *data,
2440 struct stream_ctx *stream = H2_STREAM_CTX(data);
2442 DEBUGASSERT(data);
2451 failf(data, "nghttp2_session_set_local_window_size() failed: %s(%d)",
2457 drain_stream(cf, data, stream);
2460 (void)h2_progress_egress(cf, data);
2468 drain_stream(cf, data, stream);
2469 Curl_expire(data, 0, EXPIRE_RUN_NOW);
2471 DEBUGF(infof(data, "Set HTTP/2 window size to %u for stream %u",
2480 DEBUGF(infof(data, "HTTP/2 window size is now %u for stream %u",
2490 struct Curl_easy *data,
2498 CF_DATA_SAVE(save, cf, data);
2503 result = http2_data_pause(cf, data, (arg1 != 0));
2506 result = http2_data_done_send(cf, data);
2509 http2_data_done(cf, data, TRUE);
2512 http2_data_done(cf, data, arg1 != 0);
2522 const struct Curl_easy *data)
2525 struct stream_ctx *stream = H2_STREAM_CTX(data);
2531 return cf->next? cf->next->cft->has_data_pending(cf->next, data) : FALSE;
2535 struct Curl_easy *data,
2542 CF_DATA_SAVE(save, cf, data);
2543 result = (ctx && ctx->h2 && http2_connisalive(cf, data, input_pending));
2544 CURL_TRC_CF(data, cf, "conn alive -> %d, input_pending=%d",
2551 struct Curl_easy *data)
2556 CF_DATA_SAVE(save, cf, data);
2557 result = http2_send_ping(cf, data);
2563 struct Curl_easy *data,
2574 CF_DATA_SAVE(save, cf, data);
2589 cf->next->cft->query(cf->next, data, query, pres1, pres2) :
2612 struct Curl_easy *data,
2620 DEBUGASSERT(data->conn);
2629 Curl_conn_cf_add(data, conn, sockindex, cf);
2640 struct Curl_easy *data)
2646 (void)data;
2665 const struct Curl_easy *data)
2667 (void)data;
2677 bool Curl_conn_is_http2(const struct Curl_easy *data,
2681 return conn? Curl_cf_is_http2(conn->cfilter[sockindex], data) : FALSE;
2684 bool Curl_http2_may_switch(struct Curl_easy *data,
2689 if(!Curl_conn_is_http2(data, conn, sockindex) &&
2690 data->state.httpwant == CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE) {
2695 infof(data, "Ignoring HTTP/2 prior knowledge due to proxy");
2704 CURLcode Curl_http2_switch(struct Curl_easy *data,
2710 DEBUGASSERT(!Curl_conn_is_http2(data, conn, sockindex));
2711 DEBUGF(infof(data, "switching to HTTP/2"));
2713 result = http2_cfilter_add(&cf, data, conn, sockindex);
2717 result = cf_h2_ctx_init(cf, data, FALSE);
2724 Curl_multi_connchanged(data->multi);
2728 return Curl_conn_cf_connect(cf, data, FALSE, &done);
2733 CURLcode Curl_http2_switch_at(struct Curl_cfilter *cf, struct Curl_easy *data)
2738 DEBUGASSERT(!Curl_cf_is_http2(cf, data));
2740 result = http2_cfilter_insert_after(cf, data);
2745 result = cf_h2_ctx_init(cf_h2, data, FALSE);
2752 Curl_multi_connchanged(data->multi);
2756 return Curl_conn_cf_connect(cf_h2, data, FALSE, &done);
2761 CURLcode Curl_http2_upgrade(struct Curl_easy *data,
2769 DEBUGASSERT(!Curl_conn_is_http2(data, conn, sockindex));
2770 DEBUGF(infof(data, "upgrading to HTTP/2"));
2771 DEBUGASSERT(data->req.upgr101 == UPGR101_RECEIVED);
2773 result = http2_cfilter_add(&cf, data, conn, sockindex);
2780 result = cf_h2_ctx_init(cf, data, TRUE);
2785 /* Remaining data from the protocol switch reply is already using
2793 failf(data, "error on copying HTTP Upgrade response: %d", result);
2797 failf(data, "connection buffer size could not take all data "
2802 infof(data, "Copied HTTP/2 data in stream buffer to connection buffer"
2809 Curl_multi_connchanged(data->multi);
2813 return Curl_conn_cf_connect(cf, data, FALSE, &done);
2820 bool Curl_h2_http_1_1_error(struct Curl_easy *data)
2822 struct stream_ctx *stream = H2_STREAM_CTX(data);