diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-09-02 11:16:43 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-09-02 11:16:43 +0000 |
commit | 7397113a4e1cab27fd8697f021bfbf454b306815 (patch) | |
tree | 15f5c66918e04888b490228a67e28be2d78467df /package/busybox/patches | |
parent | 13dfd53e838e6bd6316c67507ed482df367405af (diff) | |
download | upstream-7397113a4e1cab27fd8697f021bfbf454b306815.tar.gz upstream-7397113a4e1cab27fd8697f021bfbf454b306815.tar.bz2 upstream-7397113a4e1cab27fd8697f021bfbf454b306815.zip |
BusyBox httpd Accept Header Patch
With this patch the BusyBox httpd pass the "Accept:" and
"Accept-Language:" header by the environment variables to the
CGI-Script, so this can make Content Negotiation to deliver the page in
the language, which was selected by the user in the browser settings,
and/or serve the XHTML page with the right MIME-Type
application/xhtml+xml to user agents which support it und text/html
which don't.
Signed-off-by: Alina Friedrichsen <x-alina@gmx.net>
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12496 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/busybox/patches')
-rw-r--r-- | package/busybox/patches/450-httpd_accept_header.patch | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/package/busybox/patches/450-httpd_accept_header.patch b/package/busybox/patches/450-httpd_accept_header.patch new file mode 100644 index 0000000000..ac392069fb --- /dev/null +++ b/package/busybox/patches/450-httpd_accept_header.patch @@ -0,0 +1,42 @@ +--- a/networking/httpd.c ++++ b/networking/httpd.c +@@ -255,6 +255,8 @@ + USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;) + USE_FEATURE_HTTPD_CGI(char *referer;) + USE_FEATURE_HTTPD_CGI(char *user_agent;) ++ USE_FEATURE_HTTPD_CGI(char *http_accept;) ++ USE_FEATURE_HTTPD_CGI(char *http_accept_language;) + + off_t file_size; /* -1 - unknown */ + #if ENABLE_FEATURE_HTTPD_RANGES +@@ -302,6 +304,8 @@ + #define remoteuser (G.remoteuser ) + #define referer (G.referer ) + #define user_agent (G.user_agent ) ++#define http_accept (G.http_accept ) ++#define http_accept_language (G.http_accept_language) + #define file_size (G.file_size ) + #if ENABLE_FEATURE_HTTPD_RANGES + #define range_start (G.range_start ) +@@ -1383,6 +1387,10 @@ + } + } + setenv1("HTTP_USER_AGENT", user_agent); ++ if (http_accept) ++ setenv1("HTTP_ACCEPT", http_accept); ++ if (http_accept_language) ++ setenv1("HTTP_ACCEPT_LANGUAGE", http_accept_language); + if (post_len) + putenv(xasprintf("CONTENT_LENGTH=%d", post_len)); + if (cookie) +@@ -2009,6 +2017,10 @@ + referer = xstrdup(skip_whitespace(iobuf + sizeof("Referer:")-1)); + } else if (STRNCASECMP(iobuf, "User-Agent:") == 0) { + user_agent = xstrdup(skip_whitespace(iobuf + sizeof("User-Agent:")-1)); ++ } else if (STRNCASECMP(iobuf, "Accept:") == 0) { ++ http_accept = xstrdup(skip_whitespace(iobuf + sizeof("Accept:")-1)); ++ } else if (STRNCASECMP(iobuf, "Accept-Language:") == 0) { ++ http_accept_language = xstrdup(skip_whitespace(iobuf + sizeof("Accept-Language:")-1)); + } + #endif + #if ENABLE_FEATURE_HTTPD_BASIC_AUTH |