//config: bool "httpd"
//config: default y
//config: help
-//config: Serve web pages via an HTTP server.
+//config: HTTP server.
//config:
//config:config FEATURE_HTTPD_RANGES
//config: bool "Support 'Ranges:' header"
//config: when specific URLs are requested.
//config:
//config:config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
-//config: bool "Support for running scripts through an interpreter"
+//config: bool "Support running scripts through an interpreter"
//config: default y
//config: depends on FEATURE_HTTPD_CGI
//config: help
//config: "<Hello World>".
//config:
//config:config FEATURE_HTTPD_ERROR_PAGES
-//config: bool "Support for custom error pages"
+//config: bool "Support custom error pages"
//config: default y
//config: depends on HTTPD
//config: help
//config: message.
//config:
//config:config FEATURE_HTTPD_PROXY
-//config: bool "Support for reverse proxy"
+//config: bool "Support reverse proxy"
//config: default y
//config: depends on HTTPD
//config: help
//config: http://hostname[:port]/new/path/myfile.
//config:
//config:config FEATURE_HTTPD_GZIP
-//config: bool "Support for GZIP content encoding"
+//config: bool "Support GZIP content encoding"
//config: default y
//config: depends on HTTPD
//config: help
int proxy_fd;
len_and_sockaddr *lsa;
- proxy_fd = socket(AF_INET, SOCK_STREAM, 0);
- if (proxy_fd < 0)
- send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR);
lsa = host2sockaddr(proxy_entry->host_port, 80);
if (lsa == NULL)
send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR);
+ proxy_fd = socket(lsa->u.sa.sa_family, SOCK_STREAM, 0);
+ if (proxy_fd < 0)
+ send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR);
if (connect(proxy_fd, &lsa->u.sa, lsa->len) < 0)
send_headers_and_exit(HTTP_INTERNAL_SERVER_ERROR);
fdprintf(proxy_fd, "%s %s%s%s%s HTTP/%c.%c\r\n",