blob: 617417ad5ce61a14529f231bf51d626a68d71583 [file] [log] [blame]
Christopher Faulet47596d32018-10-22 09:17:28 +02001/*
2 * include/types/http_htx.h
3 * This file defines function prototypes for HTTP manipulation using the
4 * internal representation.
5 *
6 * Copyright (C) 2018 HAProxy Technologies, Christopher Faulet <cfaulet@haproxy.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation, version 2.1
11 * exclusively.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 */
22
23#ifndef _PROTO_HTTP_HTX_H
24#define _PROTO_HTTP_HTX_H
25
26#include <common/buf.h>
Christopher Fauleta7b677c2018-11-29 16:48:49 +010027#include <common/ist.h>
Christopher Faulet47596d32018-10-22 09:17:28 +020028
Christopher Faulet47596d32018-10-22 09:17:28 +020029#include <types/http_htx.h>
30
Christopher Fauletf7346382019-07-17 22:02:08 +020031extern struct buffer http_err_chunks[HTTP_ERR_SIZE];
Christopher Faulet554c0eb2020-01-14 12:00:28 +010032extern struct list http_errors_list;
Christopher Fauleta7b677c2018-11-29 16:48:49 +010033
Christopher Faulet297fbb42019-05-13 14:41:27 +020034struct htx_sl *http_get_stline(struct htx *htx);
Christopher Faulet727a3f12020-02-07 16:39:41 +010035size_t http_get_hdrs_size(struct htx *htx);
Christopher Faulet47596d32018-10-22 09:17:28 +020036int http_find_header(const struct htx *htx, const struct ist name, struct http_hdr_ctx *ctx, int full);
37int http_add_header(struct htx *htx, const struct ist n, const struct ist v);
Christopher Fauletf1ba18d2018-11-26 21:37:08 +010038int http_replace_stline(struct htx *htx, const struct ist p1, const struct ist p2, const struct ist p3);
Christopher Faulete010c802018-10-24 10:36:45 +020039int http_replace_req_meth(struct htx *htx, const struct ist meth);
40int http_replace_req_uri(struct htx *htx, const struct ist uri);
41int http_replace_req_path(struct htx *htx, const struct ist path);
42int http_replace_req_query(struct htx *htx, const struct ist query);
43int http_replace_res_status(struct htx *htx, const struct ist status);
44int http_replace_res_reason(struct htx *htx, const struct ist reason);
Christopher Faulet47596d32018-10-22 09:17:28 +020045int http_replace_header_value(struct htx *htx, struct http_hdr_ctx *ctx, const struct ist data);
46int http_replace_header(struct htx *htx, struct http_hdr_ctx *ctx, const struct ist name, const struct ist value);
47int http_remove_header(struct htx *htx, struct http_hdr_ctx *ctx);
Christopher Faulet7ff1cea2018-10-24 10:39:35 +020048unsigned int http_get_htx_hdr(const struct htx *htx, const struct ist hdr,
49 int occ, struct http_hdr_ctx *ctx, char **vptr, size_t *vlen);
50unsigned int http_get_htx_fhdr(const struct htx *htx, const struct ist hdr,
51 int occ, struct http_hdr_ctx *ctx, char **vptr, size_t *vlen);
Christopher Faulet90cc4812019-07-22 16:49:30 +020052int http_str_to_htx(struct buffer *buf, struct ist raw);
Christopher Faulet47596d32018-10-22 09:17:28 +020053
Christopher Faulet58857752020-01-15 15:19:50 +010054struct buffer *http_load_errorfile(const char *file, char **errmsg);
55struct buffer *http_load_errormsg(const char *key, const struct ist msg, char **errmsg);
56struct buffer *http_parse_errorfile(int status, const char *file, char **errmsg);
57struct buffer *http_parse_errorloc(int errloc, int status, const char *url, char **errmsg);
Christopher Faulet76edc0f2020-01-13 15:52:01 +010058int proxy_dup_default_conf_errors(struct proxy *curpx, struct proxy *defpx, char **errmsg);
59void proxy_release_conf_errors(struct proxy *px);
Christopher Faulet5031ef52020-01-15 11:22:07 +010060
Christopher Faulet47596d32018-10-22 09:17:28 +020061#endif /* _PROTO_HTTP_HTX_H */