CocoaSPDY icon indicating copy to clipboard operation
CocoaSPDY copied to clipboard

A crash on make spdyHeaders

Open szrexzhu opened this issue 8 years ago • 2 comments

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 : @"",
         }];

szrexzhu avatar Jul 05 '16 08:07 szrexzhu

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?

kgoodier avatar Jul 05 '16 16:07 kgoodier

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. :)

szrexzhu avatar Jul 07 '16 15:07 szrexzhu