]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
haproxy: send though next filter
authorStefan Eissing <stefan@eissing.org>
Mon, 2 Sep 2024 11:29:54 +0000 (13:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 2 Sep 2024 21:34:26 +0000 (23:34 +0200)
Small but, instead of sending the initial data though the connection
method, send it to the next filter in the chain. While the connection
methods accomodates for such use, by ignoring unconnected filters, it is
better to follow the filter chain explicitly.

Closes #14756

lib/cf-haproxy.c

index 4b59909024ef6f5b0ff16ce48e5057209a84f6ac..0fc7625c44b49eac9473391ded314cb1e372cd4b 100644 (file)
@@ -131,17 +131,17 @@ static CURLcode cf_haproxy_connect(struct Curl_cfilter *cf,
   case HAPROXY_SEND:
     len = Curl_dyn_len(&ctx->data_out);
     if(len > 0) {
-      size_t written;
-      result = Curl_conn_send(data, cf->sockindex,
-                              Curl_dyn_ptr(&ctx->data_out),
-                              len, FALSE, &written);
-      if(result == CURLE_AGAIN) {
+      ssize_t nwritten;
+      nwritten = Curl_conn_cf_send(cf->next, data,
+                                   Curl_dyn_ptr(&ctx->data_out), len, FALSE,
+                                   &result);
+      if(nwritten < 0) {
+        if(result != CURLE_AGAIN)
+          goto out;
         result = CURLE_OK;
-        written = 0;
+        nwritten = 0;
       }
-      else if(result)
-        goto out;
-      Curl_dyn_tail(&ctx->data_out, len - written);
+      Curl_dyn_tail(&ctx->data_out, len - (size_t)nwritten);
       if(Curl_dyn_len(&ctx->data_out) > 0) {
         result = CURLE_OK;
         goto out;