diff options
author | Don Kjer <don@lindenlab.com> | 2013-04-04 21:50:45 +0000 |
---|---|---|
committer | Don Kjer <don@lindenlab.com> | 2013-04-04 21:50:45 +0000 |
commit | beeefb45269f45ea717f58b30a0985951ae23c20 (patch) | |
tree | 34f48c7703588b64bb625984f77a74752997099f /indra/llmessage/llhttpconstants.cpp | |
parent | 7c37af37d4459425b3ab705156eeff316531bc81 (diff) |
Renaming HTTP_HEADER_* into HTTP_IN_HEADER_* and HTTP_OUT_HEADER_* to make it more clear which header strings should be used for incoming vs outgoing situations.
Using constants for commonly used llhttpnode context strings.
Diffstat (limited to 'indra/llmessage/llhttpconstants.cpp')
-rw-r--r-- | indra/llmessage/llhttpconstants.cpp | 139 |
1 files changed, 73 insertions, 66 deletions
diff --git a/indra/llmessage/llhttpconstants.cpp b/indra/llmessage/llhttpconstants.cpp index 2134024a14..1995fad1e5 100644 --- a/indra/llmessage/llhttpconstants.cpp +++ b/indra/llmessage/llhttpconstants.cpp @@ -37,72 +37,76 @@ // for curl_getdate() (apparently parsing RFC 1123 dates is hard) #include <curl/curl.h> -const std::string HTTP_HEADER_ACCEPT("Accept"); -const std::string HTTP_HEADER_ACCEPT_CHARSET("Accept-Charset"); -const std::string HTTP_HEADER_ACCEPT_ENCODING("Accept-Encoding"); -const std::string HTTP_HEADER_ACCEPT_LANGUAGE("Accept-Language"); -const std::string HTTP_HEADER_ACCEPT_RANGES("Accept-Ranges"); -const std::string HTTP_HEADER_AGE("Age"); -const std::string HTTP_HEADER_ALLOW("Allow"); -const std::string HTTP_HEADER_AUTHORIZATION("Authorization"); -const std::string HTTP_HEADER_CACHE_CONTROL("Cache-Control"); -const std::string HTTP_HEADER_CONNECTION("Connection"); -const std::string HTTP_HEADER_CONTENT_DESCRIPTION("Content-Description"); -const std::string HTTP_HEADER_CONTENT_ENCODING("Content-Encoding"); -const std::string HTTP_HEADER_CONTENT_ID("Content-ID"); -const std::string HTTP_HEADER_CONTENT_LANGUAGE("Content-Language"); -const std::string HTTP_HEADER_CONTENT_LENGTH("Content-Length"); -const std::string HTTP_HEADER_CONTENT_LOCATION("Content-Location"); -const std::string HTTP_HEADER_CONTENT_MD5("Content-MD5"); -const std::string HTTP_HEADER_CONTENT_RANGE("Content-Range"); -const std::string HTTP_HEADER_CONTENT_TRANSFER_ENCODING("Content-Transfer-Encoding"); -const std::string HTTP_HEADER_CONTENT_TYPE("Content-Type"); -const std::string HTTP_HEADER_COOKIE("Cookie"); -const std::string HTTP_HEADER_DATE("Date"); -const std::string HTTP_HEADER_DESTINATION("Destination"); -const std::string HTTP_HEADER_ETAG("ETag"); -const std::string HTTP_HEADER_EXPECT("Expect"); -const std::string HTTP_HEADER_EXPIRES("Expires"); -const std::string HTTP_HEADER_FROM("From"); -const std::string HTTP_HEADER_HOST("Host"); -const std::string HTTP_HEADER_IF_MATCH("If-Match"); -const std::string HTTP_HEADER_IF_MODIFIED_SINCE("If-Modified-Since"); -const std::string HTTP_HEADER_IF_NONE_MATCH("If-None-Match"); -const std::string HTTP_HEADER_IF_RANGE("If-Range"); -const std::string HTTP_HEADER_IF_UNMODIFIED_SINCE("If-Unmodified-Since"); -const std::string HTTP_HEADER_KEEP_ALIVE("Keep-Alive"); -const std::string HTTP_HEADER_LAST_MODIFIED("Last-Modified"); -const std::string HTTP_HEADER_LOCATION("Location"); -const std::string HTTP_HEADER_MAX_FORWARDS("Max-Forwards"); -const std::string HTTP_HEADER_MIME_VERSION("MIME-Version"); -const std::string HTTP_HEADER_PRAGMA("Pragma"); -const std::string HTTP_HEADER_PROXY_AUTHENTICATE("Proxy-Authenticate"); -const std::string HTTP_HEADER_PROXY_AUTHORIZATION("Proxy-Authorization"); -const std::string HTTP_HEADER_RANGE("Range"); -const std::string HTTP_HEADER_REFERER("Referer"); -const std::string HTTP_HEADER_RETRY_AFTER("Retry-After"); -const std::string HTTP_HEADER_SERVER("Server"); -const std::string HTTP_HEADER_SET_COOKIE("Set-Cookie"); -const std::string HTTP_HEADER_TE("TE"); -const std::string HTTP_HEADER_TRAILER("Trailer"); -const std::string HTTP_HEADER_TRANSFER_ENCODING("Transfer-Encoding"); -const std::string HTTP_HEADER_UPGRADE("Upgrade"); -const std::string HTTP_HEADER_USER_AGENT("User-Agent"); -const std::string HTTP_HEADER_VARY("Vary"); -const std::string HTTP_HEADER_VIA("Via"); -const std::string HTTP_HEADER_WARNING("Warning"); -const std::string HTTP_HEADER_WWW_AUTHENTICATE("WWW-Authenticate"); - - -// Sadly, our proxied headers do not follow http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html -// We need to deal with lowercase headers -const std::string HTTP_HEADER_LOWER_ACCEPT_LANGUAGE("accept-language"); -const std::string HTTP_HEADER_LOWER_CACHE_CONTROL("cache-control"); -const std::string HTTP_HEADER_LOWER_CONTENT_LENGTH("content-length"); -const std::string HTTP_HEADER_LOWER_CONTENT_TYPE("content-type"); -const std::string HTTP_HEADER_LOWER_HOST("host"); -const std::string HTTP_HEADER_LOWER_USER_AGENT("user-agent"); -const std::string HTTP_HEADER_LOWER_X_FORWARDED_FOR("x-forwarded-for"); +// Outgoing headers. Do *not* use these to check incoming headers. +// For incoming headers, use the lower-case headers, below. +const std::string HTTP_OUT_HEADER_ACCEPT("Accept"); +const std::string HTTP_OUT_HEADER_ACCEPT_CHARSET("Accept-Charset"); +const std::string HTTP_OUT_HEADER_ACCEPT_ENCODING("Accept-Encoding"); +const std::string HTTP_OUT_HEADER_ACCEPT_LANGUAGE("Accept-Language"); +const std::string HTTP_OUT_HEADER_ACCEPT_RANGES("Accept-Ranges"); +const std::string HTTP_OUT_HEADER_AGE("Age"); +const std::string HTTP_OUT_HEADER_ALLOW("Allow"); +const std::string HTTP_OUT_HEADER_AUTHORIZATION("Authorization"); +const std::string HTTP_OUT_HEADER_CACHE_CONTROL("Cache-Control"); +const std::string HTTP_OUT_HEADER_CONNECTION("Connection"); +const std::string HTTP_OUT_HEADER_CONTENT_DESCRIPTION("Content-Description"); +const std::string HTTP_OUT_HEADER_CONTENT_ENCODING("Content-Encoding"); +const std::string HTTP_OUT_HEADER_CONTENT_ID("Content-ID"); +const std::string HTTP_OUT_HEADER_CONTENT_LANGUAGE("Content-Language"); +const std::string HTTP_OUT_HEADER_CONTENT_LENGTH("Content-Length"); +const std::string HTTP_OUT_HEADER_CONTENT_LOCATION("Content-Location"); +const std::string HTTP_OUT_HEADER_CONTENT_MD5("Content-MD5"); +const std::string HTTP_OUT_HEADER_CONTENT_RANGE("Content-Range"); +const std::string HTTP_OUT_HEADER_CONTENT_TRANSFER_ENCODING("Content-Transfer-Encoding"); +const std::string HTTP_OUT_HEADER_CONTENT_TYPE("Content-Type"); +const std::string HTTP_OUT_HEADER_COOKIE("Cookie"); +const std::string HTTP_OUT_HEADER_DATE("Date"); +const std::string HTTP_OUT_HEADER_DESTINATION("Destination"); +const std::string HTTP_OUT_HEADER_ETAG("ETag"); +const std::string HTTP_OUT_HEADER_EXPECT("Expect"); +const std::string HTTP_OUT_HEADER_EXPIRES("Expires"); +const std::string HTTP_OUT_HEADER_FROM("From"); +const std::string HTTP_OUT_HEADER_HOST("Host"); +const std::string HTTP_OUT_HEADER_IF_MATCH("If-Match"); +const std::string HTTP_OUT_HEADER_IF_MODIFIED_SINCE("If-Modified-Since"); +const std::string HTTP_OUT_HEADER_IF_NONE_MATCH("If-None-Match"); +const std::string HTTP_OUT_HEADER_IF_RANGE("If-Range"); +const std::string HTTP_OUT_HEADER_IF_UNMODIFIED_SINCE("If-Unmodified-Since"); +const std::string HTTP_OUT_HEADER_KEEP_ALIVE("Keep-Alive"); +const std::string HTTP_OUT_HEADER_LAST_MODIFIED("Last-Modified"); +const std::string HTTP_OUT_HEADER_LOCATION("Location"); +const std::string HTTP_OUT_HEADER_MAX_FORWARDS("Max-Forwards"); +const std::string HTTP_OUT_HEADER_MIME_VERSION("MIME-Version"); +const std::string HTTP_OUT_HEADER_PRAGMA("Pragma"); +const std::string HTTP_OUT_HEADER_PROXY_AUTHENTICATE("Proxy-Authenticate"); +const std::string HTTP_OUT_HEADER_PROXY_AUTHORIZATION("Proxy-Authorization"); +const std::string HTTP_OUT_HEADER_RANGE("Range"); +const std::string HTTP_OUT_HEADER_REFERER("Referer"); +const std::string HTTP_OUT_HEADER_RETRY_AFTER("Retry-After"); +const std::string HTTP_OUT_HEADER_SERVER("Server"); +const std::string HTTP_OUT_HEADER_SET_COOKIE("Set-Cookie"); +const std::string HTTP_OUT_HEADER_TE("TE"); +const std::string HTTP_OUT_HEADER_TRAILER("Trailer"); +const std::string HTTP_OUT_HEADER_TRANSFER_ENCODING("Transfer-Encoding"); +const std::string HTTP_OUT_HEADER_UPGRADE("Upgrade"); +const std::string HTTP_OUT_HEADER_USER_AGENT("User-Agent"); +const std::string HTTP_OUT_HEADER_VARY("Vary"); +const std::string HTTP_OUT_HEADER_VIA("Via"); +const std::string HTTP_OUT_HEADER_WARNING("Warning"); +const std::string HTTP_OUT_HEADER_WWW_AUTHENTICATE("WWW-Authenticate"); + +// Incoming headers are normalized to lower-case. +const std::string HTTP_IN_HEADER_ACCEPT_LANGUAGE("accept-language"); +const std::string HTTP_IN_HEADER_CACHE_CONTROL("cache-control"); +const std::string HTTP_IN_HEADER_CONTENT_LENGTH("content-length"); +const std::string HTTP_IN_HEADER_CONTENT_LOCATION("content-location"); +const std::string HTTP_IN_HEADER_CONTENT_TYPE("content-type"); +const std::string HTTP_IN_HEADER_HOST("host"); +const std::string HTTP_IN_HEADER_LOCATION("location"); +const std::string HTTP_IN_HEADER_RETRY_AFTER("retry-after"); +const std::string HTTP_IN_HEADER_SET_COOKIE("set-cookie"); +const std::string HTTP_IN_HEADER_USER_AGENT("user-agent"); +const std::string HTTP_IN_HEADER_X_FORWARDED_FOR("x-forwarded-for"); const std::string HTTP_CONTENT_LLSD_XML("application/llsd+xml"); const std::string HTTP_CONTENT_OCTET_STREAM("application/octet-stream"); @@ -121,6 +125,9 @@ const std::string HTTP_CONTENT_IMAGE_JPEG("image/jpeg"); const std::string HTTP_CONTENT_IMAGE_PNG("image/png"); const std::string HTTP_CONTENT_IMAGE_BMP("image/bmp"); +const std::string HTTP_NO_CACHE("no-cache"); +const std::string HTTP_NO_CACHE_CONTROL("no-cache, max-age=0"); + const std::string HTTP_VERB_INVALID("(invalid)"); const std::string HTTP_VERB_HEAD("HEAD"); const std::string HTTP_VERB_GET("GET"); |