]> 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)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Mon, 12 Mar 2018 08:42:26 +0000 (10:42 +0200)
Otherwise, a disconnection event may be missed.

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

index c1bddf1f1c65ad9bf369f4e1e73688c6b6383bc8..3510f87a43e3fd39876d2db11afe510a53cbeb1c 100644 (file)
@@ -1285,14 +1285,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;
 }