GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — http2: improve nghttp2 error callback · nodejs/node@a4d6543

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src
    • node_http2.cc
    • node_http2.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/node_http2.cc‎

Copy file name to clipboardExpand all lines: src/node_http2.cc
+3-7Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,7 @@ Http2Session::Callbacks::Callbacks(bool kHasGetPaddingCallback) {
437437
callbacks_, OnFrameNotSent);
438438
nghttp2_session_callbacks_set_on_invalid_header_callback2(
439439
callbacks_, OnInvalidHeader);
440-
nghttp2_session_callbacks_set_error_callback(
441-
callbacks_, OnNghttpError);
440+
nghttp2_session_callbacks_set_error_callback2(callbacks_, OnNghttpError);
442441
nghttp2_session_callbacks_set_send_data_callback(
443442
callbacks_, OnSendData);
444443
nghttp2_session_callbacks_set_on_invalid_frame_recv_callback(
@@ -1257,21 +1256,18 @@ ssize_t Http2Session::OnSelectPadding(nghttp2_session* handle,
12571256
return padding;
12581257
}
12591258

1260-
#define BAD_PEER_MESSAGE "Remote peer returned unexpected data while we " \
1261-
"expected SETTINGS frame. Perhaps, peer does not " \
1262-
"support HTTP/2 properly."
1263-
12641259
// We use this currently to determine when an attempt is made to use the http2
12651260
// protocol with a non-http2 peer.
12661261
int Http2Session::OnNghttpError(nghttp2_session* handle,
1262+
int lib_error_code,
12671263
const char* message,
12681264
size_t len,
12691265
void* user_data) {
12701266
// Unfortunately, this is currently the only way for us to know if
12711267
// the session errored because the peer is not an http2 peer.
12721268
Http2Session* session = static_cast<Http2Session*>(user_data);
12731269
Debug(session, "Error '%s'", message);
1274-
if (strncmp(message, BAD_PEER_MESSAGE, len) == 0) {
1270+
if (lib_error_code == NGHTTP2_ERR_SETTINGS_EXPECTED) {
12751271
Environment* env = session->env();
12761272
Isolate* isolate = env->isolate();
12771273
HandleScope scope(isolate);
Collapse file

‎src/node_http2.h‎

Copy file name to clipboardExpand all lines: src/node_http2.h
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -843,11 +843,11 @@ class Http2Session : public AsyncWrap,
843843
const nghttp2_frame* frame,
844844
size_t maxPayloadLen,
845845
void* user_data);
846-
static int OnNghttpError(
847-
nghttp2_session* session,
848-
const char* message,
849-
size_t len,
850-
void* user_data);
846+
static int OnNghttpError(nghttp2_session* session,
847+
int lib_error_code,
848+
const char* message,
849+
size_t len,
850+
void* user_data);
851851
static int OnSendData(
852852
nghttp2_session* session,
853853
nghttp2_frame* frame,

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.