summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-05-31 15:11:27 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-06-01 18:03:37 +0200
commit83036d86af2efaf57b9e722179f03604a873dc84 (patch)
treed3dd502b98361deae86867bdc4ee3b87ebef9dff
parentdddad339e8a56722babb5864b39a83f293f6491a (diff)
downloadcurl-83036d86af2efaf57b9e722179f03604a873dc84.tar.gz
c-hyper: fix NTLM on closed connection tested with test159
Closes #7154
-rw-r--r--lib/c-hyper.c12
-rw-r--r--lib/transfer.c11
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/c-hyper.c b/lib/c-hyper.c
index 0f307f3e8..4de93838d 100644
--- a/lib/c-hyper.c
+++ b/lib/c-hyper.c
@@ -166,6 +166,18 @@ static int hyper_body_chunk(void *userdata, const hyper_buf *chunk)
if(0 == k->bodywrites++) {
bool done = FALSE;
+#if defined(USE_NTLM)
+ struct connectdata *conn = data->conn;
+ if(conn->bits.close &&
+ (((data->req.httpcode == 401) &&
+ (conn->http_ntlm_state == NTLMSTATE_TYPE2)) ||
+ ((data->req.httpcode == 407) &&
+ (conn->proxy_ntlm_state == NTLMSTATE_TYPE2)))) {
+ infof(data, "Connection closed while negotiating NTLM\n");
+ data->state.authproblem = TRUE;
+ Curl_safefree(data->req.newurl);
+ }
+#endif
result = Curl_http_firstwrite(data, data->conn, &done);
if(result || done) {
infof(data, "Return early from hyper_body_chunk\n");
diff --git a/lib/transfer.c b/lib/transfer.c
index bca4e548f..3ea07c5e9 100644
--- a/lib/transfer.c
+++ b/lib/transfer.c
@@ -1212,8 +1212,12 @@ CURLcode Curl_readwrite(struct connectdata *conn,
}
#ifdef USE_HYPER
- if(conn->datastream)
- return conn->datastream(data, conn, &didwhat, done, select_res);
+ if(conn->datastream) {
+ result = conn->datastream(data, conn, &didwhat, done, select_res);
+ if(result || *done)
+ return result;
+ }
+ else {
#endif
/* We go ahead and do a read if we have a readable socket or if
the stream was rewound (in which case we have data in a
@@ -1232,6 +1236,9 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if(result)
return result;
}
+#ifdef USE_HYPER
+ }
+#endif
k->now = Curl_now();
if(!didwhat) {