[core] http_kv.[ch] method, status, version str

move method, status, version strings from keyvalue.[ch] to http_kv.[ch]
personal/stbuehler/fix-fdevent
Glenn Strauss 2018-04-21 20:21:54 -04:00
parent 1b62dc325c
commit c56b21084e
17 changed files with 258 additions and 253 deletions

View File

@ -554,7 +554,7 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
set(COMMON_SRC
base64.c buffer.c log.c
keyvalue.c chunk.c
http_kv.c keyvalue.c chunk.c
http_chunk.c stream.c fdevent.c gw_backend.c
stat_cache.c plugin.c joblist.c etag.c array.c
data_string.c data_array.c
@ -664,7 +664,7 @@ add_executable(test_configfile
array.c
data_config.c
data_string.c
keyvalue.c
http_kv.c
vector.c
log.c
sock_addr.c
@ -677,7 +677,7 @@ add_executable(test_request
buffer.c
array.c
data_string.c
keyvalue.c
http_kv.c
log.c
sock_addr.c
)
@ -694,8 +694,6 @@ if(HAVE_PCRE_H)
add_target_properties(mod_redirect COMPILE_FLAGS ${PCRE_CFLAGS})
target_link_libraries(test_configfile ${PCRE_LDFLAGS})
add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS})
target_link_libraries(test_request ${PCRE_LDFLAGS})
add_target_properties(test_request COMPILE_FLAGS ${PCRE_CFLAGS})
endif()
if(WITH_PCRE AND (WITH_MEMCACHED OR WITH_GDBM))
@ -878,8 +876,8 @@ if(WITH_LIBUNWIND)
add_target_properties(test_base64 COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
target_link_libraries(test_configfile ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
add_target_properties(test_configfile COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
target_link_libraries(test_request ${PCRE_LDFLAGS} ${LIBUNWIND_LDFLAGS})
add_target_properties(test_request COMPILE_FLAGS ${PCRE_CFLAGS} ${LIBUNWIND_CFLAGS})
target_link_libraries(test_request ${LIBUNWIND_LDFLAGS})
add_target_properties(test_request COMPILE_FLAGS ${LIBUNWIND_CFLAGS})
endif()
if(NOT WIN32)

View File

@ -57,7 +57,7 @@ MAINTAINERCLEANFILES = configparser.c configparser.h mod_ssi_exprparser.c mod_ss
CLEANFILES = versionstamp.h versionstamp.h.tmp lemon$(BUILD_EXEEXT)
common_src=base64.c buffer.c log.c \
keyvalue.c chunk.c \
http_kv.c keyvalue.c chunk.c \
http_chunk.c stream.c fdevent.c gw_backend.c \
stat_cache.c plugin.c joblist.c etag.c array.c \
data_string.c data_array.c \
@ -384,7 +384,7 @@ mod_wstunnel_la_LDFLAGS = $(common_module_ldflags)
mod_wstunnel_la_LIBADD = $(common_libadd) $(CRYPTO_LIB)
hdr = server.h base64.h buffer.h network.h log.h keyvalue.h \
hdr = server.h base64.h buffer.h network.h log.h http_kv.h keyvalue.h \
response.h request.h fastcgi.h chunk.h \
first.h settings.h http_chunk.h \
algo_sha1.h md5.h http_auth.h http_vhostdb.h stream.h \
@ -521,11 +521,11 @@ test_buffer_LDADD = $(LIBUNWIND_LIBS)
test_base64_SOURCES = test_base64.c base64.c buffer.c
test_base64_LDADD = $(LIBUNWIND_LIBS)
test_configfile_SOURCES = test_configfile.c buffer.c array.c data_config.c data_string.c keyvalue.c vector.c log.c sock_addr.c
test_configfile_SOURCES = test_configfile.c buffer.c array.c data_config.c data_string.c http_kv.c vector.c log.c sock_addr.c
test_configfile_LDADD = $(PCRE_LIB) $(LIBUNWIND_LIBS)
test_request_SOURCES = test_request.c request.c buffer.c array.c data_string.c keyvalue.c log.c sock_addr.c
test_request_LDADD = $(PCRE_LIB) $(LIBUNWIND_LIBS)
test_request_SOURCES = test_request.c request.c buffer.c array.c data_string.c http_kv.c log.c sock_addr.c
test_request_LDADD = $(LIBUNWIND_LIBS)
noinst_HEADERS = $(hdr)
EXTRA_DIST = \

View File

@ -56,7 +56,7 @@ def GatherLibs(env, *libs):
return WorkaroundFreeBSDLibOrder(libs)
common_src = Split("base64.c buffer.c log.c \
keyvalue.c chunk.c \
http_kv.c keyvalue.c chunk.c \
http_chunk.c stream.c fdevent.c gw_backend.c \
stat_cache.c plugin.c joblist.c etag.c array.c \
data_string.c data_array.c \

View File

@ -11,7 +11,7 @@
#include "buffer.h"
#include "array.h"
#include "chunk.h"
#include "keyvalue.h"
#include "http_kv.h"
#include "sock_addr.h"
#include "etag.h"

View File

@ -1059,7 +1059,6 @@ static void gw_restart_dead_procs(server *srv, gw_host *host, int debug) {
#include "base.h"
#include "connections.h"
#include "joblist.h"
#include "keyvalue.h"
#include "response.h"

170
src/http_kv.c Normal file
View File

@ -0,0 +1,170 @@
#include "first.h"
#include "http_kv.h"
#include <string.h>
typedef struct {
int key;
const char *value;
} keyvalue;
static const keyvalue http_versions[] = {
{ HTTP_VERSION_1_1, "HTTP/1.1" },
{ HTTP_VERSION_1_0, "HTTP/1.0" },
{ HTTP_VERSION_UNSET, NULL }
};
static const keyvalue http_methods[] = {
{ HTTP_METHOD_GET, "GET" },
{ HTTP_METHOD_HEAD, "HEAD" },
{ HTTP_METHOD_POST, "POST" },
{ HTTP_METHOD_PUT, "PUT" },
{ HTTP_METHOD_DELETE, "DELETE" },
{ HTTP_METHOD_CONNECT, "CONNECT" },
{ HTTP_METHOD_OPTIONS, "OPTIONS" },
{ HTTP_METHOD_TRACE, "TRACE" },
{ HTTP_METHOD_ACL, "ACL" },
{ HTTP_METHOD_BASELINE_CONTROL, "BASELINE-CONTROL" },
{ HTTP_METHOD_BIND, "BIND" },
{ HTTP_METHOD_CHECKIN, "CHECKIN" },
{ HTTP_METHOD_CHECKOUT, "CHECKOUT" },
{ HTTP_METHOD_COPY, "COPY" },
{ HTTP_METHOD_LABEL, "LABEL" },
{ HTTP_METHOD_LINK, "LINK" },
{ HTTP_METHOD_LOCK, "LOCK" },
{ HTTP_METHOD_MERGE, "MERGE" },
{ HTTP_METHOD_MKACTIVITY, "MKACTIVITY" },
{ HTTP_METHOD_MKCALENDAR, "MKCALENDAR" },
{ HTTP_METHOD_MKCOL, "MKCOL" },
{ HTTP_METHOD_MKREDIRECTREF, "MKREDIRECTREF" },
{ HTTP_METHOD_MKWORKSPACE, "MKWORKSPACE" },
{ HTTP_METHOD_MOVE, "MOVE" },
{ HTTP_METHOD_ORDERPATCH, "ORDERPATCH" },
{ HTTP_METHOD_PATCH, "PATCH" },
{ HTTP_METHOD_PROPFIND, "PROPFIND" },
{ HTTP_METHOD_PROPPATCH, "PROPPATCH" },
{ HTTP_METHOD_REBIND, "REBIND" },
{ HTTP_METHOD_REPORT, "REPORT" },
{ HTTP_METHOD_SEARCH, "SEARCH" },
{ HTTP_METHOD_UNBIND, "UNBIND" },
{ HTTP_METHOD_UNCHECKOUT, "UNCHECKOUT" },
{ HTTP_METHOD_UNLINK, "UNLINK" },
{ HTTP_METHOD_UNLOCK, "UNLOCK" },
{ HTTP_METHOD_UPDATE, "UPDATE" },
{ HTTP_METHOD_UPDATEREDIRECTREF, "UPDATEREDIRECTREF" },
{ HTTP_METHOD_VERSION_CONTROL, "VERSION-CONTROL" },
{ HTTP_METHOD_UNSET, NULL }
};
static const keyvalue http_status[] = {
{ 100, "Continue" },
{ 101, "Switching Protocols" },
{ 102, "Processing" }, /* WebDAV */
{ 200, "OK" },
{ 201, "Created" },
{ 202, "Accepted" },
{ 203, "Non-Authoritative Information" },
{ 204, "No Content" },
{ 205, "Reset Content" },
{ 206, "Partial Content" },
{ 207, "Multi-status" }, /* WebDAV */
{ 300, "Multiple Choices" },
{ 301, "Moved Permanently" },
{ 302, "Found" },
{ 303, "See Other" },
{ 304, "Not Modified" },
{ 305, "Use Proxy" },
{ 306, "(Unused)" },
{ 307, "Temporary Redirect" },
{ 308, "Permanent Redirect" },
{ 400, "Bad Request" },
{ 401, "Unauthorized" },
{ 402, "Payment Required" },
{ 403, "Forbidden" },
{ 404, "Not Found" },
{ 405, "Method Not Allowed" },
{ 406, "Not Acceptable" },
{ 407, "Proxy Authentication Required" },
{ 408, "Request Timeout" },
{ 409, "Conflict" },
{ 410, "Gone" },
{ 411, "Length Required" },
{ 412, "Precondition Failed" },
{ 413, "Request Entity Too Large" },
{ 414, "Request-URI Too Long" },
{ 415, "Unsupported Media Type" },
{ 416, "Requested Range Not Satisfiable" },
{ 417, "Expectation Failed" },
{ 422, "Unprocessable Entity" }, /* WebDAV */
{ 423, "Locked" }, /* WebDAV */
{ 424, "Failed Dependency" }, /* WebDAV */
{ 426, "Upgrade Required" }, /* TLS */
{ 500, "Internal Server Error" },
{ 501, "Not Implemented" },
{ 502, "Bad Gateway" },
{ 503, "Service Not Available" },
{ 504, "Gateway Timeout" },
{ 505, "HTTP Version Not Supported" },
{ 507, "Insufficient Storage" }, /* WebDAV */
{ -1, NULL }
};
static const keyvalue http_status_body[] = {
{ 400, "400.html" },
{ 401, "401.html" },
{ 403, "403.html" },
{ 404, "404.html" },
{ 411, "411.html" },
{ 416, "416.html" },
{ 500, "500.html" },
{ 501, "501.html" },
{ 503, "503.html" },
{ 505, "505.html" },
{ -1, NULL }
};
static const char *keyvalue_get_value(const keyvalue *kv, int k) {
int i;
for (i = 0; kv[i].value; i++) {
if (kv[i].key == k) return kv[i].value;
}
return NULL;
}
static int keyvalue_get_key(const keyvalue *kv, const char *s) {
int i;
for (i = 0; kv[i].value; i++) {
if (0 == strcmp(kv[i].value, s)) return kv[i].key;
}
return -1;
}
const char *get_http_version_name(int i) {
return keyvalue_get_value(http_versions, i);
}
const char *get_http_status_name(int i) {
return keyvalue_get_value(http_status, i);
}
const char *get_http_method_name(http_method_t i) {
return keyvalue_get_value(http_methods, i);
}
const char *get_http_status_body_name(int i) {
return keyvalue_get_value(http_status_body, i);
}
int get_http_version_key(const char *s) {
return keyvalue_get_key(http_versions, s);
}
http_method_t get_http_method_key(const char *s) {
return (http_method_t)keyvalue_get_key(http_methods, s);
}

66
src/http_kv.h Normal file
View File

@ -0,0 +1,66 @@
#ifndef INCLUDED_HTTP_KV_H
#define INCLUDED_HTTP_KV_H
#include "first.h"
/* sources:
* - [RFC2616], Section 9
* (or http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22)
* - http://tools.ietf.org/html/draft-ietf-httpbis-method-registrations-11, Appendix A
*
* http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22, Section 8.1 defines
* a new registry (not available yet):
* http://www.iana.org/assignments/http-methods
*/
typedef enum {
HTTP_METHOD_UNSET = -1,
HTTP_METHOD_GET, /* [RFC2616], Section 9.3 */
HTTP_METHOD_HEAD, /* [RFC2616], Section 9.4 */
HTTP_METHOD_POST, /* [RFC2616], Section 9.5 */
HTTP_METHOD_PUT, /* [RFC2616], Section 9.6 */
HTTP_METHOD_DELETE, /* [RFC2616], Section 9.7 */
HTTP_METHOD_CONNECT, /* [RFC2616], Section 9.9 */
HTTP_METHOD_OPTIONS, /* [RFC2616], Section 9.2 */
HTTP_METHOD_TRACE, /* [RFC2616], Section 9.8 */
HTTP_METHOD_ACL, /* [RFC3744], Section 8.1 */
HTTP_METHOD_BASELINE_CONTROL, /* [RFC3253], Section 12.6 */
HTTP_METHOD_BIND, /* [RFC5842], Section 4 */
HTTP_METHOD_CHECKIN, /* [RFC3253], Section 4.4 and [RFC3253], Section 9.4 */
HTTP_METHOD_CHECKOUT, /* [RFC3253], Section 4.3 and [RFC3253], Section 8.8 */
HTTP_METHOD_COPY, /* [RFC4918], Section 9.8 */
HTTP_METHOD_LABEL, /* [RFC3253], Section 8.2 */
HTTP_METHOD_LINK, /* [RFC2068], Section 19.6.1.2 */
HTTP_METHOD_LOCK, /* [RFC4918], Section 9.10 */
HTTP_METHOD_MERGE, /* [RFC3253], Section 11.2 */
HTTP_METHOD_MKACTIVITY, /* [RFC3253], Section 13.5 */
HTTP_METHOD_MKCALENDAR, /* [RFC4791], Section 5.3.1 */
HTTP_METHOD_MKCOL, /* [RFC4918], Section 9.3 */
HTTP_METHOD_MKREDIRECTREF, /* [RFC4437], Section 6 */
HTTP_METHOD_MKWORKSPACE, /* [RFC3253], Section 6.3 */
HTTP_METHOD_MOVE, /* [RFC4918], Section 9.9 */
HTTP_METHOD_ORDERPATCH, /* [RFC3648], Section 7 */
HTTP_METHOD_PATCH, /* [RFC5789], Section 2 */
HTTP_METHOD_PROPFIND, /* [RFC4918], Section 9.1 */
HTTP_METHOD_PROPPATCH, /* [RFC4918], Section 9.2 */
HTTP_METHOD_REBIND, /* [RFC5842], Section 6 */
HTTP_METHOD_REPORT, /* [RFC3253], Section 3.6 */
HTTP_METHOD_SEARCH, /* [RFC5323], Section 2 */
HTTP_METHOD_UNBIND, /* [RFC5842], Section 5 */
HTTP_METHOD_UNCHECKOUT, /* [RFC3253], Section 4.5 */
HTTP_METHOD_UNLINK, /* [RFC2068], Section 19.6.1.3 */
HTTP_METHOD_UNLOCK, /* [RFC4918], Section 9.11 */
HTTP_METHOD_UPDATE, /* [RFC3253], Section 7.1 */
HTTP_METHOD_UPDATEREDIRECTREF, /* [RFC4437], Section 7 */
HTTP_METHOD_VERSION_CONTROL /* [RFC3253], Section 3.5 */
} http_method_t;
typedef enum { HTTP_VERSION_UNSET = -1, HTTP_VERSION_1_0, HTTP_VERSION_1_1 } http_version_t;
const char *get_http_status_name(int i);
const char *get_http_version_name(int i);
const char *get_http_method_name(http_method_t i);
const char *get_http_status_body_name(int i);
int get_http_version_key(const char *s);
http_method_t get_http_method_key(const char *s);
#endif

View File

@ -7,169 +7,6 @@
#include <stdlib.h>
#include <string.h>
static const keyvalue http_versions[] = {
{ HTTP_VERSION_1_1, "HTTP/1.1" },
{ HTTP_VERSION_1_0, "HTTP/1.0" },
{ HTTP_VERSION_UNSET, NULL }
};
static const keyvalue http_methods[] = {
{ HTTP_METHOD_GET, "GET" },
{ HTTP_METHOD_HEAD, "HEAD" },
{ HTTP_METHOD_POST, "POST" },
{ HTTP_METHOD_PUT, "PUT" },
{ HTTP_METHOD_DELETE, "DELETE" },
{ HTTP_METHOD_CONNECT, "CONNECT" },
{ HTTP_METHOD_OPTIONS, "OPTIONS" },
{ HTTP_METHOD_TRACE, "TRACE" },
{ HTTP_METHOD_ACL, "ACL" },
{ HTTP_METHOD_BASELINE_CONTROL, "BASELINE-CONTROL" },
{ HTTP_METHOD_BIND, "BIND" },
{ HTTP_METHOD_CHECKIN, "CHECKIN" },
{ HTTP_METHOD_CHECKOUT, "CHECKOUT" },
{ HTTP_METHOD_COPY, "COPY" },
{ HTTP_METHOD_LABEL, "LABEL" },
{ HTTP_METHOD_LINK, "LINK" },
{ HTTP_METHOD_LOCK, "LOCK" },
{ HTTP_METHOD_MERGE, "MERGE" },
{ HTTP_METHOD_MKACTIVITY, "MKACTIVITY" },
{ HTTP_METHOD_MKCALENDAR, "MKCALENDAR" },
{ HTTP_METHOD_MKCOL, "MKCOL" },
{ HTTP_METHOD_MKREDIRECTREF, "MKREDIRECTREF" },
{ HTTP_METHOD_MKWORKSPACE, "MKWORKSPACE" },
{ HTTP_METHOD_MOVE, "MOVE" },
{ HTTP_METHOD_ORDERPATCH, "ORDERPATCH" },
{ HTTP_METHOD_PATCH, "PATCH" },
{ HTTP_METHOD_PROPFIND, "PROPFIND" },
{ HTTP_METHOD_PROPPATCH, "PROPPATCH" },
{ HTTP_METHOD_REBIND, "REBIND" },
{ HTTP_METHOD_REPORT, "REPORT" },
{ HTTP_METHOD_SEARCH, "SEARCH" },
{ HTTP_METHOD_UNBIND, "UNBIND" },
{ HTTP_METHOD_UNCHECKOUT, "UNCHECKOUT" },
{ HTTP_METHOD_UNLINK, "UNLINK" },
{ HTTP_METHOD_UNLOCK, "UNLOCK" },
{ HTTP_METHOD_UPDATE, "UPDATE" },
{ HTTP_METHOD_UPDATEREDIRECTREF, "UPDATEREDIRECTREF" },
{ HTTP_METHOD_VERSION_CONTROL, "VERSION-CONTROL" },
{ HTTP_METHOD_UNSET, NULL }
};
static const keyvalue http_status[] = {
{ 100, "Continue" },
{ 101, "Switching Protocols" },
{ 102, "Processing" }, /* WebDAV */
{ 200, "OK" },
{ 201, "Created" },
{ 202, "Accepted" },
{ 203, "Non-Authoritative Information" },
{ 204, "No Content" },
{ 205, "Reset Content" },
{ 206, "Partial Content" },
{ 207, "Multi-status" }, /* WebDAV */
{ 300, "Multiple Choices" },
{ 301, "Moved Permanently" },
{ 302, "Found" },
{ 303, "See Other" },
{ 304, "Not Modified" },
{ 305, "Use Proxy" },
{ 306, "(Unused)" },
{ 307, "Temporary Redirect" },
{ 308, "Permanent Redirect" },
{ 400, "Bad Request" },
{ 401, "Unauthorized" },
{ 402, "Payment Required" },
{ 403, "Forbidden" },
{ 404, "Not Found" },
{ 405, "Method Not Allowed" },
{ 406, "Not Acceptable" },
{ 407, "Proxy Authentication Required" },
{ 408, "Request Timeout" },
{ 409, "Conflict" },
{ 410, "Gone" },
{ 411, "Length Required" },
{ 412, "Precondition Failed" },
{ 413, "Request Entity Too Large" },
{ 414, "Request-URI Too Long" },
{ 415, "Unsupported Media Type" },
{ 416, "Requested Range Not Satisfiable" },
{ 417, "Expectation Failed" },
{ 422, "Unprocessable Entity" }, /* WebDAV */
{ 423, "Locked" }, /* WebDAV */
{ 424, "Failed Dependency" }, /* WebDAV */
{ 426, "Upgrade Required" }, /* TLS */
{ 500, "Internal Server Error" },
{ 501, "Not Implemented" },
{ 502, "Bad Gateway" },
{ 503, "Service Not Available" },
{ 504, "Gateway Timeout" },
{ 505, "HTTP Version Not Supported" },
{ 507, "Insufficient Storage" }, /* WebDAV */
{ -1, NULL }
};
static const keyvalue http_status_body[] = {
{ 400, "400.html" },
{ 401, "401.html" },
{ 403, "403.html" },
{ 404, "404.html" },
{ 411, "411.html" },
{ 416, "416.html" },
{ 500, "500.html" },
{ 501, "501.html" },
{ 503, "503.html" },
{ 505, "505.html" },
{ -1, NULL }
};
static const char *keyvalue_get_value(const keyvalue *kv, int k) {
int i;
for (i = 0; kv[i].value; i++) {
if (kv[i].key == k) return kv[i].value;
}
return NULL;
}
static int keyvalue_get_key(const keyvalue *kv, const char *s) {
int i;
for (i = 0; kv[i].value; i++) {
if (0 == strcmp(kv[i].value, s)) return kv[i].key;
}
return -1;
}
const char *get_http_version_name(int i) {
return keyvalue_get_value(http_versions, i);
}
const char *get_http_status_name(int i) {
return keyvalue_get_value(http_status, i);
}
const char *get_http_method_name(http_method_t i) {
return keyvalue_get_value(http_methods, i);
}
const char *get_http_status_body_name(int i) {
return keyvalue_get_value(http_status_body, i);
}
int get_http_version_key(const char *s) {
return keyvalue_get_key(http_versions, s);
}
http_method_t get_http_method_key(const char *s) {
return (http_method_t)keyvalue_get_key(http_methods, s);
}
#ifdef HAVE_PCRE_H
#include <pcre.h>
#endif

View File

@ -6,66 +6,6 @@
#include "buffer.h"
struct cond_cache_t; /* declaration */
/* sources:
* - [RFC2616], Section 9
* (or http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22)
* - http://tools.ietf.org/html/draft-ietf-httpbis-method-registrations-11, Appendix A
*
* http://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-22, Section 8.1 defines
* a new registry (not available yet):
* http://www.iana.org/assignments/http-methods
*/
typedef enum {
HTTP_METHOD_UNSET = -1,
HTTP_METHOD_GET, /* [RFC2616], Section 9.3 */
HTTP_METHOD_HEAD, /* [RFC2616], Section 9.4 */
HTTP_METHOD_POST, /* [RFC2616], Section 9.5 */
HTTP_METHOD_PUT, /* [RFC2616], Section 9.6 */
HTTP_METHOD_DELETE, /* [RFC2616], Section 9.7 */
HTTP_METHOD_CONNECT, /* [RFC2616], Section 9.9 */
HTTP_METHOD_OPTIONS, /* [RFC2616], Section 9.2 */
HTTP_METHOD_TRACE, /* [RFC2616], Section 9.8 */
HTTP_METHOD_ACL, /* [RFC3744], Section 8.1 */
HTTP_METHOD_BASELINE_CONTROL, /* [RFC3253], Section 12.6 */
HTTP_METHOD_BIND, /* [RFC5842], Section 4 */
HTTP_METHOD_CHECKIN, /* [RFC3253], Section 4.4 and [RFC3253], Section 9.4 */
HTTP_METHOD_CHECKOUT, /* [RFC3253], Section 4.3 and [RFC3253], Section 8.8 */
HTTP_METHOD_COPY, /* [RFC4918], Section 9.8 */
HTTP_METHOD_LABEL, /* [RFC3253], Section 8.2 */
HTTP_METHOD_LINK, /* [RFC2068], Section 19.6.1.2 */
HTTP_METHOD_LOCK, /* [RFC4918], Section 9.10 */
HTTP_METHOD_MERGE, /* [RFC3253], Section 11.2 */
HTTP_METHOD_MKACTIVITY, /* [RFC3253], Section 13.5 */
HTTP_METHOD_MKCALENDAR, /* [RFC4791], Section 5.3.1 */
HTTP_METHOD_MKCOL, /* [RFC4918], Section 9.3 */
HTTP_METHOD_MKREDIRECTREF, /* [RFC4437], Section 6 */
HTTP_METHOD_MKWORKSPACE, /* [RFC3253], Section 6.3 */
HTTP_METHOD_MOVE, /* [RFC4918], Section 9.9 */
HTTP_METHOD_ORDERPATCH, /* [RFC3648], Section 7 */
HTTP_METHOD_PATCH, /* [RFC5789], Section 2 */
HTTP_METHOD_PROPFIND, /* [RFC4918], Section 9.1 */
HTTP_METHOD_PROPPATCH, /* [RFC4918], Section 9.2 */
HTTP_METHOD_REBIND, /* [RFC5842], Section 6 */
HTTP_METHOD_REPORT, /* [RFC3253], Section 3.6 */
HTTP_METHOD_SEARCH, /* [RFC5323], Section 2 */
HTTP_METHOD_UNBIND, /* [RFC5842], Section 5 */
HTTP_METHOD_UNCHECKOUT, /* [RFC3253], Section 4.5 */
HTTP_METHOD_UNLINK, /* [RFC2068], Section 19.6.1.3 */
HTTP_METHOD_UNLOCK, /* [RFC4918], Section 9.11 */
HTTP_METHOD_UPDATE, /* [RFC3253], Section 7.1 */
HTTP_METHOD_UPDATEREDIRECTREF, /* [RFC4437], Section 7 */
HTTP_METHOD_VERSION_CONTROL /* [RFC3253], Section 3.5 */
} http_method_t;
typedef enum { HTTP_VERSION_UNSET = -1, HTTP_VERSION_1_0, HTTP_VERSION_1_1 } http_version_t;
typedef struct {
int key;
const char *value;
} keyvalue;
struct pcre_keyvalue; /* declaration */
typedef struct pcre_keyvalue_ctx {
@ -79,13 +19,6 @@ typedef struct {
size_t size;
} pcre_keyvalue_buffer;
const char *get_http_status_name(int i);
const char *get_http_version_name(int i);
const char *get_http_method_name(http_method_t i);
const char *get_http_status_body_name(int i);
int get_http_version_key(const char *s);
http_method_t get_http_method_key(const char *s);
pcre_keyvalue_buffer *pcre_keyvalue_buffer_init(void);
int pcre_keyvalue_buffer_append(struct server *srv, pcre_keyvalue_buffer *kvb, buffer *key, buffer *value);
void pcre_keyvalue_buffer_free(pcre_keyvalue_buffer *kvb);

View File

@ -559,6 +559,7 @@ common_src = [
'gw_backend.c',
'http_auth.c',
'http_chunk.c',
'http_kv.c',
'http_vhostdb.c',
'http-header-glue.c',
'joblist.c',
@ -705,7 +706,7 @@ test('test_configfile', executable('test_configfile',
'array.c',
'data_config.c',
'data_string.c',
'keyvalue.c',
'http_kv.c',
'vector.c',
'log.c',
'sock_addr.c',
@ -721,11 +722,11 @@ test('test_request', executable('test_request',
'buffer.c',
'array.c',
'data_string.c',
'keyvalue.c',
'http_kv.c',
'log.c',
'sock_addr.c',
],
dependencies: common_flags + libpcre + libunwind,
dependencies: common_flags + libunwind,
build_by_default: false,
))

View File

@ -2,7 +2,7 @@
#include "base.h"
#include "stat_cache.h"
#include "keyvalue.h"
#include "http_kv.h"
#include "log.h"
#include "connections.h"
#include "joblist.h"

View File

@ -7,7 +7,7 @@
#include "base.h"
#include "array.h"
#include "buffer.h"
#include "keyvalue.h"
#include "http_kv.h"
#include "log.h"
#include "sock_addr.h"
#include "status_counter.h"

View File

@ -1,6 +1,7 @@
#include "first.h"
#include "base.h"
#include "keyvalue.h"
#include "log.h"
#include "buffer.h"

View File

@ -1,6 +1,7 @@
#include "first.h"
#include "base.h"
#include "keyvalue.h"
#include "log.h"
#include "buffer.h"

View File

@ -2,7 +2,7 @@
#include "request.h"
#include "base.h"
#include "keyvalue.h"
#include "http_kv.h"
#include "log.h"
#include "sock_addr.h"

View File

@ -3,7 +3,7 @@
#include "response.h"
#include "base.h"
#include "fdevent.h"
#include "keyvalue.h"
#include "http_kv.h"
#include "log.h"
#include "stat_cache.h"
#include "chunk.h"

View File

@ -4,7 +4,6 @@
#include "buffer.h"
#include "network.h"
#include "log.h"
#include "keyvalue.h"
#include "rand.h"
#include "response.h"
#include "request.h"