|
@@ -406,13 +406,17 @@
|
|
- (void)_dequeueInput
|
|
- (void)_dequeueInput
|
|
{
|
|
{
|
|
while (_inputQueue.count > 0) {
|
|
while (_inputQueue.count > 0) {
|
|
- NSData *data = _inputQueue[0];
|
|
|
|
- [self _proxyProcessHTTPResponseWithData:data];
|
|
|
|
|
|
+ NSData *data = _inputQueue.firstObject;
|
|
[_inputQueue removeObjectAtIndex:0];
|
|
[_inputQueue removeObjectAtIndex:0];
|
|
|
|
+
|
|
|
|
+ // No need to process any data further, we got the full header data.
|
|
|
|
+ if ([self _proxyProcessHTTPResponseWithData:data]) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//handle checking the proxy connection status
|
|
//handle checking the proxy connection status
|
|
-- (void)_proxyProcessHTTPResponseWithData:(NSData *)data
|
|
|
|
|
|
+- (BOOL)_proxyProcessHTTPResponseWithData:(NSData *)data
|
|
{
|
|
{
|
|
if (_receivedHTTPHeaders == NULL) {
|
|
if (_receivedHTTPHeaders == NULL) {
|
|
_receivedHTTPHeaders = CFHTTPMessageCreateEmpty(NULL, NO);
|
|
_receivedHTTPHeaders = CFHTTPMessageCreateEmpty(NULL, NO);
|
|
@@ -422,7 +426,10 @@
|
|
if (CFHTTPMessageIsHeaderComplete(_receivedHTTPHeaders)) {
|
|
if (CFHTTPMessageIsHeaderComplete(_receivedHTTPHeaders)) {
|
|
SRDebugLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(_receivedHTTPHeaders)));
|
|
SRDebugLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(_receivedHTTPHeaders)));
|
|
[self _proxyHTTPHeadersDidFinish];
|
|
[self _proxyHTTPHeadersDidFinish];
|
|
|
|
+ return YES;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ return NO;
|
|
}
|
|
}
|
|
|
|
|
|
- (void)_proxyHTTPHeadersDidFinish
|
|
- (void)_proxyHTTPHeadersDidFinish
|