Ticket #250 (POST error when using Opera)
Nick Loman
nick at loman.net
Sat Oct 11 16:37:11 CEST 2008
Hi there
Just to update you on my experience with Varnish 1.1.2, I had exactly
the same problem as reported by the user on this ticket:
http://varnish.projects.linpro.no/ticket/250
In my case, the cause of the problem after some analysis of the log
files was that the "Connection-Length" header was being removed, despite
my VCL actually only amending headers, not deleting them. Hence the
backend script could not process the POST request properly.
The application of the 3110 patch fixed the problem.
http://varnish.projects.linpro.no/changeset/3110
However, as the patch supplied is for Varnish 2.0, I needed to adapt it
to the 1.1.2 source code, as follows:
--- varnish-1.1.2/bin/varnishd/cache_http.c.orig 2008-10-11
13:22:23.0000 00000 +0100
+++ varnish-1.1.2/bin/varnishd/cache_http.c 2008-10-11
13:25:26.000000000 +0 100
@@ -767,6 +767,7 @@
if (to->nhd < HTTP_HDR_MAX) {
to->hd[to->nhd].b = fm->hd[n].b;
to->hd[to->nhd].e = fm->hd[n].e;
+ to->hdf[to->nhd] = 0;
to->nhd++;
} else {
VSL_stats->losthdr++;
@@ -913,10 +914,12 @@
WSL(w, SLT_LostHeader, fd, "%s", string);
to->hd[field].b = NULL;
to->hd[field].e = NULL;
+ to->hdf[field] = 0;
} else {
memcpy(p, string, l + 1);
to->hd[field].b = p;
to->hd[field].e = p + l;
+ to->hdf[field] = 0;
}
}
@@ -962,6 +965,7 @@
} else {
to->hd[to->nhd].b = to->ws->f;
to->hd[to->nhd].e = to->ws->f + n;
+ to->hdf[to->nhd] = 0;
WS_Release(to->ws, n + 1);
to->nhd++;
}
@@ -976,8 +980,10 @@
for (v = u = HTTP_HDR_FIRST; u < hp->nhd; u++) {
if (http_IsHdr(&hp->hd[u], hdr))
continue;
- if (v != u)
+ if (v != u) {
memcpy(&hp->hd[v], &hp->hd[u], sizeof hp->hd[v]);
+ memcpy(&hp->hdf[v], &hp->hdf[u], sizeof hp->hdf[v]);
+ }
v++;
}
hp->nhd = v;
Hope this helps anyone else struggling with strange issues on Varnish
1.1.2. I think the key point is that simply amending client headers in
vcl_recv can also trigger missing headers being sent to the backend.
Regards,
Nick.
More information about the varnish-misc
mailing list