Re: 18 months later: Tux and HTTP request forwarding
Ingo Molnar <[email protected]>
| Newsgroups | gmane.network.tux |
|---|---|
| Message-ID | <Pine.LNX.4.56.0310291719540.16661@earth> |
On Tue, 28 Oct 2003, Charles Bennington wrote:
> I have been looking for a way to have tux always handle requests for
> URLs with a question mark in them, but also discard the text including
> and following the question mark. For example:
>
> http://site/path/file?args ==> http://site/path/file
>
> This is in an attempt to serve files that are static by design by have a
> random argument appended to the end to defeat browser caching. [...]
could you apply the attached patch and do:
echo 1 > /proc/sys/net/tux/ignore_query
does this do the trick?
Ingo
--- linux/include/linux/sysctl.h.orig
+++ linux/include/linux/sysctl.h
@@ -562,6 +562,7 @@ enum {
NET_TUX_MAX_HEADER_LEN = 42,
NET_TUX_404_PAGE = 43,
NET_TUX_MAX_KEEPALIVES = 44,
+ NET_TUX_IGNORE_QUERY = 45,
};
/* /proc/sys/net/khttpd/ */
--- linux/include/net/tux.h.orig
+++ linux/include/net/tux.h
@@ -715,6 +715,7 @@ extern unsigned int tux_cgi_cpu_mask;
extern tux_proto_t tux_proto_http;
extern tux_proto_t tux_proto_ftp;
extern unsigned int tux_all_userspace;
+extern unsigned int tux_ignore_query;
extern unsigned int tux_redirect_logging;
extern unsigned int tux_referer_logging;
extern unsigned int tux_log_incomplete;
--- linux/net/tux/proc.c.orig
+++ linux/net/tux/proc.c
@@ -60,6 +60,7 @@ unsigned int tux_cgi_inherit_cpu = 0;
unsigned int tux_cgi_cpu_mask = ~0;
unsigned int tux_zerocopy_header = 1;
unsigned int tux_max_free_requests = 1000;
+unsigned int tux_ignore_query = 0;
unsigned int tux_all_userspace = 0;
unsigned int tux_redirect_logging = 1;
unsigned int tux_max_header_len = 3000;
@@ -693,6 +694,18 @@ static ctl_table tux_table[] = {
NULL,
NULL
},
+ { NET_TUX_IGNORE_QUERY,
+ "ignore_query",
+ &tux_ignore_query,
+ sizeof(int),
+ 0644,
+ NULL,
+ proc_dointvec,
+ &sysctl_intvec,
+ NULL,
+ NULL,
+ NULL
+ },
{ NET_TUX_REFERER_LOGGING,
"referer_logging",
&tux_referer_logging,
--- linux/net/tux/proto_http.c.orig
+++ linux/net/tux/proto_http.c
@@ -319,8 +319,13 @@ continue_parsing:
if (c == '#')
GOTO_REDIR;
}
- query_len = curr-query-1;
- req->query_len = query_len;
+
+ if (unlikely(tux_ignore_query))
+ req->query_str = NULL;
+ else {
+ query_len = curr-query-1;
+ req->query_len = query_len;
+ }
}
if (req->query_len)
Dprintk("got query string %s (%d)\n", req->query_str, req->query_len);