]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
http2: provide an error callback and failf the message
authorDaniel Stenberg <daniel@haxx.se>
Sun, 22 Oct 2023 09:22:08 +0000 (11:22 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 23 Oct 2023 10:34:12 +0000 (12:34 +0200)
Getting nghttp2's error message helps users understand what's going
on. For example when the connection is brought down due a forbidden
header is used - as that header is then not displayed by curl itself.

Example:

  curl: (92) Invalid HTTP header field was received: frame type: 1,
  stream: 1, name: [upgrade], value: [h2,h2c]

Ref: #12172
Closes #12179

lib/http2.c

index d4fcb26531fb4059b07cc1d03ba0b8e6119403bc..a989280f3e050a7d42f2fe561849ccb9cd75c0b1 100644 (file)
@@ -1607,10 +1607,10 @@ static int error_callback(nghttp2_session *session,
                           size_t len,
                           void *userp)
 {
+  struct Curl_cfilter *cf = userp;
+  struct Curl_easy *data = CF_DATA_CURRENT(cf);
   (void)session;
-  (void)msg;
-  (void)len;
-  (void)userp;
+  failf(data, "%.*s", (int)len, msg);
   return 0;
 }
 #endif