void http_cookie_register(struct http_hdr *list, int idx, int *first, int *last);
int http_cookie_merge(struct htx *htx, struct http_hdr *list, int first);
-enum http_parser_status http_trailers_to_htx(struct http_hdr *list, struct htx *htx, uint flags);
+enum http_parser_status http_trailers_to_htx(struct http_hdr *list, int need_eot, struct htx *htx, uint flags);
struct buffer *http_load_errorfile(const char *file, char **errmsg);
struct buffer *http_load_errormsg(const char *key, const struct ist msg, char **errmsg);
parser_flags = HTTP_PF_UPCASE_OK;
parser_flags |= (h1m->flags & H1_MF_RESP) ? HTTP_PF_DIR_RES : 0;
- if (http_trailers_to_htx(hdrs, dsthtx, parser_flags) != HTTP_PRS_SUCCESS)
+ if (http_trailers_to_htx(hdrs, 1, dsthtx, parser_flags) != HTTP_PRS_SUCCESS)
goto error;
h1m->state = H1_MSG_DONE;
goto out;
}
- prs_status = http_trailers_to_htx(list, htx, (qcs->qcc->flags & QC_CF_IS_BACK) ? HTTP_PF_DIR_RES : 0);
+ prs_status = http_trailers_to_htx(list, 1, htx, (qcs->qcc->flags & QC_CF_IS_BACK) ? HTTP_PF_DIR_RES : 0);
switch (prs_status) {
case HTTP_PRS_SUCCESS:
break;
* <htx>, and an HTTP_PRS_SUCCESS status code is returned if some bytes were
* emitted. In case of error, another code is returned, indicating the nature
* of the problem. The caller must have verified that the message in the buffer
- * is compatible with receipt of trailers. The <flags> is a union of HTTP_PF_*
+ * is compatible with receipt of trailers. If <need_eot> is true, the EOT
+ * block is appended to the HTX message. Caller may want to skip it for now if
+ * EOM reporting needs to be delayed. The <flags> is a union of HTTP_PF_*
* describing the parser's state and permissions (direction, pseudo-headers,
* etc).
*
* - in all cases except the end of list, v.name and v.len must designate a
* valid value.
*/
-enum http_parser_status http_trailers_to_htx(struct http_hdr *list, struct htx *htx, uint flags)
+enum http_parser_status http_trailers_to_htx(struct http_hdr *list, int need_eot, struct htx *htx, uint flags)
{
uint32_t data_ofs = htx->data; /* used to rollback on error */
enum http_parser_status ret = HTTP_PRS_SUCCESS;
}
/* now finalize the trailers block */
- if (!htx_add_endof(htx, HTX_BLK_EOT)) {
+ if (need_eot && !htx_add_endof(htx, HTX_BLK_EOT)) {
ret = HTTP_PRS_TOO_LARGE;
goto fail;
}
}
/* Trailers terminate a DATA sequence */
- prs_status = http_trailers_to_htx(list, htx, (h2c->flags & H2_CF_IS_BACK) ? HTTP_PF_DIR_RES : 0);
+ prs_status = http_trailers_to_htx(list, 1, htx, (h2c->flags & H2_CF_IS_BACK) ? HTTP_PF_DIR_RES : 0);
if (prs_status != HTTP_PRS_SUCCESS) {
switch (prs_status) {
case HTTP_PRS_INV_HNAME: