ngtcp2/quiche: make :scheme possible to set

This commit is contained in:
Daniel Stenberg 2022-02-06 16:02:04 +01:00
parent c85178a94c
commit 79731d1a6c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 33 additions and 11 deletions

View File

@ -45,6 +45,7 @@
#include "strerror.h"
#include "dynbuf.h"
#include "vquic.h"
#include "transfer.h"
#include "vtls/keylog.h"
/* The last 3 #include files should be in this order */
@ -1394,6 +1395,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
int64_t stream3_id;
int rc;
struct h3out *h3out = NULL;
char *vptr;
rc = ngtcp2_conn_open_bidi_stream(qs->qconn, &stream3_id, NULL);
if(rc) {
@ -1466,10 +1468,21 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
nva[2].name = (unsigned char *)H3_PSEUDO_SCHEME;
nva[2].namelen = sizeof(H3_PSEUDO_SCHEME) - 1;
if(conn->handler->flags & PROTOPT_SSL)
nva[2].value = (unsigned char *)"https";
else
nva[2].value = (unsigned char *)"http";
vptr = Curl_checkheaders(data, H3_PSEUDO_SCHEME);
if(vptr) {
vptr += sizeof(H3_PSEUDO_SCHEME);
while(*vptr && ISSPACE(*vptr))
vptr++;
nva[2].value = (unsigned char *)vptr;
infof(data, "set pseduo header %s to %s", H3_PSEUDO_SCHEME, vptr);
}
else {
if(conn->handler->flags & PROTOPT_SSL)
nva[2].value = (unsigned char *)"https";
else
nva[2].value = (unsigned char *)"http";
}
nva[2].valuelen = strlen((char *)nva[2].value);
nva[2].flags = NGHTTP3_NV_FLAG_NONE;

View File

@ -36,6 +36,7 @@
#include "connect.h"
#include "strerror.h"
#include "vquic.h"
#include "transfer.h"
#include "vtls/openssl.h"
#include "vtls/keylog.h"
@ -709,8 +710,6 @@ void Curl_quic_ver(char *p, size_t len)
static CURLcode http_request(struct Curl_easy *data, const void *mem,
size_t len)
{
/*
*/
struct connectdata *conn = data->conn;
struct HTTP *stream = data->req.p.http;
size_t nheader;
@ -722,6 +721,7 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
quiche_h3_header *nva = NULL;
struct quicsocket *qs = conn->quic;
CURLcode result = CURLE_OK;
char *vptr;
stream->h3req = TRUE; /* senf off! */
@ -783,13 +783,22 @@ static CURLcode http_request(struct Curl_easy *data, const void *mem,
nva[2].name = (unsigned char *)H3_PSEUDO_SCHEME;
nva[2].name_len = sizeof(H3_PSEUDO_SCHEME) - 1;
if(conn->handler->flags & PROTOPT_SSL)
nva[2].value = (unsigned char *)"https";
else
nva[2].value = (unsigned char *)"http";
vptr = Curl_checkheaders(data, H3_PSEUDO_SCHEME);
if(vptr) {
vptr += sizeof(H3_PSEUDO_SCHEME);
while(*vptr && ISSPACE(*vptr))
vptr++;
nva[2].value = (unsigned char *)vptr;
infof(data, "set pseduo header %s to %s", H3_PSEUDO_SCHEME, vptr);
}
else {
if(conn->handler->flags & PROTOPT_SSL)
nva[2].value = (unsigned char *)"https";
else
nva[2].value = (unsigned char *)"http";
}
nva[2].value_len = strlen((char *)nva[2].value);
authority_idx = 0;
i = 3;
while(i < nheader) {