]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
c-hyper: make CURLE_GOT_NOTHING work
authorDaniel Stenberg <daniel@haxx.se>
Mon, 4 Jan 2021 15:55:30 +0000 (16:55 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Tue, 5 Jan 2021 08:38:25 +0000 (09:38 +0100)
Test 30

Closes #6407

lib/c-hyper.c

index 3a81db95f64bbb3780f99649f31454804849aede..9ee17e3f8e3430135173dc0185ae06af14fa624a 100644 (file)
@@ -318,8 +318,12 @@ CURLcode Curl_hyper_stream(struct Curl_easy *data,
       else {
         uint8_t errbuf[256];
         size_t errlen = hyper_error_print(hypererr, errbuf, sizeof(errbuf));
-        failf(data, "Hyper: %.*s", (int)errlen, errbuf);
-        result = CURLE_RECV_ERROR; /* not a very good return code */
+        hyper_code code = hyper_error_code(hypererr);
+        failf(data, "Hyper: [%d] %.*s", (int)code, (int)errlen, errbuf);
+        if((code == HYPERE_UNEXPECTED_EOF) && !data->req.bytecount)
+          result = CURLE_GOT_NOTHING;
+        else
+          result = CURLE_RECV_ERROR;
       }
       *done = TRUE;
       hyper_error_free(hypererr);
@@ -885,7 +889,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
   if(hypererr) {
     uint8_t errbuf[256];
     size_t errlen = hyper_error_print(hypererr, errbuf, sizeof(errbuf));
-    failf(data, "Hyper: %.*s", (int)errlen, errbuf);
+    hyper_code code = hyper_error_code(hypererr);
+    failf(data, "Hyper: [%d] %.*s", (int)code, (int)errlen, errbuf);
     hyper_error_free(hypererr);
   }
   return CURLE_OUT_OF_MEMORY;