[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 78/220: quiche: make POSTFIELDS posts work
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 78/220: quiche: make POSTFIELDS posts work |
Date: |
Thu, 12 Sep 2019 17:27:18 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 7a83e1d1d43740d979a2db78a7e944f09fe9b73a
Author: Daniel Stenberg <address@hidden>
AuthorDate: Wed Aug 7 11:04:47 2019 +0200
quiche: make POSTFIELDS posts work
---
lib/vquic/quiche.c | 41 +++++++++++++++++++++++++++--------------
1 file changed, 27 insertions(+), 14 deletions(-)
diff --git a/lib/vquic/quiche.c b/lib/vquic/quiche.c
index 0df930d31..67c2b1b42 100644
--- a/lib/vquic/quiche.c
+++ b/lib/vquic/quiche.c
@@ -39,6 +39,7 @@
#include "memdebug.h"
/* #define DEBUG_HTTP3 */
+/* #define DEBUG_QUICHE */
#ifdef DEBUG_HTTP3
#define H3BUGF(x) x
#else
@@ -324,7 +325,7 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
switch(quiche_h3_event_type(ev)) {
case QUICHE_H3_EVENT_HEADERS:
- infof(conn->data, "quiche says HEADERS\n");
+ H3BUGF(infof(conn->data, "quiche says HEADERS\n"));
rc = quiche_h3_event_for_each_header(ev, cb_each_header, &headers);
if(rc) {
fprintf(stderr, "failed to process headers");
@@ -333,7 +334,7 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
recvd = headers.nlen;
break;
case QUICHE_H3_EVENT_DATA:
- infof(conn->data, "quiche says DATA\n");
+ H3BUGF(infof(conn->data, "quiche says DATA\n"));
if(!stream->firstbody) {
/* add a header-body separator CRLF */
buf[0] = '\r';
@@ -355,7 +356,7 @@ static ssize_t h3_stream_recv(struct connectdata *conn,
break;
case QUICHE_H3_EVENT_FINISHED:
- infof(conn->data, "quiche says FINISHED\n");
+ H3BUGF(infof(conn->data, "quiche says FINISHED\n"));
if(quiche_conn_close(qs->conn, true, 0, NULL, 0) < 0) {
fprintf(stderr, "failed to close connection\n");
}
@@ -420,7 +421,7 @@ int Curl_quic_ver(char *p, size_t len)
return msnprintf(p, len, " quiche/%s", quiche_version());
}
-#ifdef DEBUG_HTTP3
+#ifdef DEBUG_QUICHE
static void debug_log(const char *line, void *argp)
{
(void)argp;
@@ -447,8 +448,9 @@ static CURLcode http_request(struct connectdata *conn,
const void *mem,
quiche_h3_header *nva = NULL;
struct quicsocket *qs = &conn->quic;
CURLcode result = CURLE_OK;
+ struct Curl_easy *data = conn->data;
-#ifdef DEBUG_HTTP3
+#ifdef DEBUG_QUICHE
quiche_enable_debug_logging(debug_log, NULL);
#endif
@@ -605,30 +607,41 @@ static CURLcode http_request(struct connectdata *conn,
const void *mem,
for(i = 0; i < nheader; ++i) {
acc += nva[i].name_len + nva[i].value_len;
- H3BUGF(infof(conn->data, "h3 [%.*s: %.*s]\n",
+ H3BUGF(infof(data, "h3 [%.*s: %.*s]\n",
nva[i].name_len, nva[i].name,
nva[i].value_len, nva[i].value));
}
if(acc > MAX_ACC) {
- infof(conn->data, "http_request: Warning: The cumulative length of all "
+ infof(data, "http_request: Warning: The cumulative length of all "
"headers exceeds %zu bytes and that could cause the "
"stream to be rejected.\n", MAX_ACC);
}
}
- switch(conn->data->set.httpreq) {
+ switch(data->set.httpreq) {
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
case HTTPREQ_POST_MIME:
case HTTPREQ_PUT:
- if(conn->data->state.infilesize != -1)
- stream->upload_left = conn->data->state.infilesize;
+ if(data->state.infilesize != -1)
+ stream->upload_left = data->state.infilesize;
else
/* data sending without specifying the data amount up front */
stream->upload_left = -1; /* unknown, but not zero */
- /* fix the body submission */
+ stream3_id = quiche_h3_send_request(qs->h3c, qs->conn, nva, nheader,
+ stream->upload_left ? FALSE: TRUE);
+ if((stream3_id >= 0) && data->set.postfields) {
+ ssize_t sent = quiche_h3_send_body(qs->h3c, qs->conn, stream3_id,
+ (uint8_t *)data->set.postfields,
+ stream->upload_left, TRUE);
+ if(sent <= 0) {
+ failf(data, "quiche_h3_send_body failed!");
+ result = CURLE_SEND_ERROR;
+ }
+ stream->upload_left = 0; /* nothing left to send */
+ }
break;
default:
stream3_id = quiche_h3_send_request(qs->h3c, qs->conn, nva, nheader,
@@ -639,14 +652,14 @@ static CURLcode http_request(struct connectdata *conn,
const void *mem,
Curl_safefree(nva);
if(stream3_id < 0) {
- H3BUGF(infof(conn->data, "quiche_h3_send_request returned %d\n",
+ H3BUGF(infof(data, "quiche_h3_send_request returned %d\n",
stream3_id));
result = CURLE_SEND_ERROR;
goto fail;
}
- infof(conn->data, "Using HTTP/3 Stream ID: %x (easy handle %p)\n",
- stream3_id, (void *)conn->data);
+ infof(data, "Using HTTP/3 Stream ID: %x (easy handle %p)\n",
+ stream3_id, (void *)data);
stream->stream3_id = stream3_id;
return CURLE_OK;
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 74/220: os400: take care of CURLOPT_SASL_AUTHZID in curl_easy_setopt_ccsid()., (continued)
- [GNUnet-SVN] [gnurl] 74/220: os400: take care of CURLOPT_SASL_AUTHZID in curl_easy_setopt_ccsid()., gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 87/220: docs/ALTSVC: remove what works and the experimental explanation, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 102/220: configure: avoid undefined check_for_ca_bundle, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 51/220: md4: Use the Curl_md4it() function for OpenSSL based NTLM, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 56/220: md4: No need to include Curl_md4.h for each TLS library, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 53/220: md4: Move the WinCrypt implementation out of the NTLM code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 54/220: md4: Move the mbed TLS MD4 implementation out of the NTLM code, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 59/220: altsvc: fix removal of expired cache entry, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 58/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 69/220: docs/HTTP3: refreshed as it is now in master and HTTP/3 can be tested, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 78/220: quiche: make POSTFIELDS posts work,
gnunet <=
- [GNUnet-SVN] [gnurl] 77/220: quiche: improved error handling and memory cleanups, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 67/220: curl_multi_poll: a sister to curl_multi_wait() that waits more, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 70/220: sasl: Implement SASL authorisation identity via CURLOPT_SASL_AUTHZID, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 71/220: curl: --sasl-authzid added to support CURLOPT_SASL_AUTHZID from the tool, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 99/220: curl_global_init_mem.3: mention it was added in 7.12.0, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 93/220: cleanup: s/curl_debug/curl_dbg_debug in comments and docs, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 94/220: quiche: add SSLKEYLOGFILE support, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 103/220: asyn-thread: issue CURL_POLL_REMOVE before closing socket, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 95/220: http3: make connection reuse work, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 105/220: nghttp3: initial h3 template code added, gnunet, 2019/09/12