]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Flush and check output for errors after uncorking.
authorStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 17 Feb 2018 00:25:50 +0000 (01:25 +0100)
committerStephan Bosch <stephan.bosch@dovecot.fi>
Sat, 17 Feb 2018 14:49:41 +0000 (15:49 +0100)
Otherwise, a disconnection event may be missed.

src/lib-http/http-client-request.c

index d6dca2d89d0a66bb1846857a09030792b694ae3d..a1497b7c60d6b4d687d4d0a5799cd9a6a6b7636a 100644 (file)
@@ -1284,14 +1284,14 @@ static int http_client_request_send_real(struct http_client_request *req,
                                http_client_connection_start_request_timeout(req->conn);
                        conn->output_locked = FALSE;
                }
-               if (ret >= 0 && o_stream_flush(output) < 0) {
-                       *error_r = t_strdup_printf("flush(%s) failed: %s",
-                          o_stream_get_name(output),
-                          o_stream_get_error(output));
-                       ret = -1;
-               }
        }
-       o_stream_uncork(output);
+       if (ret >= 0 && o_stream_uncork_flush(output) < 0) {
+               *error_r = t_strdup_printf("flush(%s) failed: %s",
+                                          o_stream_get_name(output),
+                                          o_stream_get_error(output));
+               ret = -1;
+       }
+
        return ret;
 }