[core] add User-Agent to http_header_e enum

recognize as common header

(minor performance enhancement)
This commit is contained in:
Glenn Strauss 2019-06-21 01:00:23 -04:00
parent 9858051d03
commit 41944e3be8
3 changed files with 8 additions and 6 deletions

View File

@ -30,6 +30,7 @@ static const keyvlenvalue http_headers[] = {
,{ HTTP_HEADER_FORWARDED, CONST_LEN_STR("Forwarded") }
,{ HTTP_HEADER_CONNECTION, CONST_LEN_STR("Connection") }
,{ HTTP_HEADER_SET_COOKIE, CONST_LEN_STR("Set-Cookie") }
,{ HTTP_HEADER_USER_AGENT, CONST_LEN_STR("User-Agent") }
,{ HTTP_HEADER_CONTENT_TYPE, CONST_LEN_STR("Content-Type") }
,{ HTTP_HEADER_LAST_MODIFIED, CONST_LEN_STR("Last-Modified") }
,{ HTTP_HEADER_AUTHORIZATION, CONST_LEN_STR("Authorization") }

View File

@ -34,9 +34,10 @@ enum http_header_e {
,HTTP_HEADER_STATUS = 0x00200000
,HTTP_HEADER_TRANSFER_ENCODING = 0x00400000
,HTTP_HEADER_UPGRADE = 0x00800000
,HTTP_HEADER_VARY = 0x01000000
,HTTP_HEADER_X_FORWARDED_FOR = 0x02000000
,HTTP_HEADER_X_FORWARDED_PROTO = 0x04000000
,HTTP_HEADER_USER_AGENT = 0x01000000
,HTTP_HEADER_VARY = 0x02000000
,HTTP_HEADER_X_FORWARDED_FOR = 0x04000000
,HTTP_HEADER_X_FORWARDED_PROTO = 0x08000000
};
__attribute_pure__

View File

@ -3762,7 +3762,7 @@ mod_webdav_propfind (connection * const con, const plugin_config * const pconf)
}
else if (S_ISDIR(pb.st.st_mode)) {
if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
buffer *vb = http_header_request_get(con, HTTP_HEADER_OTHER,
buffer *vb = http_header_request_get(con, HTTP_HEADER_USER_AGENT,
CONST_STR_LEN("User-Agent"));
if (vb && 0 == strncmp(vb->ptr, "Microsoft-WebDAV-MiniRedir/",
sizeof("Microsoft-WebDAV-MiniRedir/")-1)) {
@ -4951,7 +4951,7 @@ mod_webdav_proppatch (connection * const con, const plugin_config * const pconf)
if (S_ISDIR(st.st_mode)) {
if (con->physical.path->ptr[con->physical.path->used - 2] != '/') {
buffer *vb = http_header_request_get(con, HTTP_HEADER_OTHER,
buffer *vb = http_header_request_get(con, HTTP_HEADER_USER_AGENT,
CONST_STR_LEN("User-Agent"));
if (vb && 0 == strncmp(vb->ptr, "Microsoft-WebDAV-MiniRedir/",
sizeof("Microsoft-WebDAV-MiniRedir/")-1)) {
@ -5071,7 +5071,7 @@ mod_webdav_proppatch (connection * const con, const plugin_config * const pconf)
? webdav_db_transaction_commit(pconf)
: webdav_db_transaction_rollback(pconf)) {
if (NULL == ms) {
buffer *vb = http_header_request_get(con, HTTP_HEADER_OTHER,
buffer *vb = http_header_request_get(con, HTTP_HEADER_USER_AGENT,
CONST_STR_LEN("User-Agent"));
if (vb && 0 == strncmp(vb->ptr, "Microsoft-WebDAV-MiniRedir/",
sizeof("Microsoft-WebDAV-MiniRedir/")-1)) {