Ben Copsey

Tweak naming for HTTPVersionOne property

Add test for same
... ... @@ -212,7 +212,8 @@ typedef enum _ASINetworkErrorType {
// Custom user information assosiated with the request
NSDictionary *userInfo;
BOOL HTTPVersionOne;
// Use HTTP 1.0 rather than 1.1 (defaults to false)
BOOL useHTTPVersionOne;
}
... ... @@ -396,6 +397,6 @@ typedef enum _ASINetworkErrorType {
@property (retain) NSInputStream *postBodyReadStream;
@property (assign) BOOL shouldStreamPostDataFromDisk;
@property (assign) BOOL didCreateTemporaryPostDataFile;
@property (assign) BOOL HTTPVersionOne;
@property (assign) BOOL useHTTPVersionOne;
@end
... ...
... ... @@ -301,7 +301,7 @@ static NSError *ASIUnableToCreateRequestError;
}
// Create a new HTTP request.
request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)requestMethod, (CFURLRef)url, self.HTTPVersionOne ? kCFHTTPVersion1_0 : kCFHTTPVersion1_1);
request = CFHTTPMessageCreateRequest(kCFAllocatorDefault, (CFStringRef)requestMethod, (CFURLRef)url, self.useHTTPVersionOne ? kCFHTTPVersion1_0 : kCFHTTPVersion1_1);
if (!request) {
[self failWithError:ASIUnableToCreateRequestError];
return;
... ... @@ -1625,5 +1625,5 @@ static NSError *ASIUnableToCreateRequestError;
@synthesize postBodyReadStream;
@synthesize shouldStreamPostDataFromDisk;
@synthesize didCreateTemporaryPostDataFile;
@synthesize HTTPVersionOne;
@synthesize useHTTPVersionOne;
@end
... ...
... ... @@ -19,6 +19,7 @@
- (void)testBasicDownload;
- (void)testTimeOut;
- (void)testRequestMethod;
- (void)testHTTPVersion;
- (void)testUploadContentLength;
- (void)testDownloadContentLength;
- (void)testFileDownload;
... ...
... ... @@ -109,6 +109,23 @@
}
}
- (void)testHTTPVersion
{
NSURL *url = [[[NSURL alloc] initWithString:@"http://allseeing-i.com/ASIHTTPRequest/tests/http-version"] autorelease];
ASIHTTPRequest *request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
[request start];
BOOL success = [[request responseString] isEqualToString:@"HTTP/1.1"];
GHAssertTrue(success,@"Wrong HTTP version used");
request = [[[ASIHTTPRequest alloc] initWithURL:url] autorelease];
[request setUseHTTPVersionOne:YES];
[request start];
success = [[request responseString] isEqualToString:@"HTTP/1.0"];
GHAssertTrue(success,@"Wrong HTTP version used");
}
- (void)testUploadContentLength
{
//This url will return the contents of the Content-Length request header
... ...