nmkhoa / unitt

Automatically exported from code.google.com/p/unitt
0 stars 0 forks source link

Host header attr should include port if not default (80) #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
According to:
http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-12#section-9.4

In all WebSocketXX.m files:

return [NSString stringWithFormat:@"GET %@ HTTP/1.1\r\n"
                    "Upgrade: WebSocket\r\n"
                    "Connection: Upgrade\r\n"
                    "Host: %@\r\n"
                    "Sec-WebSocket-Origin: %@\r\n"
                    "Sec-WebSocket-Protocol: %@\r\n"
                    "Sec-WebSocket-Key: %@\r\n"
                    "Sec-WebSocket-Version: 7\r\n"
                    "\r\n",
                    aRequestPath,  self.url.host, self.origin, protocolFragment, wsSecKey];

self.url.host should be replaced with something like the buildOrigin method:
(following code not tested, just to illustrate)

- (NSString*) buildHost
{
    if (self.url.port && [self.url.port intValue] == 80 || [self.url.port intValue] == 443)
        return self.url.host;

    return [NSString stringWithFormat:@"%@:%@", self.url.host, self.url.port];
}

Original issue reported on code.google.com by ori.ar...@gmail.com on 30 Aug 2011 at 7:19

GoogleCodeExporter commented 8 years ago
Good catch! Fixing for both Java & Objective-C.

Original comment by joshuadmorris@gmail.com on 31 Aug 2011 at 6:54

GoogleCodeExporter commented 8 years ago
Fixed in 0.9.3.1

Original comment by joshuadmorris@gmail.com on 3 Sep 2011 at 4:22

GoogleCodeExporter commented 8 years ago
Thanks for the quick fix!
I verified the new build now works in my test env (Obj-C).

Original comment by ori.ar...@gmail.com on 4 Sep 2011 at 8:04

GoogleCodeExporter commented 8 years ago

Original comment by joshuadmorris@gmail.com on 2 Oct 2011 at 9:08