2005-02-20 14:27:00 +00:00
|
|
|
#ifndef _RESPONSE_H_
|
|
|
|
#define _RESPONSE_H_
|
2016-03-19 15:14:35 +00:00
|
|
|
#include "first.h"
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2021-04-28 17:18:37 +00:00
|
|
|
#include "sys-time.h"
|
|
|
|
|
2018-03-25 07:45:05 +00:00
|
|
|
#include "base_decls.h"
|
|
|
|
#include "buffer.h"
|
|
|
|
#include "array.h"
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2021-05-04 02:18:20 +00:00
|
|
|
struct stat_cache_entry;/* declaration */
|
2021-10-21 13:45:06 +00:00
|
|
|
struct chunkqueue; /* declaration */
|
2021-05-04 02:18:20 +00:00
|
|
|
|
2020-01-13 02:51:12 +00:00
|
|
|
int http_response_parse(server *srv, request_st *r);
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2017-03-18 04:10:48 +00:00
|
|
|
enum {
|
2021-01-24 05:02:58 +00:00
|
|
|
BACKEND_PROXY = 0
|
|
|
|
,BACKEND_CGI
|
|
|
|
,BACKEND_FASTCGI
|
|
|
|
,BACKEND_SCGI
|
|
|
|
,BACKEND_AJP13
|
2017-03-18 04:10:48 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct http_response_opts_t {
|
2021-09-17 15:49:55 +00:00
|
|
|
uint32_t max_per_read;
|
2017-03-28 05:57:16 +00:00
|
|
|
int fdfmt;
|
2017-03-18 04:10:48 +00:00
|
|
|
int backend;
|
2021-09-25 19:10:35 +00:00
|
|
|
int authorizer; /* bool *//*(maybe overloaded w/ response streaming flags)*/
|
2021-07-24 16:09:32 +00:00
|
|
|
uint8_t simple_accum; /* bool */
|
|
|
|
uint8_t local_redir; /* 0,1,2 */
|
|
|
|
uint8_t xsendfile_allow; /* bool */
|
2019-11-07 05:15:17 +00:00
|
|
|
const array *xsendfile_docroot;
|
2017-05-06 03:57:55 +00:00
|
|
|
void *pdata;
|
2020-01-13 02:51:12 +00:00
|
|
|
handler_t(*parse)(request_st *, struct http_response_opts_t *, buffer *, size_t);
|
|
|
|
handler_t(*headers)(request_st *, struct http_response_opts_t *);
|
2017-03-18 04:10:48 +00:00
|
|
|
} http_response_opts;
|
|
|
|
|
2020-09-17 23:29:59 +00:00
|
|
|
typedef int (*http_response_send_1xx_cb)(request_st *r, connection *con);
|
|
|
|
__attribute_cold__
|
|
|
|
void http_response_send_1xx_cb_set (http_response_send_1xx_cb fn, int vers);
|
|
|
|
int http_response_send_1xx (request_st *r);
|
|
|
|
|
2020-01-13 02:51:12 +00:00
|
|
|
handler_t http_response_parse_headers(request_st *r, http_response_opts *opts, buffer *hdrs);
|
|
|
|
handler_t http_response_read(request_st *r, http_response_opts *opts, buffer *b, fdnode *fdn);
|
2020-01-21 02:05:56 +00:00
|
|
|
|
2020-08-11 05:10:57 +00:00
|
|
|
__attribute_cold__
|
|
|
|
handler_t http_response_reqbody_read_error(request_st *r, int http_status);
|
|
|
|
|
2020-11-10 11:10:27 +00:00
|
|
|
int http_response_buffer_append_authority(request_st *r, buffer *o);
|
2020-01-13 02:51:12 +00:00
|
|
|
int http_response_redirect_to_directory(request_st *r, int status);
|
2021-07-12 18:46:49 +00:00
|
|
|
const buffer * http_response_set_last_modified(request_st *r, unix_time64_t lmtime);
|
|
|
|
int http_response_handle_cachable(request_st *r, const buffer *lmod, unix_time64_t lmtime);
|
2020-01-13 02:51:12 +00:00
|
|
|
void http_response_body_clear(request_st *r, int preserve_length);
|
2020-08-11 05:10:57 +00:00
|
|
|
void http_response_reset(request_st *r);
|
2021-05-04 02:18:20 +00:00
|
|
|
void http_response_send_file (request_st *r, buffer *path, struct stat_cache_entry *sce);
|
2020-01-13 02:51:12 +00:00
|
|
|
void http_response_backend_done (request_st *r);
|
|
|
|
void http_response_backend_error (request_st *r);
|
|
|
|
void http_response_upgrade_read_body_unknown(request_st *r);
|
2021-10-21 13:45:06 +00:00
|
|
|
int http_response_transfer_cqlen(request_st *r, struct chunkqueue *cq, size_t len);
|
2020-08-25 10:34:47 +00:00
|
|
|
|
|
|
|
__attribute_cold__
|
|
|
|
int http_response_omit_header(request_st *r, const data_string *ds);
|
|
|
|
|
2020-08-13 02:38:59 +00:00
|
|
|
void http_response_write_header(request_st *r);
|
|
|
|
handler_t http_response_handler(request_st *r);
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2019-12-10 04:57:53 +00:00
|
|
|
__attribute_cold__
|
|
|
|
void strftime_cache_reset(void);
|
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
#endif
|