The fix in http://www.cups.org/str.php?L4187 is not complete. It misses the case where the server terminates the connection. recv() then does not return with an error but returns 0 (EOF). The last case is missed.
Here is a modified patch (to apply instead that one of L4187) which solves the issue:
--- ../request.c.orig 2013-04-22 13:48:31.409721696 +0200
+++ cups/request.c 2013-04-22 13:47:15.261963227 +0200
@@ -1004,6 +1004,26 @@ httpClose(cg->http);
cg->http = NULL;
}
+ else
+ {
+ /*
+ * Same server, see if the connection is still established...
+ */
+
+ char ch; /* Connection check byte */
+ int n;
+
+ if ( (n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) == 0) ||
+ ( n < 0 && errno != EWOULDBLOCK ) )
+ {
+ /*
+ * Nope, close the connection...
+ */
+
+ httpClose(cg->http);
+ cg->http = NULL;
+ }
+ }
}
The fix in http:// www.cups. org/str. php?L4187 is not complete. It misses the case where the server terminates the connection. recv() then does not return with an error but returns 0 (EOF). The last case is missed.
Here is a modified patch (to apply instead that one of L4187) which solves the issue:
--- ../request.c.orig 2013-04-22 13:48:31.409721696 +0200
httpClose( cg->http) ; cg->http) ;
+++ cups/request.c 2013-04-22 13:47:15.261963227 +0200
@@ -1004,6 +1004,26 @@
cg->http = NULL;
}
+ else
+ {
+ /*
+ * Same server, see if the connection is still established...
+ */
+
+ char ch; /* Connection check byte */
+ int n;
+
+ if ( (n = recv(cg->http->fd, &ch, 1, MSG_PEEK | MSG_DONTWAIT) == 0) ||
+ ( n < 0 && errno != EWOULDBLOCK ) )
+ {
+ /*
+ * Nope, close the connection...
+ */
+
+ httpClose(
+ cg->http = NULL;
+ }
+ }
}
/*