Line 0
Link Here
|
|
|
1 |
--- ./outgoing.c.orig 2014-04-21 16:56:02.000000000 +0200 |
2 |
+++ ./outgoing.c 2014-06-07 22:20:27.000000000 +0200 |
3 |
@@ -23,6 +23,13 @@ |
4 |
|
5 |
#include "serf_private.h" |
6 |
|
7 |
+/* Some implementations -like Windows- report some hangup errors via a |
8 |
+ different event than the specific HUP event. */ |
9 |
+#define APR_STATUS_IMPLIES_HANGUP(status) \ |
10 |
+ (APR_STATUS_IS_ECONNRESET(status) || \ |
11 |
+ APR_STATUS_IS_ECONNABORTED(status) || \ |
12 |
+ status == SERF_ERROR_REQUEST_LOST) |
13 |
+ |
14 |
/* cleanup for sockets */ |
15 |
static apr_status_t clean_skt(void *data) |
16 |
{ |
17 |
@@ -922,8 +929,12 @@ |
18 |
request->handler_baton, |
19 |
pool); |
20 |
|
21 |
- if (SERF_BUCKET_READ_ERROR(status)) { |
22 |
- /* Report the request as 'died'/'cancelled' to the application */ |
23 |
+ if (SERF_BUCKET_READ_ERROR(status) |
24 |
+ && !APR_STATUS_IMPLIES_HANGUP(status)) { |
25 |
+ |
26 |
+ /* Report the request as 'died'/'cancelled' to the application, |
27 |
+ but only if our caller doesn't handle this status specifically, |
28 |
+ with something like a retry */ |
29 |
(void)(*request->handler)(request, |
30 |
NULL, |
31 |
request->handler_baton, |
32 |
@@ -1128,10 +1139,12 @@ |
33 |
|
34 |
/* Some systems will not generate a HUP poll event so we have to |
35 |
* handle the ECONNRESET issue and ECONNABORT here. |
36 |
+ * |
37 |
+ * ### Update similar code in handle_response() if this condition |
38 |
+ * changes, or requests will get lost and/or accidentally reported |
39 |
+ * cancelled. |
40 |
*/ |
41 |
- if (APR_STATUS_IS_ECONNRESET(status) || |
42 |
- APR_STATUS_IS_ECONNABORTED(status) || |
43 |
- status == SERF_ERROR_REQUEST_LOST) { |
44 |
+ if (APR_STATUS_IMPLIES_HANGUP(status)) { |
45 |
/* If the connection had ever been good, be optimistic & try again. |
46 |
* If it has never tried again (incl. a retry), fail. |
47 |
*/ |