File tree Expand file tree Collapse file tree 3 files changed +24
-2
lines changed
src/main/java/org/red5/net/websocket Expand file tree Collapse file tree 3 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 99 <artifactId >websocket</artifactId >
1010 <packaging >jar</packaging >
1111 <name >websocket</name >
12- <version >1.9 </version >
12+ <version >1.10 </version >
1313 <description >Red5 WebSocket plugin</description >
1414 <url >https://github.com/Red5/red5-websocket</url >
1515 <organization >
Original file line number Diff line number Diff line change @@ -46,6 +46,12 @@ public class Constants {
4646 public final static String HTTP_HEADER_ORIGIN = "Origin" ;
4747
4848 public final static String HTTP_HEADER_USERAGENT = "User-Agent" ;
49+
50+ public final static String WS_HEADER_FORWARDED = "X-Forwarded-For" ;
51+
52+ public final static String WS_HEADER_REAL_IP = "X-Real-IP" ;
53+
54+ public final static String WS_HEADER_GENERIC_PREFIX = "X-" ;
4955
5056 public static final String URI_QS_PARAMETERS = "querystring-parameters" ;
5157
Original file line number Diff line number Diff line change @@ -291,7 +291,7 @@ public void operationComplete(IoFuture future) {
291291 });
292292 throw new WebSocketException ("Handshake failed, missing plugin" );
293293 }
294- } else if (request [i ].contains (Constants .WS_HEADER_KEY )) {
294+ }else if (request [i ].contains (Constants .WS_HEADER_KEY )) {
295295 map .put (Constants .WS_HEADER_KEY , extractHeaderValue (request [i ]));
296296 } else if (request [i ].contains (Constants .WS_HEADER_VERSION )) {
297297 map .put (Constants .WS_HEADER_VERSION , extractHeaderValue (request [i ]));
@@ -307,10 +307,26 @@ public void operationComplete(IoFuture future) {
307307 conn .setOrigin (extractHeaderValue (request [i ]));
308308 } else if (request [i ].contains (Constants .HTTP_HEADER_USERAGENT )) {
309309 map .put (Constants .HTTP_HEADER_USERAGENT , extractHeaderValue (request [i ]));
310+ }else if (request [i ].startsWith (Constants .WS_HEADER_GENERIC_PREFIX )) {
311+ map .put (getHeaderName (request [i ]), extractHeaderValue (request [i ]));
310312 }
311313 }
312314 return map ;
313315 }
316+
317+
318+
319+ /**
320+ * Returns the trimmed header name.
321+ *
322+ * @param requestHeader
323+ * @return value
324+ */
325+ private String getHeaderName (String requestHeader ){
326+ return requestHeader .substring (0 , requestHeader .indexOf (':' )).trim ();
327+ }
328+
329+
314330
315331 /**
316332 * Returns the trimmed header value.
You can’t perform that action at this time.
0 commit comments