Skip to content

Commit 3322243

Browse files
committed
MINOR: h3: complete error traces
1 parent 48efb26 commit 3322243

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

src/h3.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,10 @@ static int _h3_handle_hdr(struct qcs *qcs, const struct http_hdr *hdr)
537537
const char *ctl;
538538
int i;
539539

540-
if (isteq(name, ist("")))
541-
return 1;
540+
if (isteq(name, ist(""))) {
541+
TRACE_ERROR("empty header name", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
542+
goto err;
543+
}
542544

543545
if (istmatch(name, ist(":"))) {
544546
TRACE_ERROR("pseudo-header field after fields", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
@@ -814,6 +816,7 @@ static ssize_t h3_req_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
814816
}
815817
}
816818
else {
819+
TRACE_ERROR("CONNECT method not yet implemented", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
817820
h3s->err = H3_ERR_REQUEST_REJECTED;
818821
len = -1;
819822
goto out;
@@ -902,6 +905,7 @@ static ssize_t h3_req_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
902905

903906
sl = htx_add_stline(htx, HTX_BLK_REQ_SL, flags, meth, uri, ist("HTTP/3.0"));
904907
if (!sl) {
908+
TRACE_ERROR("rejected HTX status-line", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
905909
len = -1;
906910
goto out;
907911
}
@@ -913,6 +917,7 @@ static ssize_t h3_req_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
913917

914918
if (isttest(authority)) {
915919
if (!htx_add_header(htx, ist("host"), authority)) {
920+
TRACE_ERROR("rejected HTX host header", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
916921
len = -1;
917922
goto out;
918923
}
@@ -1015,6 +1020,7 @@ static ssize_t h3_req_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
10151020
}
10161021

10171022
if (!htx_add_header(htx, list[hdr_idx].n, _h3_trim_header(list[hdr_idx].v))) {
1023+
TRACE_ERROR("HTX header rejected", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
10181024
len = -1;
10191025
goto out;
10201026
}
@@ -1038,18 +1044,21 @@ static ssize_t h3_req_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
10381044

10391045
if (cookie >= 0) {
10401046
if (http_cookie_merge(htx, list, cookie)) {
1047+
TRACE_ERROR("cannot merge cookies", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
10411048
len = -1;
10421049
goto out;
10431050
}
10441051
}
10451052

10461053
/* Check the number of blocks against "tune.http.maxhdr" value before adding EOH block */
10471054
if (htx_nbblks(htx) > global.tune.max_http_hdr) {
1055+
TRACE_ERROR("too many headers", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
10481056
len = -1;
10491057
goto out;
10501058
}
10511059

10521060
if (!htx_add_endof(htx, HTX_BLK_EOH)) {
1061+
TRACE_ERROR("cannot add HTX EOF", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
10531062
len = -1;
10541063
goto out;
10551064
}
@@ -1061,6 +1070,7 @@ static ssize_t h3_req_headers_to_htx(struct qcs *qcs, const struct buffer *buf,
10611070
htx = NULL;
10621071

10631072
if (qcs_attach_sc(qcs, &htx_buf, fin)) {
1073+
TRACE_ERROR("cannot instantiate upper stream layer", H3_EV_RX_FRAME|H3_EV_RX_HDR, qcs->qcc->conn, qcs);
10641074
len = -1;
10651075
goto out;
10661076
}

0 commit comments

Comments
 (0)