891050836a429f21a0a1135d9ccce2916cc79651
[openwrt/svn-archive/archive.git] / package / busybox / patches / 450-httpd_accept_header.patch
1 --- a/networking/httpd.c
2 +++ b/networking/httpd.c
3 @@ -255,6 +255,8 @@
4 USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
5 USE_FEATURE_HTTPD_CGI(char *referer;)
6 USE_FEATURE_HTTPD_CGI(char *user_agent;)
7 + USE_FEATURE_HTTPD_CGI(char *http_accept;)
8 + USE_FEATURE_HTTPD_CGI(char *http_accept_language;)
9
10 off_t file_size; /* -1 - unknown */
11 #if ENABLE_FEATURE_HTTPD_RANGES
12 @@ -302,6 +304,8 @@
13 #define remoteuser (G.remoteuser )
14 #define referer (G.referer )
15 #define user_agent (G.user_agent )
16 +#define http_accept (G.http_accept )
17 +#define http_accept_language (G.http_accept_language)
18 #define file_size (G.file_size )
19 #if ENABLE_FEATURE_HTTPD_RANGES
20 #define range_start (G.range_start )
21 @@ -1383,6 +1387,10 @@
22 }
23 }
24 setenv1("HTTP_USER_AGENT", user_agent);
25 + if (http_accept)
26 + setenv1("HTTP_ACCEPT", http_accept);
27 + if (http_accept_language)
28 + setenv1("HTTP_ACCEPT_LANGUAGE", http_accept_language);
29 if (post_len)
30 putenv(xasprintf("CONTENT_LENGTH=%d", post_len));
31 if (cookie)
32 @@ -2020,6 +2028,10 @@
33 referer = xstrdup(skip_whitespace(iobuf + sizeof("Referer:")-1));
34 } else if (STRNCASECMP(iobuf, "User-Agent:") == 0) {
35 user_agent = xstrdup(skip_whitespace(iobuf + sizeof("User-Agent:")-1));
36 + } else if (STRNCASECMP(iobuf, "Accept:") == 0) {
37 + http_accept = xstrdup(skip_whitespace(iobuf + sizeof("Accept:")-1));
38 + } else if (STRNCASECMP(iobuf, "Accept-Language:") == 0) {
39 + http_accept_language = xstrdup(skip_whitespace(iobuf + sizeof("Accept-Language:")-1));
40 }
41 #endif
42 #if ENABLE_FEATURE_HTTPD_BASIC_AUTH