Established listening socket on port 8123.
Couldn't send request to server: Immediate shutdown requested
Restarting pipeline to groups.google.com:80.
Restarting pipeline to groups.google.com:80.
Couldn't send request to server: Immediate shutdown requested
==24601== Invalid read of size 8
==24601==    at 0x416084: httpServerFinish (server.c:1157)
==24601==    by 0x41889D: httpServerDelayedFinishHandler (server.c:1332)
==24601==    by 0x403792: runTimeEventQueue (event.c:492)
==24601==    by 0x403E47: eventLoop (event.c:659)
==24601==    by 0x40D763: main (main.c:165)
==24601==  Address 0x541be98 is 24 bytes inside a block of size 120 free'd
==24601==    at 0x4C22B2E: free (vg_replace_malloc.c:323)
==24601==    by 0x4165AE: httpServerFinish (server.c:1303)
==24601==    by 0x416FBC: httpServerHandler (server.c:1729)
==24601==    by 0x405C5D: do_scheduled_stream (io.c:368)
==24601==    by 0x40413D: pokeFdEventHandler (event.c:569)
==24601==    by 0x403792: runTimeEventQueue (event.c:492)
==24601==    by 0x403E47: eventLoop (event.c:659)
==24601==    by 0x40D763: main (main.c:165)

Proposed fix:

diff --git a/http.c b/http.c
index db35bbf..40f3762 100644
--- a/http.c
+++ b/http.c
@@ -573,6 +573,7 @@ httpMakeConnection()
     connection->pipelined = 0;
     connection->connecting = 0;
     connection->server = NULL;
+    connection->finishing = NULL;
     return connection;
 }
 
diff --git a/http.h b/http.h
index d562816..35b3388 100644
--- a/http.h
+++ b/http.h
@@ -80,6 +80,7 @@ typedef struct _HTTPConnection {
     struct _HTTPServer *server;
     int pipelined;
     int connecting;
+    TimeEventHandlerPtr finishing;
 } HTTPConnectionRec, *HTTPConnectionPtr;
 
 /* connection->flags */
diff --git a/server.c b/server.c
index 6dbe05f..ead193f 100644
--- a/server.c
+++ b/server.c
@@ -1260,6 +1260,9 @@ httpServerFinish(HTTPConnectionPtr connection, int s, int 
offset)
         if(connection->timeout)
             cancelTimeEvent(connection->timeout);
         connection->timeout = NULL;
+        if(connection->finishing)
+            cancelTimeEvent(connection->finishing);
+        connection->finishing = NULL;
         httpConnectionDestroyBuf(connection);
         if(connection->fd >= 0)
             CLOSE(connection->fd);
@@ -1329,6 +1332,7 @@ static int
 httpServerDelayedFinishHandler(TimeEventHandlerPtr event)
 {
     HTTPConnectionPtr connection = *(HTTPConnectionPtr*)event->data;
+    connection->finishing = NULL;
     httpServerFinish(connection, 1, 0);
     return 1;
 }
@@ -1352,6 +1356,8 @@ httpServerDelayedFinish(HTTPConnectionPtr connection)
             polipoExit();
         }
     }
+
+    connection->finishing = handler;
 }
 
 void



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Polipo-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/polipo-users

Reply via email to