2006-06-26 00:48:02 +00:00
|
|
|
/*
|
2019-07-16 12:54:53 +00:00
|
|
|
* include/proto/http_ana.h
|
2009-10-04 13:56:38 +00:00
|
|
|
* This file contains HTTP protocol definitions.
|
|
|
|
*
|
2011-01-06 16:51:27 +00:00
|
|
|
* Copyright (C) 2000-2011 Willy Tarreau - w@1wt.eu
|
2009-10-04 13:56:38 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2006-06-26 00:48:02 +00:00
|
|
|
|
|
|
|
#ifndef _PROTO_PROTO_HTTP_H
|
|
|
|
#define _PROTO_PROTO_HTTP_H
|
|
|
|
|
2006-06-29 16:54:54 +00:00
|
|
|
#include <common/config.h>
|
2019-07-16 12:16:10 +00:00
|
|
|
#include <common/htx.h>
|
2019-07-16 12:49:01 +00:00
|
|
|
#include <types/channel.h>
|
2019-07-16 12:54:53 +00:00
|
|
|
#include <types/http_ana.h>
|
REORG/MAJOR: session: rename the "session" entity to "stream"
With HTTP/2, we'll have to support multiplexed streams. A stream is in
fact the largest part of what we currently call a session, it has buffers,
logs, etc.
In order to catch any error, this commit removes any reference to the
struct session and tries to rename most "session" occurrences in function
names to "stream" and "sess" to "strm" when that's related to a session.
The files stream.{c,h} were added and session.{c,h} removed.
The session will be reintroduced later and a few parts of the stream
will progressively be moved overthere. It will more or less contain
only what we need in an embryonic session.
Sample fetch functions and converters will have to change a bit so
that they'll use an L5 (session) instead of what's currently called
"L4" which is in fact L6 for now.
Once all changes are completed, we should see approximately this :
L7 - http_txn
L6 - stream
L5 - session
L4 - connection | applet
There will be at most one http_txn per stream, and a same session will
possibly be referenced by multiple streams. A connection will point to
a session and to a stream. The session will hold all the information
we need to keep even when we don't yet have a stream.
Some more cleanup is needed because some code was already far from
being clean. The server queue management still refers to sessions at
many places while comments talk about connections. This will have to
be cleaned up once we have a server-side connection pool manager.
Stream flags "SN_*" still need to be renamed, it doesn't seem like
any of them will need to move to the session.
2015-04-02 22:22:06 +00:00
|
|
|
#include <types/stream.h>
|
2006-06-26 00:48:02 +00:00
|
|
|
|
2018-10-02 14:01:16 +00:00
|
|
|
extern struct pool_head *pool_head_uniqueid;
|
|
|
|
|
2019-07-16 12:54:53 +00:00
|
|
|
int http_wait_for_request(struct stream *s, struct channel *req, int an_bit);
|
|
|
|
int http_process_req_common(struct stream *s, struct channel *req, int an_bit, struct proxy *px);
|
|
|
|
int http_process_request(struct stream *s, struct channel *req, int an_bit);
|
|
|
|
int http_process_tarpit(struct stream *s, struct channel *req, int an_bit);
|
|
|
|
int http_wait_for_request_body(struct stream *s, struct channel *req, int an_bit);
|
|
|
|
int http_wait_for_response(struct stream *s, struct channel *rep, int an_bit);
|
|
|
|
int http_process_res_common(struct stream *s, struct channel *rep, int an_bit, struct proxy *px);
|
|
|
|
int http_request_forward_body(struct stream *s, struct channel *req, int an_bit);
|
|
|
|
int http_response_forward_body(struct stream *s, struct channel *res, int an_bit);
|
|
|
|
int http_apply_redirect_rule(struct redirect_rule *rule, struct stream *s, struct http_txn *txn);
|
2020-01-22 08:26:35 +00:00
|
|
|
int http_eval_after_res_rules(struct stream *s);
|
2019-12-17 08:20:34 +00:00
|
|
|
int http_replace_hdrs(struct stream* s, struct htx *htx, struct ist name, const char *str, struct my_regex *re, int full);
|
2019-07-16 12:54:53 +00:00
|
|
|
int http_req_replace_stline(int action, const char *replace, int len,
|
|
|
|
struct proxy *px, struct stream *s);
|
2019-12-17 12:46:18 +00:00
|
|
|
int http_res_set_status(unsigned int status, struct ist reason, struct stream *s);
|
2019-07-16 12:54:53 +00:00
|
|
|
void http_check_request_for_cacheability(struct stream *s, struct channel *req);
|
|
|
|
void http_check_response_for_cacheability(struct stream *s, struct channel *res);
|
|
|
|
void http_perform_server_redirect(struct stream *s, struct stream_interface *si);
|
|
|
|
void http_server_error(struct stream *s, struct stream_interface *si, int err, int finst, const struct buffer *msg);
|
2020-01-27 14:32:25 +00:00
|
|
|
void http_reply_and_close(struct stream *s, short status, const struct buffer *msg);
|
2019-07-16 12:54:53 +00:00
|
|
|
void http_return_srv_error(struct stream *s, struct stream_interface *si);
|
|
|
|
struct buffer *http_error_message(struct stream *s);
|
2020-01-28 08:26:19 +00:00
|
|
|
int http_forward_proxy_resp(struct stream *s, int final);
|
2018-10-03 14:38:02 +00:00
|
|
|
|
2015-04-03 21:46:31 +00:00
|
|
|
struct http_txn *http_alloc_txn(struct stream *s);
|
REORG/MAJOR: session: rename the "session" entity to "stream"
With HTTP/2, we'll have to support multiplexed streams. A stream is in
fact the largest part of what we currently call a session, it has buffers,
logs, etc.
In order to catch any error, this commit removes any reference to the
struct session and tries to rename most "session" occurrences in function
names to "stream" and "sess" to "strm" when that's related to a session.
The files stream.{c,h} were added and session.{c,h} removed.
The session will be reintroduced later and a few parts of the stream
will progressively be moved overthere. It will more or less contain
only what we need in an embryonic session.
Sample fetch functions and converters will have to change a bit so
that they'll use an L5 (session) instead of what's currently called
"L4" which is in fact L6 for now.
Once all changes are completed, we should see approximately this :
L7 - http_txn
L6 - stream
L5 - session
L4 - connection | applet
There will be at most one http_txn per stream, and a same session will
possibly be referenced by multiple streams. A connection will point to
a session and to a stream. The session will hold all the information
we need to keep even when we don't yet have a stream.
Some more cleanup is needed because some code was already far from
being clean. The server queue management still refers to sessions at
many places while comments talk about connections. This will have to
be cleaned up once we have a server-side connection pool manager.
Stream flags "SN_*" still need to be renamed, it doesn't seem like
any of them will need to move to the session.
2015-04-02 22:22:06 +00:00
|
|
|
void http_init_txn(struct stream *s);
|
|
|
|
void http_end_txn(struct stream *s);
|
2014-04-17 18:08:17 +00:00
|
|
|
|
2018-12-11 10:04:56 +00:00
|
|
|
/* for debugging, reports the HTTP/1 message state name (legacy version) */
|
|
|
|
static inline const char *h1_msg_state_str(enum h1_state msg_state)
|
|
|
|
{
|
|
|
|
switch (msg_state) {
|
|
|
|
case HTTP_MSG_RQBEFORE: return "MSG_RQBEFORE";
|
|
|
|
case HTTP_MSG_RPBEFORE: return "MSG_RPBEFORE";
|
|
|
|
case HTTP_MSG_ERROR: return "MSG_ERROR";
|
|
|
|
case HTTP_MSG_BODY: return "MSG_BODY";
|
|
|
|
case HTTP_MSG_DATA: return "MSG_DATA";
|
|
|
|
case HTTP_MSG_ENDING: return "MSG_ENDING";
|
|
|
|
case HTTP_MSG_DONE: return "MSG_DONE";
|
|
|
|
case HTTP_MSG_CLOSING: return "MSG_CLOSING";
|
|
|
|
case HTTP_MSG_CLOSED: return "MSG_CLOSED";
|
|
|
|
case HTTP_MSG_TUNNEL: return "MSG_TUNNEL";
|
|
|
|
default: return "MSG_??????";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-26 00:48:02 +00:00
|
|
|
#endif /* _PROTO_PROTO_HTTP_H */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* c-indent-level: 8
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* End:
|
|
|
|
*/
|