Fabian Keil via curl-library <curl-library@cool.haxx.se> wrote on 2021-01-09:

> Fabian Keil via curl-library <curl-library@cool.haxx.se> wrote on 2021-01-08:
> 
> > using a curl binary built from git master 060658f634, test 1061
> > works reliably for me when valgrind is being used but is flaky
> > without it:
[...]
> The problem seems to be that curl is ignoring the authentication
> request.

The attached patch seems to work around the problem.
Busy-looping probably isn't the right solution, though.

> > I haven't executed the tests in a while so I'm not sure
> > if this is a new issue.
> 
> This does not appear to be a new issue. I tried a couple of
> past releases stopping in 2019 and the problem was present
> there as well. Finally with curl-7_65_0 the test hangs instead
> of failing.

I suspect the problem was introduced in 5113ad04240444 in 2017.
  
Fabian
From 7b26986f8cff7c0741bb14441967cc95b2ae2033 Mon Sep 17 00:00:00 2001
From: Fabian Keil <f...@fabiankeil.de>
Date: Sun, 10 Jan 2021 17:54:21 +0100
Subject: [PATCH] CONNECT(): try again if the socket buffer is drained

Works around test1061 being flaky on ElectroBSD.
---
 lib/http_proxy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/http_proxy.c b/lib/http_proxy.c
index b826e6fed..61bb87a3d 100644
--- a/lib/http_proxy.c
+++ b/lib/http_proxy.c
@@ -340,9 +340,11 @@ static CURLcode CONNECT(struct connectdata *conn,
         /* Read one byte at a time to avoid a race condition. Wait at most one
            second before looping to ensure continuous pgrsUpdates. */
         result = Curl_read(conn, tunnelsocket, &byte, 1, &gotbytes);
-        if(result == CURLE_AGAIN)
-          /* socket buffer drained, return */
-          return CURLE_OK;
+        if(result == CURLE_AGAIN) {
+          /* socket buffer drained, try again */
+          infof(data, "Socket buffer drained. Trying again\n");
+          continue;
+        }
 
         if(Curl_pgrsUpdate(conn))
           return CURLE_ABORTED_BY_CALLBACK;
-- 
2.30.0

Attachment: pgp8MV4G60WKB.pgp
Description: OpenPGP digital signature

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to