Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2009-05-31 09:59:41 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1192c8534db001a43924d5917e6e42b70d09d377
1192c853
1 parent
47cd9b57
Tweak naming for HTTPVersionOne property
Add test for same
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
4 deletions
Classes/ASIHTTPRequest.h
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.h
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.h
View file @
1192c85
...
...
@@ -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
use
HTTPVersionOne
;
@end
...
...
Classes/ASIHTTPRequest.m
View file @
1192c85
...
...
@@ -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
.
use
HTTPVersionOne
?
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
use
HTTPVersionOne
;
@end
...
...
Classes/Tests/ASIHTTPRequestTests.h
View file @
1192c85
...
...
@@ -19,6 +19,7 @@
-
(
void
)
testBasicDownload
;
-
(
void
)
testTimeOut
;
-
(
void
)
testRequestMethod
;
-
(
void
)
testHTTPVersion
;
-
(
void
)
testUploadContentLength
;
-
(
void
)
testDownloadContentLength
;
-
(
void
)
testFileDownload
;
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
1192c85
...
...
@@ -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
...
...
Please
register
or
login
to post a comment