@@ -61,6 +61,7 @@ static void fireHandshakeValidationStartAndError(
6161 Http2WebSocketEvent .fireHandshakeStartAndError (
6262 parentChannel ,
6363 streamId ,
64+ nonNullString (headers .authority ()),
6465 nonNullString (headers .path ()),
6566 nonNullString (headers .get (Http2WebSocketProtocol .HEADER_WEBSOCKET_SUBPROTOCOL_NAME )),
6667 headers ,
@@ -73,6 +74,7 @@ static void fireHandshakeValidationStartAndError(
7374 static void fireHandshakeStartAndError (
7475 Channel parentChannel ,
7576 int serial ,
77+ String authority ,
7678 String path ,
7779 String subprotocols ,
7880 Http2Headers requestHeaders ,
@@ -83,14 +85,17 @@ static void fireHandshakeStartAndError(
8385 if (t instanceof Exception ) {
8486 parentPipeline .fireUserEventTriggered (
8587 new Http2WebSocketHandshakeStartEvent (
86- serial , path , subprotocols , startNanos , requestHeaders ));
88+ serial , authority , path , subprotocols , startNanos , requestHeaders ));
8789 parentPipeline .fireUserEventTriggered (
88- new WebSocketHandshakeStartEvent (serial , path , subprotocols , startNanos , requestHeaders ));
90+ new WebSocketHandshakeStartEvent (
91+ serial , authority , path , subprotocols , startNanos , requestHeaders ));
8992
9093 parentPipeline .fireUserEventTriggered (
91- new Http2WebSocketHandshakeErrorEvent (serial , path , subprotocols , errorNanos , null , t ));
94+ new Http2WebSocketHandshakeErrorEvent (
95+ serial , authority , path , subprotocols , errorNanos , null , t ));
9296 parentPipeline .fireUserEventTriggered (
93- new WebSocketHandshakeErrorEvent (serial , path , subprotocols , errorNanos , null , t ));
97+ new WebSocketHandshakeErrorEvent (
98+ serial , authority , path , subprotocols , errorNanos , null , t ));
9499 return ;
95100 }
96101 parentPipeline .fireExceptionCaught (t );
@@ -99,6 +104,7 @@ static void fireHandshakeStartAndError(
99104 static void fireHandshakeStartAndError (
100105 Channel parentChannel ,
101106 int serial ,
107+ String authority ,
102108 String path ,
103109 String subprotocols ,
104110 Http2Headers requestHeaders ,
@@ -110,21 +116,23 @@ static void fireHandshakeStartAndError(
110116
111117 parentPipeline .fireUserEventTriggered (
112118 new Http2WebSocketHandshakeStartEvent (
113- serial , path , subprotocols , startNanos , requestHeaders ));
119+ serial , authority , path , subprotocols , startNanos , requestHeaders ));
114120 parentPipeline .fireUserEventTriggered (
115- new WebSocketHandshakeStartEvent (serial , path , subprotocols , startNanos , requestHeaders ));
121+ new WebSocketHandshakeStartEvent (
122+ serial , authority , path , subprotocols , startNanos , requestHeaders ));
116123
117124 parentPipeline .fireUserEventTriggered (
118125 new Http2WebSocketHandshakeErrorEvent (
119- serial , path , subprotocols , errorNanos , null , errorName , errorMessage ));
126+ serial , authority , path , subprotocols , errorNanos , null , errorName , errorMessage ));
120127 parentPipeline .fireUserEventTriggered (
121128 new WebSocketHandshakeErrorEvent (
122- serial , path , subprotocols , errorNanos , null , errorName , errorMessage ));
129+ serial , authority , path , subprotocols , errorNanos , null , errorName , errorMessage ));
123130 }
124131
125132 static void fireHandshakeStartAndSuccess (
126133 Http2WebSocketChannel webSocketChannel ,
127134 int serial ,
135+ String authority ,
128136 String path ,
129137 String subprotocols ,
130138 String subprotocol ,
@@ -137,15 +145,16 @@ static void fireHandshakeStartAndSuccess(
137145
138146 Http2WebSocketHandshakeStartEvent http2StartEvent =
139147 new Http2WebSocketHandshakeStartEvent (
140- serial , path , subprotocols , startNanos , requestHeaders );
148+ serial , authority , path , subprotocols , startNanos , requestHeaders );
141149 WebSocketHandshakeStartEvent startEvent =
142- new WebSocketHandshakeStartEvent (serial , path , subprotocols , startNanos , requestHeaders );
150+ new WebSocketHandshakeStartEvent (
151+ serial , authority , path , subprotocols , startNanos , requestHeaders );
143152 Http2WebSocketHandshakeSuccessEvent http2SuccessEvent =
144153 new Http2WebSocketHandshakeSuccessEvent (
145- serial , path , subprotocols , subprotocol , successNanos , responseHeaders );
154+ serial , authority , path , subprotocols , subprotocol , successNanos , responseHeaders );
146155 WebSocketHandshakeSuccessEvent successEvent =
147156 new WebSocketHandshakeSuccessEvent (
148- serial , path , subprotocols , subprotocol , successNanos , responseHeaders );
157+ serial , authority , path , subprotocols , subprotocol , successNanos , responseHeaders );
149158
150159 parentPipeline .fireUserEventTriggered (http2StartEvent );
151160 parentPipeline .fireUserEventTriggered (startEvent );
@@ -163,15 +172,17 @@ static void fireHandshakeStart(
163172 ChannelPipeline parentPipeline = webSocketChannel .parent ().pipeline ();
164173 ChannelPipeline webSocketPipeline = webSocketChannel .pipeline ();
165174 int serial = webSocketChannel .serial ();
175+ String authority = webSocketChannel .authority ();
166176 String path = webSocketChannel .path ();
167177 String subprotocol = webSocketChannel .subprotocol ();
168178
169179 Http2WebSocketHandshakeStartEvent http2StartEvent =
170180 new Http2WebSocketHandshakeStartEvent (
171- serial , path , subprotocol , timestampNanos , requestHeaders );
181+ serial , authority , path , subprotocol , timestampNanos , requestHeaders );
172182
173183 WebSocketHandshakeStartEvent startEvent =
174- new WebSocketHandshakeStartEvent (serial , path , subprotocol , timestampNanos , requestHeaders );
184+ new WebSocketHandshakeStartEvent (
185+ serial , authority , path , subprotocol , timestampNanos , requestHeaders );
175186
176187 parentPipeline .fireUserEventTriggered (http2StartEvent );
177188 parentPipeline .fireUserEventTriggered (startEvent );
@@ -188,17 +199,18 @@ static void fireHandshakeError(
188199
189200 if (t instanceof Exception ) {
190201 ChannelPipeline webSocketPipeline = webSocketChannel .pipeline ();
202+ String authority = webSocketChannel .authority ();
191203 String path = webSocketChannel .path ();
192204 int serial = webSocketChannel .serial ();
193205 String subprotocol = webSocketChannel .subprotocol ();
194206
195207 Http2WebSocketHandshakeErrorEvent http2ErrorEvent =
196208 new Http2WebSocketHandshakeErrorEvent (
197- serial , path , subprotocol , timestampNanos , responseHeaders , t );
209+ serial , authority , path , subprotocol , timestampNanos , responseHeaders , t );
198210
199211 WebSocketHandshakeErrorEvent errorEvent =
200212 new WebSocketHandshakeErrorEvent (
201- serial , path , subprotocol , timestampNanos , responseHeaders , t );
213+ serial , authority , path , subprotocol , timestampNanos , responseHeaders , t );
202214
203215 parentPipeline .fireUserEventTriggered (http2ErrorEvent );
204216 parentPipeline .fireUserEventTriggered (errorEvent );
@@ -213,17 +225,18 @@ static void fireHandshakeSuccess(
213225 Http2WebSocketChannel webSocketChannel , Http2Headers responseHeaders , long timestampNanos ) {
214226 ChannelPipeline parentPipeline = webSocketChannel .parent ().pipeline ();
215227 ChannelPipeline webSocketPipeline = webSocketChannel .pipeline ();
228+ String authority = webSocketChannel .authority ();
216229 String path = webSocketChannel .path ();
217230 String subprotocol = webSocketChannel .subprotocol ();
218231 int serial = webSocketChannel .serial ();
219232
220233 Http2WebSocketHandshakeSuccessEvent http2SuccessEvent =
221234 new Http2WebSocketHandshakeSuccessEvent (
222- serial , path , subprotocol , subprotocol , timestampNanos , responseHeaders );
235+ serial , authority , path , subprotocol , subprotocol , timestampNanos , responseHeaders );
223236
224237 WebSocketHandshakeSuccessEvent successEvent =
225238 new WebSocketHandshakeSuccessEvent (
226- serial , path , subprotocol , subprotocol , timestampNanos , responseHeaders );
239+ serial , authority , path , subprotocol , subprotocol , timestampNanos , responseHeaders );
227240
228241 parentPipeline .fireUserEventTriggered (http2SuccessEvent );
229242 parentPipeline .fireUserEventTriggered (successEvent );
@@ -282,14 +295,21 @@ public Throwable error() {
282295 /** Base type for websocket-over-http2 lifecycle events */
283296 public static class Http2WebSocketLifecycleEvent extends Http2WebSocketEvent {
284297 private final int id ;
298+ private final String authority ;
285299 private final String path ;
286300 private final String subprotocols ;
287301 private final long timestampNanos ;
288302
289303 Http2WebSocketLifecycleEvent (
290- Type type , int id , String path , String subprotocols , long timestampNanos ) {
304+ Type type ,
305+ int id ,
306+ String authority ,
307+ String path ,
308+ String subprotocols ,
309+ long timestampNanos ) {
291310 super (type );
292311 this .id = id ;
312+ this .authority = authority ;
293313 this .path = path ;
294314 this .subprotocols = subprotocols ;
295315 this .timestampNanos = timestampNanos ;
@@ -300,6 +320,11 @@ public int id() {
300320 return id ;
301321 }
302322
323+ /** @return websocket authority */
324+ public String authority () {
325+ return authority ;
326+ }
327+
303328 /** @return websocket path */
304329 public String path () {
305330 return path ;
@@ -321,8 +346,13 @@ public static class Http2WebSocketHandshakeStartEvent extends Http2WebSocketLife
321346 private final Http2Headers requestHeaders ;
322347
323348 Http2WebSocketHandshakeStartEvent (
324- int id , String path , String subprotocol , long timestampNanos , Http2Headers requestHeaders ) {
325- super (Type .HANDSHAKE_START , id , path , subprotocol , timestampNanos );
349+ int id ,
350+ String authority ,
351+ String path ,
352+ String subprotocol ,
353+ long timestampNanos ,
354+ Http2Headers requestHeaders ) {
355+ super (Type .HANDSHAKE_START , id , authority , path , subprotocol , timestampNanos );
326356 this .requestHeaders = requestHeaders ;
327357 }
328358
@@ -341,35 +371,47 @@ public static class Http2WebSocketHandshakeErrorEvent extends Http2WebSocketLife
341371
342372 Http2WebSocketHandshakeErrorEvent (
343373 int id ,
374+ String authority ,
344375 String path ,
345376 String subprotocols ,
346377 long timestampNanos ,
347378 Http2Headers responseHeaders ,
348379 Throwable error ) {
349- this (id , path , subprotocols , timestampNanos , responseHeaders , error , null , null );
380+ this (id , authority , path , subprotocols , timestampNanos , responseHeaders , error , null , null );
350381 }
351382
352383 Http2WebSocketHandshakeErrorEvent (
353384 int id ,
385+ String authority ,
354386 String path ,
355387 String subprotocols ,
356388 long timestampNanos ,
357389 Http2Headers responseHeaders ,
358390 String errorName ,
359391 String errorMessage ) {
360- this (id , path , subprotocols , timestampNanos , responseHeaders , null , errorName , errorMessage );
392+ this (
393+ id ,
394+ authority ,
395+ path ,
396+ subprotocols ,
397+ timestampNanos ,
398+ responseHeaders ,
399+ null ,
400+ errorName ,
401+ errorMessage );
361402 }
362403
363404 private Http2WebSocketHandshakeErrorEvent (
364405 int id ,
406+ String authority ,
365407 String path ,
366408 String subprotocols ,
367409 long timestampNanos ,
368410 Http2Headers responseHeaders ,
369411 Throwable error ,
370412 String errorName ,
371413 String errorMessage ) {
372- super (Type .HANDSHAKE_ERROR , id , path , subprotocols , timestampNanos );
414+ super (Type .HANDSHAKE_ERROR , id , authority , path , subprotocols , timestampNanos );
373415 this .responseHeaders = responseHeaders ;
374416 this .errorName = errorName ;
375417 this .errorMessage = errorMessage ;
@@ -414,12 +456,13 @@ public static class Http2WebSocketHandshakeSuccessEvent extends Http2WebSocketLi
414456
415457 Http2WebSocketHandshakeSuccessEvent (
416458 int id ,
459+ String authority ,
417460 String path ,
418461 String subprotocols ,
419462 String subprotocol ,
420463 long timestampNanos ,
421464 Http2Headers responseHeaders ) {
422- super (Type .HANDSHAKE_SUCCESS , id , path , subprotocols , timestampNanos );
465+ super (Type .HANDSHAKE_SUCCESS , id , authority , path , subprotocols , timestampNanos );
423466 this .subprotocol = subprotocol ;
424467 this .responseHeaders = responseHeaders ;
425468 }
@@ -441,20 +484,25 @@ public Http2Headers responseHeaders() {
441484 */
442485 public static class Http2WebSocketRemoteCloseEvent extends Http2WebSocketLifecycleEvent {
443486 private Http2WebSocketRemoteCloseEvent (
444- Type type , int id , String path , String subprotocols , long timestampNanos ) {
445- super (type , id , path , subprotocols , timestampNanos );
487+ Type type ,
488+ int id ,
489+ String authority ,
490+ String path ,
491+ String subprotocols ,
492+ long timestampNanos ) {
493+ super (type , id , authority , path , subprotocols , timestampNanos );
446494 }
447495
448496 static Http2WebSocketRemoteCloseEvent endStream (
449- int id , String path , String subprotocols , long timestampNanos ) {
497+ int id , String authority , String path , String subprotocols , long timestampNanos ) {
450498 return new Http2WebSocketRemoteCloseEvent (
451- Type .CLOSE_REMOTE_ENDSTREAM , id , path , subprotocols , timestampNanos );
499+ Type .CLOSE_REMOTE_ENDSTREAM , id , authority , path , subprotocols , timestampNanos );
452500 }
453501
454502 static Http2WebSocketRemoteCloseEvent reset (
455- int id , String path , String subprotocols , long timestampNanos ) {
503+ int id , String authority , String path , String subprotocols , long timestampNanos ) {
456504 return new Http2WebSocketRemoteCloseEvent (
457- Type .CLOSE_REMOTE_RESET , id , path , subprotocols , timestampNanos );
505+ Type .CLOSE_REMOTE_RESET , id , authority , path , subprotocols , timestampNanos );
458506 }
459507 }
460508
@@ -463,8 +511,13 @@ public static class Http2WebSocketRemoteGoAwayEvent extends Http2WebSocketLifecy
463511 private final long errorCode ;
464512
465513 Http2WebSocketRemoteGoAwayEvent (
466- int id , String path , String subprotocol , long timestampNanos , long errorCode ) {
467- super (Type .CLOSE_REMOTE_GOAWAY , id , path , subprotocol , timestampNanos );
514+ int id ,
515+ String authority ,
516+ String path ,
517+ String subprotocol ,
518+ long timestampNanos ,
519+ long errorCode ) {
520+ super (Type .CLOSE_REMOTE_GOAWAY , id , authority , path , subprotocol , timestampNanos );
468521 this .errorCode = errorCode ;
469522 }
470523
0 commit comments