--------------------- PatchSet 1913 Date: 2005/10/01 04:30:59 Author: dwsquid Branch: squid3-icap Tag: (none) Log: Added 'state.wroteHeaders' to ICAPXaction. After eventAdd() fix, writeBody() was being called before connection was completed. Members: src/ICAPXaction.cc:1.1.2.37->1.1.2.38 src/ICAPXaction.h:1.1.2.19->1.1.2.20 Index: squid3/src/ICAPXaction.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.cc,v retrieving revision 1.1.2.37 retrieving revision 1.1.2.38 diff -u -r1.1.2.37 -r1.1.2.38 --- squid3/src/ICAPXaction.cc 30 Sep 2005 21:58:14 -0000 1.1.2.37 +++ squid3/src/ICAPXaction.cc 1 Oct 2005 04:30:59 -0000 1.1.2.38 @@ -189,6 +189,7 @@ closer = &ICAPXaction_noteCommClose; comm_add_close_handler(connection, closer, this); debug(93,3)("ICAPXaction::openConnection() to %s %d\n", service->host.buf(), service->port); + state.wroteHeaders = 0; commConnectStart(connection, service->host.buf(), service->port, &ICAPXaction_noteCommConnected, this); } @@ -214,6 +215,7 @@ // connection with the ICAP service established void ICAPXaction::noteCommConnected(comm_err_t status) { + debug(93,3)("ICAPXaction::noteCommConnected() called\n"); ICAPXaction_Enter(noteCommConnected); Must(status == COMM_OK); @@ -239,6 +241,7 @@ writer = NULL; Must(status == COMM_OK); + state.wroteHeaders = 1; writeMoreBody(); ICAPXaction_Exit(noteCommWroteHeaders); @@ -246,7 +249,7 @@ void ICAPXaction::writeMoreBody() { - if (writer || state.doneWriting) + if (writer || state.doneWriting || !state.wroteHeaders) return; if (!expectVirginBody()) { Index: squid3/src/ICAPXaction.h =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/Attic/ICAPXaction.h,v retrieving revision 1.1.2.19 retrieving revision 1.1.2.20 diff -u -r1.1.2.19 -r1.1.2.20 --- squid3/src/ICAPXaction.h 29 Sep 2005 18:00:44 -0000 1.1.2.19 +++ squid3/src/ICAPXaction.h 1 Oct 2005 04:30:59 -0000 1.1.2.20 @@ -1,6 +1,6 @@ /* - * $Id: ICAPXaction.h,v 1.1.2.19 2005/09/29 18:00:44 dwsquid Exp $ + * $Id: ICAPXaction.h,v 1.1.2.20 2005/10/01 04:30:59 dwsquid Exp $ * * * SQUID Web Proxy Cache http://www.squid-cache.org/ @@ -164,6 +164,9 @@ public: + unsigned wroteHeaders: + 1; // ICAP headers have been written + unsigned inCall: 1; // processing an asynchronous call (e.g., comm read callback)