Hi,
I attached a patch on a few issues.
1. Do not propagate no-cache from Pragma to Cache-Control. It destroy IE
plugins if the pragma have no-cache.
2. Do not upgrade 1.0 like Connection: close server reply to 1.1 reply to
client.
3. If Content-Range header is malformed, make it as an unknown header, not
an error. Server misses the "bytes" keyword often.
4. Keep Expire head as is. Keep what our interpret of it only to ourselves.
Regards,
Ming
On Tue, Sep 15, 2009 at 11:11 AM, Ming Fu <[email protected]> wrote:
> Hi,
>
> 1. Cache-Control and Pragma,
> Polipo treat Pragma: no-cache and Cache-Control: no-cache the same. The
> no-cache is stored in a flag and always send across polipo in Cache-Control
> header.
> This normally works fine for page that can be displayed by the IE itself,
> such as html and jpg. But is problematic for plugins. Firefox do not has the
> problem IE has. Here is what Microsoft says:
>
> http://support.microsoft.com/default.aspx?scid=kb;EN-US;q297822
>
> The IE ignores Pragma for server reply, so if the server put no-cache on
> Pragma, it has no effect on IE. But IE do not like no-cache on Cache-Control
> for content it need plugin to display. When no-cache is on Cache-Control, IE
> won't store the download in a temp file for the plugin to work on. You will
> get a blank window.
>
> Suggest keep the Control-Control line in the headers lines the same as
> Pragma, and remove the code that prints out Cache-Control from flags.
>
> 2. illegal Expire header.
> Some time, buggy server give out malformed Expire date. I come across some
> that looks like the actual script code to generate the date. Must be from a
> buggie server side script. The polipo interpret such expire header as
> Expire: 0. However, the client-server pair maybe some thing other than an
> pair of apache-IE. The client may just expect to see these odd Expire
> header. A Expire: 0 is printed out by polipo as the date of beginning of
> computer clock. This could throw the client off. I observe squid keeps
> malformed header as is and pass them through. Maybe we should keep the
> expire header in text as well.
>
> This is just a heads up for discussion. I will clean up my code and give a
> suggested patch.
>
> Regards,
> Regards,
>
>
>
diff -c polipo-1.0.4/client.c polipo-1.0.4.mod/client.c
*** polipo-1.0.4/client.c 2008-01-08 07:56:45.000000000 -0500
--- polipo-1.0.4.mod/client.c 2009-09-16 08:41:16.354969509 -0400
***************
*** 1722,1728 ****
if(request->method != METHOD_HEAD &&
condition_result != CONDITION_NOT_MODIFIED &&
! request->to < 0 && object->length < 0) {
if(connection->version == HTTP_11) {
connection->te = TE_CHUNKED;
n = snnprintf(connection->buf, n, bufsize,
--- 1722,1729 ----
if(request->method != METHOD_HEAD &&
condition_result != CONDITION_NOT_MODIFIED &&
! (request->to < 0) && (object->length < 0)
! && (request->flags & REQUEST_PERSISTENT)) {
if(connection->version == HTTP_11) {
connection->te = TE_CHUNKED;
n = snnprintf(connection->buf, n, bufsize,
diff -c polipo-1.0.4/http.c polipo-1.0.4.mod/http.c
*** polipo-1.0.4/http.c 2008-01-08 07:56:45.000000000 -0500
--- polipo-1.0.4.mod/http.c 2009-09-16 09:29:13.875080142 -0400
***************
*** 322,327 ****
--- 322,329 ----
from, to);
}
}
+ if(n < 0)
+ goto fail;
}
if(object->etag) {
***************
*** 343,360 ****
goto fail;
}
- if(object->expires >= 0) {
- n = snnprintf(buf, n, len, "\r\nExpires: ");
- n = format_time(buf, n, len, object->expires);
- if(n < 0)
- goto fail;
- }
-
- n = httpPrintCacheControl(buf, n, len,
- object->cache_control, NULL);
- if(n < 0)
- goto fail;
-
if(!disableVia && object->via)
n = snnprintf(buf, n, len, "\r\nVia: %s", object->via->string);
--- 345,350 ----
diff -c polipo-1.0.4/http_parse.c polipo-1.0.4.mod/http_parse.c
*** polipo-1.0.4/http_parse.c 2008-01-08 07:56:45.000000000 -0500
--- polipo-1.0.4.mod/http_parse.c 2009-09-16 09:19:14.908962141 -0400
***************
*** 958,963 ****
--- 958,964 ----
expires = t;
else
expires = 0;
+ goto save;
} else if(name == atomLastModified)
last_modified = t;
else if(name == atomIfModifiedSince)
***************
*** 1140,1145 ****
--- 1141,1147 ----
&v_start, &v_end,
&end);
}
+ goto save;
} else if(name == atomContentRange) {
if(!client) {
j = parseContentRange(buf, value_start,
***************
*** 1154,1160 ****
}
} else {
do_log(L_ERROR, "Content-Range from client.\n");
! goto fail;
}
} else if(name == atomRange) {
if(client) {
--- 1156,1162 ----
}
} else {
do_log(L_ERROR, "Content-Range from client.\n");
! goto save;
}
} else if(name == atomRange) {
if(client) {
***************
*** 1262,1267 ****
--- 1264,1270 ----
name == atomCookie || name == atomCookie2))
cache_control.flags |= CACHE_COOKIE;
+ save:
if(hbuf) {
if(name != atomConnection && name != atomHost &&
name != atomAcceptRange && name != atomTE &&
diff -c polipo-1.0.4/server.c polipo-1.0.4.mod/server.c
*** polipo-1.0.4/server.c 2008-01-08 07:56:45.000000000 -0500
--- polipo-1.0.4.mod/server.c 2009-09-16 08:37:17.634962733 -0400
***************
*** 1662,1669 ****
}
}
- n = httpPrintCacheControl(connection->reqbuf, n, bufsize,
- 0, &request->cache_control);
if(n < 0)
goto fail;
--- 1662,1667 ----
***************
*** 2274,2279 ****
--- 2272,2286 ----
objectMetadataChanged(new_object, 0);
}
+ if (!(request->flags & REQUEST_PERSISTENT)) {
+ HTTPRequestPtr requestor = NULL;
+
+ requestor = request->request;
+ if (requestor) {
+ requestor->flags &= ~REQUEST_PERSISTENT;
+ }
+ }
+
if(object->flags & OBJECT_VALIDATING) {
object->flags &= ~OBJECT_VALIDATING;
notifyObject(object);
------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users