Skip to content

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
...
  • 2 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
Showing with 15 additions and 0 deletions.
  1. +5 −0 SPDY/SPDY/SPDY.h
  2. +10 −0 SPDY/SPDY/SpdyUrlConnection.m
View
5 SPDY/SPDY/SPDY.h
@@ -101,3 +101,8 @@ enum SpdyErrors {
[[SPDY sharedSPDY].logger writeSpdyLog:fmt file:__FILE__ line:__LINE__, ##__VA_ARGS__];\
if (0) NSLog(fmt, ## __VA_ARGS__); \
} while (0);
+
+#define SPDY_DEBUG_LOG(fmt, ...) do { \
+ [[SPDY sharedSPDY].logger writeSpdyLog:fmt file:__FILE__ line:__LINE__, ##__VA_ARGS__];\
+ if (0) NSLog(fmt, ## __VA_ARGS__); \
+} while (0);
View
10 SPDY/SPDY/SpdyUrlConnection.m
@@ -72,43 +72,51 @@ - (id)initWithConnection:(SpdyUrlConnection *)protocol {
}
- (void)onConnect:(id<SpdyRequestIdentifier>)spdyId {
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onConnect: %@", self.protocol, spdyId);
self.protocol.spdyIdentifier = spdyId;
if (self.protocol.cancelled) {
[spdyId close];
}
}
- (void)onError:(NSError *)error {
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onError: %@", self.protocol, error);
if (!self.protocol.cancelled) {
[[self.protocol client] URLProtocol:self.protocol didFailWithError:error];
}
}
- (void)onNotSpdyError:(id<SpdyRequestIdentifier>)identifier {
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onNotSpdyError: %@", self.protocol, identifier);
NSURL *url = [identifier url];
[SpdyUrlConnection disableUrl:url];
NSError *error = [NSError errorWithDomain:kSpdyErrorDomain code:kSpdyConnectionNotSpdy userInfo:nil];
[[self.protocol client] URLProtocol:self.protocol didFailWithError:error];
}
- (void)onRequestBytesSent:(NSInteger)bytesSend {
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onRequestBytesSent: %d", self.protocol, bytesSend);
// The updated byte count should be sent, but the URLProtocolClient doesn't have a method to do that.
//[[self.protocol client] URLProtocol:self.protocol didSendBodyData:bytesSend];
self.requestBytesSent += bytesSend;
}
- (void)onResponseHeaders:(CFHTTPMessageRef)headers {
NSHTTPURLResponse *response = [SpdyUrlResponse responseWithURL:[self.protocol.spdyIdentifier url] withResponse:headers withRequestBytes:self.requestBytesSent];
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onResponseHeaders: %@", self.protocol, [response allHeaderFields]);
+
[[self.protocol client] URLProtocol:self.protocol didReceiveResponse:response cacheStoragePolicy:NSURLCacheStorageNotAllowed];
}
- (size_t)onResponseData:(const uint8_t *)bytes length:(size_t)length {
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onResponseData: %lu", self.protocol, length);
NSData *data = [NSData dataWithBytes:bytes length:length];
[[self.protocol client] URLProtocol:self.protocol didLoadData:data];
return length;
}
- (void)onStreamClose {
+ SPDY_DEBUG_LOG(@"SpdyURLConnection: %@ onStreamClose", self.protocol);
self.protocol.closed = YES;
[[self.protocol client] URLProtocolDidFinishLoading:self.protocol];
}
@@ -181,11 +189,13 @@ + (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request {
}
- (void)startLoading {
+ SPDY_DEBUG_LOG(@"Start loading SpdyURLConnection: %@ with URL: %@", self, [[self request] URL])
SpdyUrlCallback *delegate = [[[SpdyUrlCallback alloc] initWithConnection:self] autorelease];
[[SPDY sharedSPDY] fetchFromRequest:[self request] delegate:delegate];
}
- (void)stopLoading {
+ SPDY_DEBUG_LOG(@"Stop loading SpdyURLConnection: %@ with URL: %@", self, [[self request] URL])
if (self.closed)
return;
self.cancelled = YES;

No commit comments for this range

Something went wrong with that request. Please try again.