File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -190,11 +190,13 @@ constexpr size_t kFsStatsBufferLength = kFsStatsFieldsNumber * 2;
190
190
V (get_data_clone_error_string, " _getDataCloneError" ) \
191
191
V (get_shared_array_buffer_id_string, " _getSharedArrayBufferId" ) \
192
192
V (gid_string, " gid" ) \
193
+ V (h2_string, " h2" ) \
193
194
V (handle_string, " handle" ) \
194
195
V (help_text_string, " helpText" ) \
195
196
V (homedir_string, " homedir" ) \
196
197
V (host_string, " host" ) \
197
198
V (hostmaster_string, " hostmaster" ) \
199
+ V (http_1_1_string, " http/1.1" ) \
198
200
V (ignore_string, " ignore" ) \
199
201
V (infoaccess_string, " infoAccess" ) \
200
202
V (inherit_string, " inherit" ) \
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ using v8::DontDelete;
65
65
using v8::EscapableHandleScope;
66
66
using v8::Exception;
67
67
using v8::External;
68
+ using v8::False;
68
69
using v8::Function;
69
70
using v8::FunctionCallback;
70
71
using v8::FunctionCallbackInfo;
@@ -2503,11 +2504,20 @@ void SSLWrap<Base>::GetALPNNegotiatedProto(
2503
2504
2504
2505
SSL_get0_alpn_selected (w->ssl_ .get (), &alpn_proto, &alpn_proto_len);
2505
2506
2506
- if (!alpn_proto)
2507
- return args.GetReturnValue ().Set (false );
2507
+ Local<Value> result;
2508
+ if (alpn_proto_len == 0 ) {
2509
+ result = False (args.GetIsolate ());
2510
+ } else if (alpn_proto_len == sizeof (" h2" ) - 1 &&
2511
+ 0 == memcmp (alpn_proto, " h2" , sizeof (" h2" ) - 1 )) {
2512
+ result = w->env ()->h2_string ();
2513
+ } else if (alpn_proto_len == sizeof (" http/1.1" ) - 1 &&
2514
+ 0 == memcmp (alpn_proto, " http/1.1" , sizeof (" http/1.1" ) - 1 )) {
2515
+ result = w->env ()->http_1_1_string ();
2516
+ } else {
2517
+ result = OneByteString (args.GetIsolate (), alpn_proto, alpn_proto_len);
2518
+ }
2508
2519
2509
- args.GetReturnValue ().Set (
2510
- OneByteString (args.GetIsolate (), alpn_proto, alpn_proto_len));
2520
+ args.GetReturnValue ().Set (result);
2511
2521
}
2512
2522
2513
2523
You can’t perform that action at this time.
0 commit comments