mirror of
https://github.com/curl/curl.git
synced 2025-09-18 18:12:49 +03:00
ngtcp2: stop buffering crypto data
Stop buffering crypto data because libngtcp2 now buffers submitted crypto data. Closes #7637
This commit is contained in:
parent
9df52bf17a
commit
14da6eb4e5
|
@ -190,27 +190,9 @@ static int write_client_handshake(struct quicsocket *qs,
|
||||||
ngtcp2_crypto_level level,
|
ngtcp2_crypto_level level,
|
||||||
const uint8_t *data, size_t len)
|
const uint8_t *data, size_t len)
|
||||||
{
|
{
|
||||||
struct quic_handshake *crypto_data;
|
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
crypto_data = &qs->crypto_data[level];
|
rv = ngtcp2_conn_submit_crypto_data(qs->qconn, level, data, len);
|
||||||
if(!crypto_data->buf) {
|
|
||||||
crypto_data->buf = malloc(4096);
|
|
||||||
if(!crypto_data->buf)
|
|
||||||
return 0;
|
|
||||||
crypto_data->alloclen = 4096;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO Just pretend that handshake does not grow more than 4KiB for
|
|
||||||
now */
|
|
||||||
assert(crypto_data->len + len <= crypto_data->alloclen);
|
|
||||||
|
|
||||||
memcpy(&crypto_data->buf[crypto_data->len], data, len);
|
|
||||||
crypto_data->len += len;
|
|
||||||
|
|
||||||
rv = ngtcp2_conn_submit_crypto_data(
|
|
||||||
qs->qconn, level, (uint8_t *)(&crypto_data->buf[crypto_data->len] - len),
|
|
||||||
len);
|
|
||||||
if(rv) {
|
if(rv) {
|
||||||
H3BUGF(fprintf(stderr, "write_client_handshake failed\n"));
|
H3BUGF(fprintf(stderr, "write_client_handshake failed\n"));
|
||||||
}
|
}
|
||||||
|
@ -832,7 +814,6 @@ static int ng_getsock(struct Curl_easy *data, struct connectdata *conn,
|
||||||
|
|
||||||
static void qs_disconnect(struct quicsocket *qs)
|
static void qs_disconnect(struct quicsocket *qs)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
if(!qs->conn) /* already closed */
|
if(!qs->conn) /* already closed */
|
||||||
return;
|
return;
|
||||||
qs->conn = NULL;
|
qs->conn = NULL;
|
||||||
|
@ -853,8 +834,6 @@ static void qs_disconnect(struct quicsocket *qs)
|
||||||
qs->cred = NULL;
|
qs->cred = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for(i = 0; i < 3; i++)
|
|
||||||
Curl_safefree(qs->crypto_data[i].buf);
|
|
||||||
nghttp3_conn_del(qs->h3conn);
|
nghttp3_conn_del(qs->h3conn);
|
||||||
ngtcp2_conn_del(qs->qconn);
|
ngtcp2_conn_del(qs->qconn);
|
||||||
#ifdef USE_OPENSSL
|
#ifdef USE_OPENSSL
|
||||||
|
|
|
@ -34,13 +34,6 @@
|
||||||
#include <gnutls/gnutls.h>
|
#include <gnutls/gnutls.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct quic_handshake {
|
|
||||||
char *buf; /* pointer to the buffer */
|
|
||||||
size_t alloclen; /* size of allocation */
|
|
||||||
size_t len; /* size of content in buffer */
|
|
||||||
size_t nread; /* how many bytes have been read */
|
|
||||||
};
|
|
||||||
|
|
||||||
struct quicsocket {
|
struct quicsocket {
|
||||||
struct connectdata *conn; /* point back to the connection */
|
struct connectdata *conn; /* point back to the connection */
|
||||||
ngtcp2_conn *qconn;
|
ngtcp2_conn *qconn;
|
||||||
|
@ -56,7 +49,6 @@ struct quicsocket {
|
||||||
gnutls_certificate_credentials_t cred;
|
gnutls_certificate_credentials_t cred;
|
||||||
gnutls_session_t ssl;
|
gnutls_session_t ssl;
|
||||||
#endif
|
#endif
|
||||||
struct quic_handshake crypto_data[3];
|
|
||||||
/* the last TLS alert description generated by the local endpoint */
|
/* the last TLS alert description generated by the local endpoint */
|
||||||
uint8_t tls_alert;
|
uint8_t tls_alert;
|
||||||
struct sockaddr_storage local_addr;
|
struct sockaddr_storage local_addr;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user