/* QUIC stream (not necessarily H3) */
struct cf_osslq_stream {
- curl_int64_t id;
+ int64_t id;
SSL *ssl;
struct bufq recvbuf; /* QUIC war data recv buffer */
BIT(recvd_eos);
if(!s->ssl) {
return CURLE_FAILED_INIT;
}
- s->id = (curl_int64_t)SSL_get_stream_id(s->ssl);
+ s->id = SSL_get_stream_id(s->ssl);
SSL_set_app_data(s->ssl, user_data);
return CURLE_OK;
}
struct Curl_easy *data)
{
struct cf_osslq_ctx *ctx = cf->ctx;
- curl_int64_t stream_id = (curl_int64_t)SSL_get_stream_id(stream_ssl);
+ int64_t stream_id = (int64_t)SSL_get_stream_id(stream_ssl);
int stype = SSL_get_stream_type(stream_ssl);
/* This could be a GREASE stream, e.g. HTTP/3 rfc9114 ch 6.2.3
* reserved stream type that is supposed to be discarded silently.
struct cf_osslq_stream *nstream;
if(h3->remote_ctrl_n >= CURL_ARRAYSIZE(h3->remote_ctrl)) {
/* rejected, we are full */
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] reject remote uni stream",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] reject remote uni stream",
stream_id);
SSL_free(stream_ssl);
return CURLE_OK;
nstream->id = stream_id;
nstream->ssl = stream_ssl;
Curl_bufq_initp(&nstream->recvbuf, &ctx->stream_bufcp, 1, BUFQ_OPT_NONE);
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] accepted remote uni stream",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] accepted remote uni stream",
stream_id);
return CURLE_OK;
}
default:
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] reject remote %s"
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] reject remote %s"
" stream, type=%x", stream_id,
(stype == SSL_STREAM_TYPE_BIDI) ? "bidi" : "write", stype);
SSL_free(stream_ssl);
struct h1_req_parser h1; /* h1 request parsing */
size_t sendbuf_len_in_flight; /* sendbuf amount "in flight" */
size_t recv_buf_nonflow; /* buffered bytes, not counting for flow control */
- curl_uint64_t error3; /* HTTP/3 stream error code */
+ uint64_t error3; /* HTTP/3 stream error code */
curl_off_t upload_left; /* number of request bytes left to upload */
curl_off_t download_recvd; /* number of response DATA bytes received */
int status_code; /* HTTP status code */
(void)cf;
if(stream) {
- CURL_TRC_CF(data, cf, "[%"FMT_PRId64"] easy handle is done",
+ CURL_TRC_CF(data, cf, "[%" PRIu64 "] easy handle is done",
stream->s.id);
if(ctx->h3.conn && (stream->s.id >= 0) && !stream->closed) {
nghttp3_conn_shutdown_stream_read(ctx->h3.conn, stream->s.id);
}
struct cf_ossq_find_ctx {
- curl_int64_t stream_id;
+ int64_t stream_id;
struct h3_stream_ctx *stream;
};
if(stream->error3 != NGHTTP3_H3_NO_ERROR) {
stream->reset = TRUE;
stream->send_closed = TRUE;
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] RESET: error %" FMT_PRIu64,
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] RESET: error %" PRIu64,
stream->s.id, stream->error3);
}
else {
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] CLOSED", stream->s.id);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] CLOSED", stream->s.id);
}
Curl_multi_mark_dirty(data);
return 0;
result = write_resp_raw(cf, data, buf, buflen, TRUE);
if(result) {
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] DATA len=%zu, ERROR %d",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu, ERROR %d",
stream->s.id, buflen, result);
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
stream->download_recvd += (curl_off_t)buflen;
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] DATA len=%zu, total=%" FMT_OFF_T,
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] DATA len=%zu, total=%" FMT_OFF_T,
stream->s.id, buflen, stream->download_recvd);
Curl_multi_mark_dirty(data);
return 0;
(void)conn;
(void)stream_id;
if(stream)
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] deferred consume %zu bytes",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] deferred consume %zu bytes",
stream->s.id, consumed);
return 0;
}
-static int cb_h3_recv_header(nghttp3_conn *conn, int64_t sid,
+static int cb_h3_recv_header(nghttp3_conn *conn, int64_t stream_id,
int32_t token, nghttp3_rcbuf *name,
nghttp3_rcbuf *value, uint8_t flags,
void *user_data, void *stream_user_data)
{
struct Curl_cfilter *cf = user_data;
- curl_int64_t stream_id = sid;
struct cf_osslq_ctx *ctx = cf->ctx;
nghttp3_vec h3name = nghttp3_rcbuf_get_buf(name);
nghttp3_vec h3val = nghttp3_rcbuf_get_buf(value);
return -1;
ncopy = curl_msnprintf(line, sizeof(line), "HTTP/3 %03d \r\n",
stream->status_code);
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] status: %s", stream_id, line);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] status: %s", stream_id, line);
result = write_resp_raw(cf, data, line, ncopy, FALSE);
if(result) {
return -1;
}
else {
/* store as an HTTP1-style header */
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] header: %.*s: %.*s",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] header: %.*s: %.*s",
stream_id, (int)h3name.len, h3name.base,
(int)h3val.len, h3val.base);
result = write_resp_raw(cf, data, h3name.base, h3name.len, FALSE);
return 0;
}
-static int cb_h3_end_headers(nghttp3_conn *conn, int64_t sid,
+static int cb_h3_end_headers(nghttp3_conn *conn, int64_t stream_id,
int fin, void *user_data, void *stream_user_data)
{
struct Curl_cfilter *cf = user_data;
struct cf_osslq_ctx *ctx = cf->ctx;
struct Curl_easy *data = stream_user_data;
- curl_int64_t stream_id = sid;
struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data);
CURLcode result = CURLE_OK;
(void)conn;
return -1;
}
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] end_headers, status=%d",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] end_headers, status=%d",
stream_id, stream->status_code);
if(stream->status_code / 100 != 1) {
stream->resp_hds_complete = TRUE;
return 0;
}
-static int cb_h3_stop_sending(nghttp3_conn *conn, int64_t sid,
+static int cb_h3_stop_sending(nghttp3_conn *conn, int64_t stream_id,
uint64_t app_error_code, void *user_data,
void *stream_user_data)
{
struct Curl_cfilter *cf = user_data;
struct cf_osslq_ctx *ctx = cf->ctx;
struct Curl_easy *data = stream_user_data;
- curl_int64_t stream_id = sid;
struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data);
(void)conn;
(void)app_error_code;
if(!stream || !stream->s.ssl)
return 0;
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] stop_sending", stream_id);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] stop_sending", stream_id);
cf_osslq_stream_close(&stream->s);
return 0;
}
-static int cb_h3_reset_stream(nghttp3_conn *conn, int64_t sid,
+static int cb_h3_reset_stream(nghttp3_conn *conn, int64_t stream_id,
uint64_t app_error_code, void *user_data,
void *stream_user_data)
{
struct Curl_cfilter *cf = user_data;
struct cf_osslq_ctx *ctx = cf->ctx;
struct Curl_easy *data = stream_user_data;
- curl_int64_t stream_id = sid;
struct h3_stream_ctx *stream = H3_STREAM_CTX(ctx, data);
int rv;
(void)conn;
SSL_STREAM_RESET_ARGS args = {0};
args.quic_error_code = app_error_code;
rv = !SSL_stream_reset(stream->s.ssl, &args, sizeof(args));
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] reset -> %d", stream_id, rv);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] reset -> %d", stream_id, rv);
if(!rv) {
return NGHTTP3_ERR_CALLBACK_FAILURE;
}
}
else if(!nwritten) {
/* Not EOF, and nothing to give, we signal WOULDBLOCK. */
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] read req body -> AGAIN",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] read req body -> AGAIN",
stream->s.id);
return NGHTTP3_ERR_WOULDBLOCK;
}
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] read req body -> "
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] read req body -> "
"%d vecs%s with %zu (buffered=%zu, left=%" FMT_OFF_T ")",
stream->s.id, (int)nvecs,
*pflags == NGHTTP3_DATA_FLAG_EOF ? " EOF" : "",
return CURLE_AGAIN;
}
else if(detail == SSL_ERROR_ZERO_RETURN) {
- CURL_TRC_CF(x->data, x->cf, "[%" FMT_PRId64 "] h3_quic_recv -> EOS",
+ CURL_TRC_CF(x->data, x->cf, "[%" PRId64 "] h3_quic_recv -> EOS",
x->s->id);
x->s->recvd_eos = TRUE;
return CURLE_OK;
return CURLE_RECV_ERROR;
}
else {
- CURL_TRC_CF(x->data, x->cf, "[%" FMT_PRId64 "] h3_quic_recv -> RESET, "
+ CURL_TRC_CF(x->data, x->cf, "[%" PRId64 "] h3_quic_recv -> RESET, "
"rv=%d, app_err=%" FMT_PRIu64,
x->s->id, rv, (curl_uint64_t)app_error_code);
if(app_error_code != NGHTTP3_H3_NO_ERROR)
while(Curl_bufq_peek(&s->recvbuf, &buf, &blen)) {
nread = nghttp3_conn_read_stream(ctx->h3.conn, s->id,
buf, blen, 0);
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] forward %zu bytes "
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] forward %zu bytes "
"to nghttp3 -> %zd", s->id, blen, nread);
if(nread < 0) {
failf(data, "nghttp3_conn_read_stream(len=%zu) error: %s",
rv = nghttp3_conn_close_stream(ctx->h3.conn, s->id,
NGHTTP3_H3_NO_ERROR);
s->closed = TRUE;
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] close nghttp3 stream -> %d",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] close nghttp3 stream -> %d",
s->id, rv);
if(rv < 0 && rv != NGHTTP3_ERR_STREAM_NOT_FOUND) {
failf(data, "nghttp3_conn_close_stream returned error: %s",
}
out:
if(result)
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_osslq_stream_recv -> %d",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_osslq_stream_recv -> %d",
s->id, result);
return result;
}
s = cf_osslq_get_qstream(cf, data, stream_id);
if(!s) {
failf(data, "nghttp3_conn_writev_stream gave unknown stream %"
- FMT_PRId64, (curl_int64_t)stream_id);
+ PRId64, stream_id);
result = CURLE_SEND_ERROR;
goto out;
}
if(ok) {
/* As OpenSSL buffers the data, we count this as acknowledged
* from nghttp3's point of view */
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] send %zu bytes to QUIC ok",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] send %zu bytes to QUIC ok",
s->id, vec[i].len);
acked_len += vec[i].len;
}
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
/* QUIC blocked us from writing more */
- CURL_TRC_CF(data, cf, "[%"FMT_PRId64 "] send %zu bytes to "
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] send %zu bytes to "
"QUIC blocked", s->id, vec[i].len);
written = 0;
nghttp3_conn_block_stream(ctx->h3.conn, s->id);
s->send_blocked = blocked = TRUE;
break;
default:
- failf(data, "[%"FMT_PRId64 "] send %zu bytes to QUIC, SSL error %d",
+ failf(data, "[%" PRId64 "] send %zu bytes to QUIC, SSL error %d",
s->id, vec[i].len, detail);
result = cf_osslq_ssl_err(cf, data, detail, CURLE_HTTP3);
goto out;
result = CURLE_SEND_ERROR;
goto out;
}
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] forwarded %zu/%zu h3 bytes "
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] forwarded %zu/%zu h3 bytes "
"to QUIC, eos=%d", s->id, acked_len, total_len, eos);
}
if(eos && !s->send_blocked && !eos_written) {
/* wrote everything and H3 indicates end of stream */
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] closing QUIC stream", s->id);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] closing QUIC stream", s->id);
SSL_stream_conclude(s->ssl, 0);
}
}
if(rc) {
switch(rc) {
case NGHTTP3_ERR_CONN_CLOSING:
- CURL_TRC_CF(data, cf, "h3sid[%"FMT_PRId64"] failed to send, "
+ CURL_TRC_CF(data, cf, "h3sid[%" PRId64 "] failed to send, "
"connection is closing", stream->s.id);
break;
default:
- CURL_TRC_CF(data, cf, "h3sid[%"FMT_PRId64 "] failed to send -> %d (%s)",
+ CURL_TRC_CF(data, cf, "h3sid[%" PRId64 "] failed to send -> %d (%s)",
stream->s.id, rc, nghttp3_strerror(rc));
break;
}
}
if(Curl_trc_is_verbose(data)) {
- infof(data, "[HTTP/3] [%" FMT_PRId64 "] OPENED stream for %s",
+ infof(data, "[HTTP/3] [%" PRId64 "] OPENED stream for %s",
stream->s.id, data->state.url);
for(i = 0; i < nheader; ++i) {
- infof(data, "[HTTP/3] [%" FMT_PRId64 "] [%.*s: %.*s]",
+ infof(data, "[HTTP/3] [%" PRId64 "] [%.*s: %.*s]",
stream->s.id,
(int)nva[i].namelen, nva[i].name,
(int)nva[i].valuelen, nva[i].value);
* body. This happens on 30x or 40x responses.
* We silently discard the data sent, since this is not a transport
* error situation. */
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] discarding data"
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] discarding data"
"on closed stream with response", stream->s.id);
result = CURLE_OK;
*pnwritten = len;
goto out;
}
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] send_body(len=%zu) "
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] send_body(len=%zu) "
"-> stream closed", stream->s.id, len);
result = CURLE_HTTP3;
goto out;
}
else {
result = Curl_bufq_write(&stream->sendbuf, buf, len, pnwritten);
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_send, add to "
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_send, add to "
"sendbuf(len=%zu) -> %d, %zu",
stream->s.id, len, result, *pnwritten);
if(result)
out:
result = Curl_1st_err(result, check_and_set_expiry(cf, data));
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_send(len=%zu) -> %d, %zu",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_send(len=%zu) -> %d, %zu",
stream ? stream->s.id : -1, len, result, *pnwritten);
CF_DATA_RESTORE(cf, save);
return result;
*pnread = 0;
if(stream->reset) {
failf(data,
- "HTTP/3 stream %" FMT_PRId64 " reset by server",
+ "HTTP/3 stream %" PRId64 " reset by server",
stream->s.id);
return data->req.bytecount ? CURLE_PARTIAL_FILE : CURLE_HTTP3;
}
else if(!stream->resp_hds_complete) {
failf(data,
- "HTTP/3 stream %" FMT_PRId64
+ "HTTP/3 stream %" PRId64
" was closed cleanly, but before getting"
" all response header fields, treated as error",
stream->s.id);
if(!Curl_bufq_is_empty(&stream->recvbuf)) {
result = Curl_bufq_cread(&stream->recvbuf, buf, len, pnread);
if(result) {
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] read recvbuf(len=%zu) "
- "-> %d, %zu", stream->s.id, len, result, *pnread);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] read recvbuf(len=%zu) -> %d, %zu",
+ stream->s.id, len, result, *pnread);
goto out;
}
}
if(!*pnread && !Curl_bufq_is_empty(&stream->recvbuf)) {
result = Curl_bufq_cread(&stream->recvbuf, buf, len, pnread);
if(result) {
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] read recvbuf(len=%zu) "
- "-> %d, %zu", stream->s.id, len, result, *pnread);
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] read recvbuf(len=%zu) -> %d, %zu",
+ stream->s.id, len, result, *pnread);
goto out;
}
}
result = Curl_1st_err(result, cf_progress_egress(cf, data));
result = Curl_1st_err(result, check_and_set_expiry(cf, data));
- CURL_TRC_CF(data, cf, "[%" FMT_PRId64 "] cf_recv(len=%zu) -> %d, %zu",
+ CURL_TRC_CF(data, cf, "[%" PRId64 "] cf_recv(len=%zu) -> %d, %zu",
stream ? stream->s.id : -1, len, result, *pnread);
CF_DATA_RESTORE(cf, save);
return result;