Browse files

ZTWebSocket should include any query string in the initial handshake …

…request.
  • Loading branch information...
1 parent 22edeb1 commit a05fc0a3c4b17e8dd1e6c6a6e18fdea8267d5eda @lukeredpath lukeredpath committed Mar 22, 2010
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/ZTWebSocket.m
View
6 src/ZTWebSocket.m
@@ -119,13 +119,17 @@ - (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UIn
NSString* requestOrigin = self.origin;
if (!requestOrigin) requestOrigin = [NSString stringWithFormat:@"http://%@",url.host];
+ NSString *requestPath = url.path;
+ if (url.query) {
+ requestPath = [requestPath stringByAppendingFormat:@"?%@", url.query];
+ }
NSString* getRequest = [NSString stringWithFormat:@"GET %@ HTTP/1.1\r\n"
"Upgrade: WebSocket\r\n"
"Connection: Upgrade\r\n"
"Host: %@\r\n"
"Origin: %@\r\n"
"\r\n",
- url.path,url.host,requestOrigin];
+ requestPath,url.host,requestOrigin];
[socket writeData:[getRequest dataUsingEncoding:NSASCIIStringEncoding] withTimeout:-1 tag:ZTWebSocketTagHandshake];
}

0 comments on commit a05fc0a

Please sign in to comment.