Skip to content

Commit

Permalink
Remove trailing slash from origin header if no port is specified (#22290
Browse files Browse the repository at this point in the history
)

Summary:
Fixes #16304

The standard format for origin HTTP headers does not allow a trailing slash. In order to not get warnings when connecting a websocket, I removed the trailing slash when generating the default origin HTTP header for the websocket connect request.

Release Notes:
----------
[Android] [Fixed] - Fixed default origin header for websocket connections to match the standard format (https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Origin) in WebSocketModule
Pull Request resolved: #22290

Differential Revision: D13374345

Pulled By: cpojer

fbshipit-source-id: 1173241f2b6912fd6df5e196053a950bb42ff01b
  • Loading branch information
Lea Bärtschi authored and kelset committed Dec 12, 2018
1 parent ba50151 commit f7e3def
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ private static String getDefaultOrigin(String uri) {
requestURI.getHost(),
requestURI.getPort());
} else {
defaultOrigin = String.format("%s://%s/", scheme, requestURI.getHost());
defaultOrigin = String.format("%s://%s", scheme, requestURI.getHost());
}

return defaultOrigin;
Expand Down

0 comments on commit f7e3def

Please sign in to comment.