[core] export http_request_host_policy() for reuse

personal/stbuehler/mod-csrf
Glenn Strauss 6 years ago
parent 162e754d0d
commit 1104afc49b

@ -329,6 +329,13 @@ int http_request_host_normalize(buffer *b) {
return 0;
}
int http_request_host_policy (connection *con, buffer *b) {
return (((con->conf.http_parseopts & HTTP_PARSEOPT_HOST_STRICT)
&& 0 != request_check_hostname(b))
|| ((con->conf.http_parseopts & HTTP_PARSEOPT_HOST_NORMALIZE)
&& 0 != http_request_host_normalize(b)));
}
#if 0
#define DUMP_HEADER
#endif
@ -1176,10 +1183,7 @@ int http_request_parse(server *srv, connection *con) {
/* check hostname field if it is set */
if (!buffer_is_empty(con->request.http_host) &&
(((con->conf.http_parseopts & HTTP_PARSEOPT_HOST_STRICT) &&
0 != request_check_hostname(con->request.http_host))
|| ((con->conf.http_parseopts & HTTP_PARSEOPT_HOST_NORMALIZE) &&
0 != http_request_host_normalize(con->request.http_host)))) {
0 != http_request_host_policy(con, con->request.http_host)) {
if (srv->srvconf.log_request_header_on_error) {
log_error_write(srv, __FILE__, __LINE__, "s",

@ -13,5 +13,6 @@ typedef enum {
int http_request_parse(server *srv, connection *con);
int http_request_header_finished(server *srv, connection *con);
int http_request_host_normalize(buffer *b);
int http_request_host_policy(connection *con, buffer *b);
#endif

Loading…
Cancel
Save