Permalink
Browse files

Tweak naming for HTTPVersionOne property

Add test for same
  • Loading branch information...
1 parent 47cd9b5 commit 1192c8534db001a43924d5917e6e42b70d09d377 @pokeb committed May 31, 2009
View
@@ -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
View
@@ -301,7 +301,7 @@ - (void)main
}
// 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 @@ + (int)uncompressZippedDataFromSource:(FILE *)source toDestination:(FILE *)dest
@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)testRequestMethod
}
}
+- (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

0 comments on commit 1192c85

Please sign in to comment.