Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 1 | /* |
| 2 | * include/proto/http_ana.h |
| 3 | * This file contains HTTP protocol definitions. |
| 4 | * |
| 5 | * Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu |
| 6 | * |
| 7 | * This library is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU Lesser General Public |
| 9 | * License as published by the Free Software Foundation, version 2.1 |
| 10 | * exclusively. |
| 11 | * |
| 12 | * This library is distributed in the hope that it will be useful, |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * Lesser General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU Lesser General Public |
| 18 | * License along with this library; if not, write to the Free Software |
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 | */ |
| 21 | |
| 22 | #ifndef _PROTO_PROTO_HTTP_H |
| 23 | #define _PROTO_PROTO_HTTP_H |
| 24 | |
Willy Tarreau | 4c7e4b7 | 2020-05-27 12:58:42 +0200 | [diff] [blame] | 25 | #include <haproxy/api.h> |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 26 | #include <common/htx.h> |
| 27 | #include <types/channel.h> |
| 28 | #include <types/http_ana.h> |
| 29 | #include <types/stream.h> |
| 30 | |
| 31 | extern struct pool_head *pool_head_uniqueid; |
| 32 | |
| 33 | int http_wait_for_request(struct stream *s, struct channel *req, int an_bit); |
| 34 | int http_process_req_common(struct stream *s, struct channel *req, int an_bit, struct proxy *px); |
| 35 | int http_process_request(struct stream *s, struct channel *req, int an_bit); |
| 36 | int http_process_tarpit(struct stream *s, struct channel *req, int an_bit); |
| 37 | int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit); |
| 38 | int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit); |
| 39 | int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px); |
| 40 | int http_request_forward_body(struct stream *s, struct channel *req, int an_bit); |
| 41 | int http_response_forward_body(struct stream *s, struct channel *res, int an_bit); |
| 42 | int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn); |
Christopher Faulet | 6d0c3df | 2020-01-22 09:26:35 +0100 | [diff] [blame] | 43 | int http_eval_after_res_rules(struct stream *s); |
Christopher Faulet | 92d34fe | 2019-12-17 09:20:34 +0100 | [diff] [blame] | 44 | int http_replace_hdrs(struct stream* s, struct htx *htx, struct ist name, const char *str, struct my_regex *re, int full); |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 45 | int http_req_replace_stline(int action, const char *replace, int len, |
| 46 | struct proxy *px, struct stream *s); |
Christopher Faulet | 96bff76 | 2019-12-17 13:46:18 +0100 | [diff] [blame] | 47 | int http_res_set_status(unsigned int status, struct ist reason, struct stream *s); |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 48 | void http_check_request_for_cacheability(struct stream *s, struct channel *req); |
| 49 | void http_check_response_for_cacheability(struct stream *s, struct channel *res); |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 50 | void http_perform_server_redirect(struct stream *s, struct stream_interface *si); |
Christopher Faulet | 8dfeccf | 2020-05-15 14:16:29 +0200 | [diff] [blame] | 51 | void http_server_error(struct stream *s, struct stream_interface *si, int err, int finst, struct http_reply *msg); |
| 52 | void http_reply_and_close(struct stream *s, short status, struct http_reply *msg); |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 53 | void http_return_srv_error(struct stream *s, struct stream_interface *si); |
Christopher Faulet | 8dfeccf | 2020-05-15 14:16:29 +0200 | [diff] [blame] | 54 | struct http_reply *http_error_message(struct stream *s); |
Christopher Faulet | ae43b6c | 2020-05-27 15:24:22 +0200 | [diff] [blame] | 55 | int http_reply_to_htx(struct stream *s, struct htx *htx, struct http_reply *reply); |
Christopher Faulet | 0e2ad61 | 2020-05-13 16:38:37 +0200 | [diff] [blame] | 56 | int http_reply_message(struct stream *s, struct http_reply *reply); |
Christopher Faulet | ef70e25 | 2020-01-28 09:26:19 +0100 | [diff] [blame] | 57 | int http_forward_proxy_resp(struct stream *s, int final); |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 58 | |
| 59 | struct http_txn *http_alloc_txn(struct stream *s); |
| 60 | void http_init_txn(struct stream *s); |
| 61 | void http_end_txn(struct stream *s); |
Christopher Faulet | fc9cfe4 | 2019-07-16 14:54:53 +0200 | [diff] [blame] | 62 | |
| 63 | /* for debugging, reports the HTTP/1 message state name (legacy version) */ |
| 64 | static inline const char *h1_msg_state_str(enum h1_state msg_state) |
| 65 | { |
| 66 | switch (msg_state) { |
| 67 | case HTTP_MSG_RQBEFORE: return "MSG_RQBEFORE"; |
| 68 | case HTTP_MSG_RPBEFORE: return "MSG_RPBEFORE"; |
| 69 | case HTTP_MSG_ERROR: return "MSG_ERROR"; |
| 70 | case HTTP_MSG_BODY: return "MSG_BODY"; |
| 71 | case HTTP_MSG_DATA: return "MSG_DATA"; |
| 72 | case HTTP_MSG_ENDING: return "MSG_ENDING"; |
| 73 | case HTTP_MSG_DONE: return "MSG_DONE"; |
| 74 | case HTTP_MSG_CLOSING: return "MSG_CLOSING"; |
| 75 | case HTTP_MSG_CLOSED: return "MSG_CLOSED"; |
| 76 | case HTTP_MSG_TUNNEL: return "MSG_TUNNEL"; |
| 77 | default: return "MSG_??????"; |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | #endif /* _PROTO_PROTO_HTTP_H */ |
| 82 | |
| 83 | /* |
| 84 | * Local variables: |
| 85 | * c-indent-level: 8 |
| 86 | * c-basic-offset: 8 |
| 87 | * End: |
| 88 | */ |