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
|
|
|
|
|
|
|
#include "server.h"
|
|
|
|
|
2009-10-11 14:31:42 +00:00
|
|
|
#include <time.h>
|
|
|
|
|
2005-02-20 14:27:00 +00:00
|
|
|
int http_response_parse(server *srv, connection *con);
|
2005-08-15 09:55:23 +00:00
|
|
|
int http_response_write_header(server *srv, connection *con);
|
2005-02-20 14:27:00 +00:00
|
|
|
|
|
|
|
int response_header_insert(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
|
|
|
|
int response_header_overwrite(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
|
2009-09-21 13:15:57 +00:00
|
|
|
int response_header_append(server *srv, connection *con, const char *key, size_t keylen, const char *value, size_t vallen);
|
2005-02-20 14:27:00 +00:00
|
|
|
|
consistent, shared code to create CGI env
consolidated from CGI, FastCGI, SCGI, SSI
Note: due to prior inconsistencies between the code in mod_cgi,
mod_fastcgi, mod_scgi, and mod_ssi, there are some minor behavior
changes.
CONTENT_LENGTH is now always set, even if 0
(though CONTENT_LENGTH is never set for FASTCGI_AUTHORIZER)
PATH_INFO is created only if present, not if empty.
(mod_fastcgi and mod_ssi previously set PATH_INFO="" (blank value))
PATH_TRANSLATED is now set if PATH_INFO is present
(previously missing from mod_cgi and mod_ssi)
mod_ssi now sets DOCUMENT_ROOT to con->physical.basedir, like others
(previously, mod_ssi set DOCUMENT_ROOT to con->physical.doc_root,
which matched con->physical.basedir unless mod_alias changed basedir)
mod_ssi now sets REQUEST_URI to con->request.orig_uri, like others
(previously, mod_ssi set REQUEST_URI to con->request.uri, which
matched con->request.orig_uri except after redirects, error docs)
2016-10-10 17:37:36 +00:00
|
|
|
typedef struct http_cgi_opts_t {
|
|
|
|
int authorizer;
|
|
|
|
int break_scriptfilename_for_php;
|
|
|
|
buffer *docroot;
|
|
|
|
buffer *strip_request_uri;
|
|
|
|
} http_cgi_opts;
|
|
|
|
|
2017-03-18 04:10:48 +00:00
|
|
|
enum {
|
|
|
|
BACKEND_UNSET = 0,
|
|
|
|
BACKEND_PROXY,
|
|
|
|
BACKEND_CGI,
|
|
|
|
BACKEND_FASTCGI,
|
|
|
|
BACKEND_SCGI
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct http_response_opts_t {
|
|
|
|
int backend;
|
|
|
|
int authorizer;
|
|
|
|
unsigned short local_redir;
|
|
|
|
unsigned short xsendfile_allow;
|
|
|
|
array *xsendfile_docroot;
|
|
|
|
} http_response_opts;
|
|
|
|
|
consistent, shared code to create CGI env
consolidated from CGI, FastCGI, SCGI, SSI
Note: due to prior inconsistencies between the code in mod_cgi,
mod_fastcgi, mod_scgi, and mod_ssi, there are some minor behavior
changes.
CONTENT_LENGTH is now always set, even if 0
(though CONTENT_LENGTH is never set for FASTCGI_AUTHORIZER)
PATH_INFO is created only if present, not if empty.
(mod_fastcgi and mod_ssi previously set PATH_INFO="" (blank value))
PATH_TRANSLATED is now set if PATH_INFO is present
(previously missing from mod_cgi and mod_ssi)
mod_ssi now sets DOCUMENT_ROOT to con->physical.basedir, like others
(previously, mod_ssi set DOCUMENT_ROOT to con->physical.doc_root,
which matched con->physical.basedir unless mod_alias changed basedir)
mod_ssi now sets REQUEST_URI to con->request.orig_uri, like others
(previously, mod_ssi set REQUEST_URI to con->request.uri, which
matched con->request.orig_uri except after redirects, error docs)
2016-10-10 17:37:36 +00:00
|
|
|
typedef int (*http_cgi_header_append_cb)(void *vdata, const char *k, size_t klen, const char *v, size_t vlen);
|
|
|
|
int http_cgi_headers(server *srv, connection *con, http_cgi_opts *opts, http_cgi_header_append_cb cb, void *vdata);
|
|
|
|
|
2017-03-18 04:10:48 +00:00
|
|
|
handler_t http_response_parse_headers(server *srv, connection *con, http_response_opts *opts, buffer *hdrs);
|
|
|
|
handler_t http_response_read(server *srv, connection *con, http_response_opts *opts, buffer *b, int fd, int *fde_ndx);
|
2005-02-20 14:27:00 +00:00
|
|
|
handler_t http_response_prepare(server *srv, connection *con);
|
|
|
|
int http_response_redirect_to_directory(server *srv, connection *con);
|
2005-08-31 13:39:09 +00:00
|
|
|
int http_response_handle_cachable(server *srv, connection *con, buffer * mtime);
|
2016-04-21 21:33:16 +00:00
|
|
|
void http_response_send_file (server *srv, connection *con, buffer *path);
|
2016-05-27 04:24:33 +00:00
|
|
|
void http_response_backend_done (server *srv, connection *con);
|
2016-06-19 00:39:00 +00:00
|
|
|
void http_response_backend_error (server *srv, connection *con);
|
2005-02-20 14:27:00 +00:00
|
|
|
|
2005-08-18 12:00:40 +00:00
|
|
|
buffer * strftime_cache_get(server *srv, time_t last_mod);
|
2005-02-20 14:27:00 +00:00
|
|
|
#endif
|