Armistead, Jason wrote:
> > No, it is not (currently) possible to redirect to a Host: based server.
> > The redirector only rewrites the URL internal to Squid, the Host: header
> > is passed along unchanged. This should be concidered as a Squid
> > redirection bug.
> >
> -----
>
> So, the real question about this is:
>
> When will this apparent oversight of a bug be fixed ?
Since you asked, I took the time to implement a fix for 1.2. I have
submitted the patch and hopefully it gets accepted.
--- Henrik Nordstr�m Sparetime Squid Hacker
Index: squid/src/client_side.c
diff -u squid/src/client_side.c:1.1.1.18 squid/src/client_side.c:1.1.1.18.2.2
--- squid/src/client_side.c:1.1.1.18 Sun Apr 12 20:49:26 1998
+++ squid/src/client_side.c Thu Apr 16 01:27:37 1998
@@ -212,7 +212,7 @@
result ? result : "NULL");
assert(http->redirect_state == REDIRECT_PENDING);
http->redirect_state = REDIRECT_DONE;
- if (result)
+ if (result && strcmp(result, http->uri))
new_request = urlParse(old_request->method, result);
if (new_request) {
safe_free(http->uri);
@@ -225,6 +225,8 @@
new_request->http_ver = old_request->http_ver;
new_request->headers = xstrdup(old_request->headers);
new_request->headers_sz = old_request->headers_sz;
+ new_request->client_addr = old_request->client_addr;
+ new_request->redirected = 1;
if (old_request->body) {
new_request->body = xmalloc(old_request->body_sz);
xmemcpy(new_request->body, old_request->body, old_request->body_sz);
Index: squid/src/http.c
diff -u squid/src/http.c:1.1.1.15 squid/src/http.c:1.1.1.15.4.1
--- squid/src/http.c:1.1.1.15 Wed Apr 8 22:07:14 1998
+++ squid/src/http.c Thu Apr 16 01:27:38 1998
@@ -641,6 +641,8 @@
continue;
}
if (strncasecmp(xbuf, "Host:", 5) == 0) {
+ if (request->redirected)
+ continue; /* Ignore Host: header on redirected requests */
EBIT_SET(hdr_flags, HDR_HOST);
} else if (strncasecmp(xbuf, "Cache-Control:", 14) == 0) {
for (s = xbuf + 14; *s && isspace(*s); s++);
Index: squid/src/structs.h
diff -u squid/src/structs.h:1.1.1.19 squid/src/structs.h:1.1.1.19.2.2
--- squid/src/structs.h:1.1.1.19 Sun Apr 12 20:49:36 1998
+++ squid/src/structs.h Thu Apr 16 01:27:38 1998
@@ -1091,7 +1090,8 @@
size_t body_sz;
struct _HierarchyLogEntry hier;
err_type err_type;
int internal:1; /* /squid-internal/ requests */
+ int redirected:1; /* Rewritten by redirector */
};
struct _cachemgr_passwd {
Received on Wed Apr 15 1998 - 16:48:00 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:39:42 MST