Skip to content

Commit

Permalink
Update RCTSRWebSocket.m (#29419)
Browse files Browse the repository at this point in the history
Summary:
Only add Sec-WebSocket-Protocol header if has _requestedProtocols.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->

[iOS] [Fixed] - when Sec-WebSocket-Protocol header is empty vaulue, IIS server will return error 502.

Pull Request resolved: #29419

Reviewed By: cpojer

Differential Revision: D22782867

Pulled By: PeteTheHeat

fbshipit-source-id: d588997a345929b0c11c554d4452e612a336901a
  • Loading branch information
bill2004158 authored and facebook-github-bot committed Jul 28, 2020
1 parent 1b362f9 commit fd85b84
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/WebSocket/RCTSRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,7 @@ - (void)didConnect

CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Origin"), (__bridge CFStringRef)_url.RCTSR_origin);

if (_requestedProtocols) {
if (_requestedProtocols && _requestedProtocols.count > 0) {
CFHTTPMessageSetHeaderFieldValue(request, CFSTR("Sec-WebSocket-Protocol"), (__bridge CFStringRef)[_requestedProtocols componentsJoinedByString:@", "]);
}

Expand Down

0 comments on commit fd85b84

Please sign in to comment.