Hi Juliusz,

This seems to work, but very hard to understand the logic.

How about this change

fed:polipo-1.0.4 1009$ diff -c http_parse.c http_parse1.c
*** http_parse.c        2008-01-08 07:56:45.000000000 -0500
--- http_parse1.c       2008-06-12 09:53:46.000000000 -0400
***************
*** 750,756 ****
      AtomPtr name = NULL;
      time_t date = -1, last_modified = -1, expires = -1, polipo_age = -1,
          polipo_access = -1, polipo_body_offset = -1;
!     int len = -1;
      CacheControlRec cache_control;
      char *endptr;
      int te = TE_IDENTITY;
--- 750,756 ----
      AtomPtr name = NULL;
      time_t date = -1, last_modified = -1, expires = -1, polipo_age = -1,
          polipo_access = -1, polipo_body_offset = -1;
!     int len = 0;
      CacheControlRec cache_control;
      char *endptr;
      int te = TE_IDENTITY;

Change the default len to 0 make the case of no Content-Length the same as
"Content-Length:0".
This is what happens from IE7 and Firefox 2, The CONNECT from browser has
Content-Length: 0 in the Header, but the java vm within the these browser
don't. The two are trying to request the same HTTP traffic.

In my opinion these two case are really the same. No Content-Length Header
implies Content-Length:0.
Only if the Content-Length is mal-formated, then len will be -1 to indicate
an error condition. I don't know why it is necessary to tell if the Header
has a content-length or not..

Let me know if my assumption is fraud.

Regards,
Ming


On Wed, Jun 11, 2008 at 1:35 PM, Juliusz Chroboczek <
[EMAIL PROTECTED]> wrote:

> Could you please let me know if this patch fixes the issue?
>
>                                        Juliusz
>
> --- old-polipo/client.c 2008-06-11 19:34:22.000000000 +0200
> +++ new-polipo/client.c 2008-06-11 19:34:22.000000000 +0200
> @@ -975,10 +975,24 @@
>     if(connection->reqte != TE_IDENTITY)
>         goto fail;
>
> -    if(connection->bodylen < 0)
> -        goto fail;
> -
> -    if(connection->bodylen + connection->reqbegin < connection->reqlen) {
> +    if(connection->bodylen < 0) {
> +        /* We don't know the body length, either because the request
> +           was unparseable, or because it was something that doesn't
> +           carry a Content-Length (e.g. CONNECT).  We want to do the
> +           right thing in the latter case, but don't care much about
> +           the former.  So we simply shut the connection down as soon
> +           as we see any data coming after the headers. */
> +        /* reqlen = -2 is used by DiscardHandler to signal that we
> +           should shut down. */
> +        if(connection->bodylen == -2)
> +            goto fail;
> +        if(connection->reqlen > connection->reqbegin)
> +            goto fail;
> +        connection->reqbegin = 0;
> +        connection->reqlen = 0;
> +        httpConnectionDestroyReqbuf(connection);
> +        /* httpClientDiscardHander will call us back. */
> +    } else if(connection->bodylen + connection->reqbegin <
> connection->reqlen)
> {
>         connection->reqbegin += connection->bodylen;
>         connection->bodylen = 0;
>     } else {
> @@ -1074,7 +1088,7 @@
>     if(status) {
>         if(status < 0 && status != -EPIPE)
>             do_log_error(L_ERROR, -status, "Couldn't read from client");
> -        connection->bodylen = -1;
> +        connection->bodylen = -2;
>         return httpClientDiscardBody(connection);
>     }
>
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users

Reply via email to