HTTP_ERR_SIZE
};
+/* Flags used by HTTP parsers */
+#define HTTP_PF_DIR_RES 0x00000001 /* direction: 0: request; 1: response */
+
+
/* HTTP parser error codes */
enum http_parser_status {
HTTP_PRS_SUCCESS = 0,
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);
+enum http_parser_status http_trailers_to_htx(struct http_hdr *list, 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);
goto out;
}
- prs_status = http_trailers_to_htx(list, htx);
+ prs_status = http_trailers_to_htx(list, 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.
+ * is compatible with receipt of trailers. The <flags> is a union of HTTP_PF_*
+ * describing the parser's state and permissions (direction, pseudo-headers,
+ * etc).
*
* The trailers list <list> must be composed of :
* - n.name != NULL, n.len > 0 : literal trailer name
* - 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)
+enum http_parser_status http_trailers_to_htx(struct http_hdr *list, struct htx *htx, uint flags)
{
uint32_t data_ofs = htx->data; /* used to rollback on error */
enum http_parser_status ret = HTTP_PRS_SUCCESS;
}
/* Trailers terminate a DATA sequence */
- prs_status = http_trailers_to_htx(list, htx);
+ prs_status = http_trailers_to_htx(list, 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: