2018-10-22 07:17:28 +00:00
|
|
|
/*
|
|
|
|
* include/types/http_htx.h
|
|
|
|
* This file defines function prototypes for HTTP manipulation using the
|
|
|
|
* internal representation.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 HAProxy Technologies, Christopher Faulet <cfaulet@haproxy.com>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation, version 2.1
|
|
|
|
* exclusively.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _PROTO_HTTP_HTX_H
|
|
|
|
#define _PROTO_HTTP_HTX_H
|
|
|
|
|
2020-05-27 15:22:10 +00:00
|
|
|
#include <haproxy/buf.h>
|
2020-05-27 14:21:26 +00:00
|
|
|
#include <import/ist.h>
|
2020-05-05 05:42:42 +00:00
|
|
|
#include <common/regex.h>
|
2018-10-22 07:17:28 +00:00
|
|
|
|
|
|
|
#include <types/http_htx.h>
|
|
|
|
|
2019-07-17 20:02:08 +00:00
|
|
|
extern struct buffer http_err_chunks[HTTP_ERR_SIZE];
|
2020-05-14 07:54:26 +00:00
|
|
|
extern struct http_reply http_err_replies[HTTP_ERR_SIZE];
|
2020-01-14 11:00:28 +00:00
|
|
|
extern struct list http_errors_list;
|
2018-11-29 15:48:49 +00:00
|
|
|
|
2019-05-13 12:41:27 +00:00
|
|
|
struct htx_sl *http_get_stline(struct htx *htx);
|
2020-02-07 15:39:41 +00:00
|
|
|
size_t http_get_hdrs_size(struct htx *htx);
|
2018-10-22 07:17:28 +00:00
|
|
|
int http_find_header(const struct htx *htx, const struct ist name, struct http_hdr_ctx *ctx, int full);
|
2020-05-05 05:42:42 +00:00
|
|
|
int http_find_str_header(const struct htx *htx, const struct ist name, struct http_hdr_ctx *ctx, int full);
|
|
|
|
int http_find_pfx_header(const struct htx *htx, const struct ist prefix, struct http_hdr_ctx *ctx, int full);
|
|
|
|
int http_find_sfx_header(const struct htx *htx, const struct ist suffix, struct http_hdr_ctx *ctx, int full);
|
|
|
|
int http_find_sub_header(const struct htx *htx, const struct ist sub, struct http_hdr_ctx *ctx, int full);
|
|
|
|
int http_match_header(const struct htx *htx, const struct my_regex *re, struct http_hdr_ctx *ctx, int full);
|
2018-10-22 07:17:28 +00:00
|
|
|
int http_add_header(struct htx *htx, const struct ist n, const struct ist v);
|
2018-11-26 20:37:08 +00:00
|
|
|
int http_replace_stline(struct htx *htx, const struct ist p1, const struct ist p2, const struct ist p3);
|
2018-10-24 08:36:45 +00:00
|
|
|
int http_replace_req_meth(struct htx *htx, const struct ist meth);
|
|
|
|
int http_replace_req_uri(struct htx *htx, const struct ist uri);
|
|
|
|
int http_replace_req_path(struct htx *htx, const struct ist path);
|
|
|
|
int http_replace_req_query(struct htx *htx, const struct ist query);
|
|
|
|
int http_replace_res_status(struct htx *htx, const struct ist status);
|
|
|
|
int http_replace_res_reason(struct htx *htx, const struct ist reason);
|
2018-10-22 07:17:28 +00:00
|
|
|
int http_replace_header_value(struct htx *htx, struct http_hdr_ctx *ctx, const struct ist data);
|
|
|
|
int http_replace_header(struct htx *htx, struct http_hdr_ctx *ctx, const struct ist name, const struct ist value);
|
|
|
|
int http_remove_header(struct htx *htx, struct http_hdr_ctx *ctx);
|
2020-04-28 17:57:29 +00:00
|
|
|
int http_update_authority(struct htx *htx, struct htx_sl *sl, const struct ist host);
|
|
|
|
int http_update_host(struct htx *htx, struct htx_sl *sl, const struct ist uri);
|
|
|
|
|
2018-10-24 08:39:35 +00:00
|
|
|
unsigned int http_get_htx_hdr(const struct htx *htx, const struct ist hdr,
|
|
|
|
int occ, struct http_hdr_ctx *ctx, char **vptr, size_t *vlen);
|
|
|
|
unsigned int http_get_htx_fhdr(const struct htx *htx, const struct ist hdr,
|
|
|
|
int occ, struct http_hdr_ctx *ctx, char **vptr, size_t *vlen);
|
2019-07-22 14:49:30 +00:00
|
|
|
int http_str_to_htx(struct buffer *buf, struct ist raw);
|
2018-10-22 07:17:28 +00:00
|
|
|
|
2020-05-12 16:57:28 +00:00
|
|
|
void release_http_reply(struct http_reply *http_reply);
|
2020-05-13 13:02:59 +00:00
|
|
|
int http_check_http_reply(struct http_reply *reply, struct proxy*px, char **errmsg);
|
2020-05-13 12:36:55 +00:00
|
|
|
struct http_reply *http_parse_http_reply(const char **args, int *orig_arg, struct proxy *px,
|
|
|
|
int default_status, char **errmsg);
|
2020-05-12 16:57:28 +00:00
|
|
|
|
2020-01-15 14:19:50 +00:00
|
|
|
struct buffer *http_load_errorfile(const char *file, char **errmsg);
|
|
|
|
struct buffer *http_load_errormsg(const char *key, const struct ist msg, char **errmsg);
|
|
|
|
struct buffer *http_parse_errorfile(int status, const char *file, char **errmsg);
|
|
|
|
struct buffer *http_parse_errorloc(int errloc, int status, const char *url, char **errmsg);
|
2020-01-13 14:52:01 +00:00
|
|
|
int proxy_dup_default_conf_errors(struct proxy *curpx, struct proxy *defpx, char **errmsg);
|
|
|
|
void proxy_release_conf_errors(struct proxy *px);
|
2020-01-15 10:22:07 +00:00
|
|
|
|
2018-10-22 07:17:28 +00:00
|
|
|
#endif /* _PROTO_HTTP_HTX_H */
|