Lines Matching refs:data
49 struct Curl_easy *data) in Curl_req_soft_reset() argument
70 result = Curl_client_start(data); in Curl_req_soft_reset()
75 Curl_bufq_init2(&req->sendbuf, data->set.upload_buffer_size, 1, in Curl_req_soft_reset()
81 if(data->set.upload_buffer_size != req->sendbuf.chunk_size) { in Curl_req_soft_reset()
83 Curl_bufq_init2(&req->sendbuf, data->set.upload_buffer_size, 1, in Curl_req_soft_reset()
92 struct Curl_easy *data) in Curl_req_start() argument
95 return Curl_req_soft_reset(req, data); in Curl_req_start()
98 static CURLcode req_flush(struct Curl_easy *data);
101 struct Curl_easy *data, bool aborted) in Curl_req_done() argument
105 (void)req_flush(data); in Curl_req_done()
106 Curl_client_reset(data); in Curl_req_done()
108 Curl_doh_close(data); in Curl_req_done()
113 void Curl_req_hard_reset(struct SingleRequest *req, struct Curl_easy *data) in Curl_req_hard_reset() argument
121 Curl_client_reset(data); in Curl_req_hard_reset()
126 Curl_doh_close(data); in Curl_req_hard_reset()
162 req->no_body = data->set.opt_no_body; in Curl_req_hard_reset()
170 void Curl_req_free(struct SingleRequest *req, struct Curl_easy *data) in Curl_req_free() argument
178 Curl_client_cleanup(data); in Curl_req_free()
181 Curl_doh_cleanup(data); in Curl_req_free()
185 static CURLcode xfer_send(struct Curl_easy *data, in xfer_send() argument
209 if(data->set.max_send_speed) { in xfer_send()
211 if((curl_off_t)body_bytes > data->set.max_send_speed) in xfer_send()
212 blen = hds_len + (size_t)data->set.max_send_speed; in xfer_send()
215 if(data->req.eos_read && in xfer_send()
216 (Curl_bufq_is_empty(&data->req.sendbuf) || in xfer_send()
217 Curl_bufq_len(&data->req.sendbuf) == blen)) { in xfer_send()
218 DEBUGF(infof(data, "sending last upload chunk of %zu bytes", blen)); in xfer_send()
221 result = Curl_xfer_send(data, buf, blen, eos, pnwritten); in xfer_send()
224 data->req.eos_sent = TRUE; in xfer_send()
227 Curl_debug(data, CURLINFO_HEADER_OUT, (char *)buf, in xfer_send()
231 Curl_debug(data, CURLINFO_DATA_OUT, (char *)buf + hds_len, body_len); in xfer_send()
232 data->req.writebytecount += body_len; in xfer_send()
233 Curl_pgrsSetUploadCounter(data, data->req.writebytecount); in xfer_send()
240 static CURLcode req_send_buffer_flush(struct Curl_easy *data) in req_send_buffer_flush() argument
246 while(Curl_bufq_peek(&data->req.sendbuf, &buf, &blen)) { in req_send_buffer_flush()
247 size_t nwritten, hds_len = CURLMIN(data->req.sendbuf_hds_len, blen); in req_send_buffer_flush()
248 result = xfer_send(data, (const char *)buf, blen, hds_len, &nwritten); in req_send_buffer_flush()
252 Curl_bufq_skip(&data->req.sendbuf, nwritten); in req_send_buffer_flush()
254 data->req.sendbuf_hds_len -= CURLMIN(hds_len, nwritten); in req_send_buffer_flush()
264 CURLcode Curl_req_set_upload_done(struct Curl_easy *data) in Curl_req_set_upload_done() argument
266 DEBUGASSERT(!data->req.upload_done); in Curl_req_set_upload_done()
267 data->req.upload_done = TRUE; in Curl_req_set_upload_done()
268 data->req.keepon &= ~(KEEP_SEND|KEEP_SEND_TIMED); /* we are done sending */ in Curl_req_set_upload_done()
270 Curl_pgrsTime(data, TIMER_POSTRANSFER); in Curl_req_set_upload_done()
271 Curl_creader_done(data, data->req.upload_aborted); in Curl_req_set_upload_done()
273 if(data->req.upload_aborted) { in Curl_req_set_upload_done()
274 Curl_bufq_reset(&data->req.sendbuf); in Curl_req_set_upload_done()
275 if(data->req.writebytecount) in Curl_req_set_upload_done()
276 infof(data, "abort upload after having sent %" FMT_OFF_T " bytes", in Curl_req_set_upload_done()
277 data->req.writebytecount); in Curl_req_set_upload_done()
279 infof(data, "abort upload"); in Curl_req_set_upload_done()
281 else if(data->req.writebytecount) in Curl_req_set_upload_done()
282 infof(data, "upload completely sent off: %" FMT_OFF_T " bytes", in Curl_req_set_upload_done()
283 data->req.writebytecount); in Curl_req_set_upload_done()
284 else if(!data->req.download_done) { in Curl_req_set_upload_done()
285 DEBUGASSERT(Curl_bufq_is_empty(&data->req.sendbuf)); in Curl_req_set_upload_done()
286 infof(data, Curl_creader_total_length(data) ? in Curl_req_set_upload_done()
291 return Curl_xfer_send_close(data); in Curl_req_set_upload_done()
294 static CURLcode req_flush(struct Curl_easy *data) in req_flush() argument
298 if(!data || !data->conn) in req_flush()
301 if(!Curl_bufq_is_empty(&data->req.sendbuf)) { in req_flush()
302 result = req_send_buffer_flush(data); in req_flush()
305 if(!Curl_bufq_is_empty(&data->req.sendbuf)) { in req_flush()
306 DEBUGF(infof(data, "Curl_req_flush(len=%zu) -> EAGAIN", in req_flush()
307 Curl_bufq_len(&data->req.sendbuf))); in req_flush()
311 else if(Curl_xfer_needs_flush(data)) { in req_flush()
312 DEBUGF(infof(data, "Curl_req_flush(), xfer send_pending")); in req_flush()
313 return Curl_xfer_flush(data); in req_flush()
316 if(data->req.eos_read && !data->req.eos_sent) { in req_flush()
319 result = xfer_send(data, &tmp, 0, 0, &nwritten); in req_flush()
322 DEBUGASSERT(data->req.eos_sent); in req_flush()
325 if(!data->req.upload_done && data->req.eos_read && data->req.eos_sent) { in req_flush()
326 DEBUGASSERT(Curl_bufq_is_empty(&data->req.sendbuf)); in req_flush()
327 if(data->req.shutdown) { in req_flush()
329 result = Curl_xfer_send_shutdown(data, &done); in req_flush()
330 if(result && data->req.shutdown_err_ignore) { in req_flush()
331 infof(data, "Shutdown send direction error: %d. Broken server? " in req_flush()
342 return Curl_req_set_upload_done(data); in req_flush()
351 struct Curl_easy *data = reader_ctx; in add_from_client() local
355 *err = Curl_client_read(data, (char *)buf, buflen, &nread, &eos); in add_from_client()
359 data->req.eos_read = TRUE; in add_from_client()
365 static CURLcode req_send_buffer_add(struct Curl_easy *data, in req_send_buffer_add() argument
371 n = Curl_bufq_write(&data->req.sendbuf, in req_send_buffer_add()
377 data->req.sendbuf_hds_len += hds_len; in req_send_buffer_add()
381 CURLcode Curl_req_send(struct Curl_easy *data, struct dynbuf *req) in Curl_req_send() argument
387 if(!data || !data->conn) in Curl_req_send()
392 if(!Curl_creader_total_length(data)) { in Curl_req_send()
394 data->req.eos_read = TRUE; in Curl_req_send()
395 result = xfer_send(data, buf, blen, blen, &nwritten); in Curl_req_send()
406 result = req_send_buffer_add(data, buf, blen, blen); in Curl_req_send()
410 return Curl_req_send_more(data); in Curl_req_send()
416 bool Curl_req_sendbuf_empty(struct Curl_easy *data) in Curl_req_sendbuf_empty() argument
418 return !data->req.sendbuf_init || Curl_bufq_is_empty(&data->req.sendbuf); in Curl_req_sendbuf_empty()
421 bool Curl_req_want_send(struct Curl_easy *data) in Curl_req_want_send() argument
427 return !data->req.done && in Curl_req_want_send()
428 (((data->req.keepon & KEEP_SENDBITS) == KEEP_SEND) || in Curl_req_want_send()
429 !Curl_req_sendbuf_empty(data) || in Curl_req_want_send()
430 Curl_xfer_needs_flush(data)); in Curl_req_want_send()
433 bool Curl_req_done_sending(struct Curl_easy *data) in Curl_req_done_sending() argument
435 return data->req.upload_done && !Curl_req_want_send(data); in Curl_req_done_sending()
438 CURLcode Curl_req_send_more(struct Curl_easy *data) in Curl_req_send_more() argument
443 if(!data->req.upload_aborted && in Curl_req_send_more()
444 !data->req.eos_read && in Curl_req_send_more()
445 !(data->req.keepon & KEEP_SEND_PAUSE) && in Curl_req_send_more()
446 !Curl_bufq_is_full(&data->req.sendbuf)) { in Curl_req_send_more()
447 ssize_t nread = Curl_bufq_sipn(&data->req.sendbuf, 0, in Curl_req_send_more()
448 add_from_client, data, &result); in Curl_req_send_more()
453 result = req_flush(data); in Curl_req_send_more()
460 CURLcode Curl_req_abort_sending(struct Curl_easy *data) in Curl_req_abort_sending() argument
462 if(!data->req.upload_done) { in Curl_req_abort_sending()
463 Curl_bufq_reset(&data->req.sendbuf); in Curl_req_abort_sending()
464 data->req.upload_aborted = TRUE; in Curl_req_abort_sending()
466 data->req.keepon &= ~KEEP_SENDBITS; in Curl_req_abort_sending()
467 return Curl_req_set_upload_done(data); in Curl_req_abort_sending()
472 CURLcode Curl_req_stop_send_recv(struct Curl_easy *data) in Curl_req_stop_send_recv() argument
477 data->req.keepon &= ~(KEEP_RECV|KEEP_SENDBITS); in Curl_req_stop_send_recv()
478 return Curl_req_abort_sending(data); in Curl_req_stop_send_recv()