twitter-archive / CocoaSPDY

SPDY for iOS and OS X
Apache License 2.0
2.39k stars 233 forks source link

A crash on make spdyHeaders #147

Open szrexzhu opened 8 years ago

szrexzhu commented 8 years ago

When we visit "http://wsq.discuz.qq.com/",we get a sub request "http:/"(NSURLConnecction + (BOOL)canHandleRequest:(NSURLRequest )request; return YES,so this is a valid request),get a crash on [- (NSDictionary )allSPDYHeaderFields] of NSURLRequest+SPDYURLRequest.m. The reason is host is nil,causes crash to initialize NSMutableDictionary Now I modify the code as follows:

NSMutableDictionary *spdyHeaders = [[NSMutableDictionary alloc] initWithDictionary:@{
         @":method"  : self.HTTPMethod ? self.HTTPMethod : @"GET",
         @":path"    : path ? path : @"/",
         @":version" : @"HTTP/1.1",
         @":host"    : url.host ? url.host : @"",
         @":scheme"  : url.scheme ? url.scheme : @"",
         }];
kgoodier commented 8 years ago

I tried a unit test using the url:

http://wsq.discuz.qq.com/

and allSPDYHeaderFields works just fine, both both iOS 8.4 and 9.3 in the simulator. Can you provide some more information?

szrexzhu commented 8 years ago

Mine is iOS7.1. I did not find the "http:/" of the reasons. May I use the more you different, I use spdy connect to our proxy server, and then send a request.Use a connection to access any web site, 'http:/' is a legitimate request, so can execute to 'allSPDYHeaderFields',here the host is nil. My English is so poor. :)