summaryrefslogtreecommitdiff
path: root/networking/httpd.c
diff options
context:
space:
mode:
authorDenis Vlasenko2007-07-21 14:57:54 +0000
committerDenis Vlasenko2007-07-21 14:57:54 +0000
commit6cd84dac84f72dde437790cc620c8638d3591d00 (patch)
tree1c822ba1859d04ab9af79210d7f331207738ed7b /networking/httpd.c
parente8feca085dbcd0fb97aa5af1a8e751affb88df48 (diff)
downloadbusybox-6cd84dac84f72dde437790cc620c8638d3591d00.zip
busybox-6cd84dac84f72dde437790cc620c8638d3591d00.tar.gz
Three patches from FreeWRT people
Diffstat (limited to 'networking/httpd.c')
-rw-r--r--networking/httpd.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/networking/httpd.c b/networking/httpd.c
index 8c5e29f..d058812 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -145,6 +145,7 @@ struct globals {
USE_FEATURE_HTTPD_BASIC_AUTH(const char *g_realm;)
USE_FEATURE_HTTPD_BASIC_AUTH(char *remoteuser;)
USE_FEATURE_HTTPD_CGI(char *referer;)
+ USE_FEATURE_HTTPD_CGI(char *user_agent;)
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
char *rmt_ip_str; /* for set env REMOTE_ADDR */
@@ -179,6 +180,7 @@ struct globals {
#define g_realm (G.g_realm )
#define remoteuser (G.remoteuser )
#define referer (G.referer )
+#define user_agent (G.user_agent )
#if ENABLE_FEATURE_HTTPD_CGI || DEBUG
#define rmt_ip_str (G.rmt_ip_str )
#endif
@@ -1106,6 +1108,7 @@ static int sendCgi(const char *url,
setenv1("REMOTE_ADDR", p);
if (cp) *cp = ':';
}
+ setenv1("HTTP_USER_AGENT", user_agent);
#if ENABLE_FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
setenv_long("REMOTE_PORT", tcp_port);
#endif
@@ -1682,12 +1685,14 @@ static void handleIncoming(void)
if (test[0] || errno || length > INT_MAX)
goto bail_out;
}
- } else if ((STRNCASECMP(buf, "Cookie:") == 0)) {
+ } else if (STRNCASECMP(buf, "Cookie:") == 0) {
cookie = strdup(skip_whitespace(buf + sizeof("Cookie:")-1));
- } else if ((STRNCASECMP(buf, "Content-Type:") == 0)) {
+ } else if (STRNCASECMP(buf, "Content-Type:") == 0)) {
content_type = strdup(skip_whitespace(buf + sizeof("Content-Type:")-1));
- } else if ((STRNCASECMP(buf, "Referer:") == 0)) {
+ } else if (STRNCASECMP(buf, "Referer:") == 0) {
referer = strdup(skip_whitespace(buf + sizeof("Referer:")-1));
+ } else if (STRNCASECMP(buf, "User-Agent:") == 0) {
+ user_agent = strdup(skip_whitespace(buf + sizeof("User-Agent:")-1));
}
#endif