Ben Copsey

Lots of changes to fix regressions

Redirect / authentication required requests download the full response before trying again, so they can re-use the connection
Invalidate the connection when a request fails to prevent subsequent requests getting stuck on a bad line
@@ -25,7 +25,6 @@ extern NSString *ASIHTTPRequestVersion; @@ -25,7 +25,6 @@ extern NSString *ASIHTTPRequestVersion;
25 #define __IPHONE_3_0 30000 25 #define __IPHONE_3_0 30000
26 #endif 26 #endif
27 27
28 -  
29 typedef enum _ASINetworkErrorType { 28 typedef enum _ASINetworkErrorType {
30 ASIConnectionFailureErrorType = 1, 29 ASIConnectionFailureErrorType = 1,
31 ASIRequestTimedOutErrorType = 2, 30 ASIRequestTimedOutErrorType = 2,
@@ -339,6 +338,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; @@ -339,6 +338,10 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
339 338
340 // Set to yes when an appropriate keep-alive header is found 339 // Set to yes when an appropriate keep-alive header is found
341 BOOL canUsePersistentConnection; 340 BOOL canUsePersistentConnection;
  341 +
  342 + NSTimeInterval closeStreamTime;
  343 +
  344 + int usedStreamNumber;
342 } 345 }
343 346
344 #pragma mark init / dealloc 347 #pragma mark init / dealloc
@@ -431,8 +434,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount; @@ -431,8 +434,8 @@ extern unsigned long const ASIWWANBandwidthThrottleAmount;
431 434
432 // Reads the response headers to find the content length, encoding, cookies for the session 435 // Reads the response headers to find the content length, encoding, cookies for the session
433 // Also initiates request redirection when shouldRedirect is true 436 // Also initiates request redirection when shouldRedirect is true
434 -// Returns true if the request needs a username and password (or if those supplied were incorrect) 437 +// And works out if HTTP auth is required
435 -- (BOOL)readResponseHeadersReturningAuthenticationFailure; 438 +- (void)readResponseHeaders;
436 439
437 #pragma mark http authentication stuff 440 #pragma mark http authentication stuff
438 441
This diff is collapsed. Click to expand it.
@@ -320,7 +320,7 @@ @@ -320,7 +320,7 @@
320 320
321 request2 = [ASIFormDataRequest requestWithURL:url]; 321 request2 = [ASIFormDataRequest requestWithURL:url];
322 [request2 setPostValue:@"foo" forKey:@"eep"]; 322 [request2 setPostValue:@"foo" forKey:@"eep"];
323 - [request2 start]; 323 + [request2 startSynchronous];
324 324
325 NSString *method = @"GET"; 325 NSString *method = @"GET";
326 if (i>304) { 326 if (i>304) {