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
2010-06-17 17:44:08 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
90532749ff3fef20fab09e59faa585cc10f55fc7
90532749
1 parent
106307ac
Preserve user agent on redirect
Closes gh-46
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
2 deletions
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.m
View file @
9053274
...
...
@@ -23,7 +23,7 @@
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.6.2-2
0
2010-06-17"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.6.2-2
1
2010-06-17"
;
NSString
*
const
NetworkRequestErrorDomain
=
@"ASIHTTPRequestErrorDomain"
;
...
...
@@ -1736,7 +1736,14 @@ static BOOL isiPhoneOS2;
[
self
setRequestMethod
:
@"GET"
];
[
self
setPostBody
:
nil
];
[
self
setPostLength
:
0
];
[
self
setRequestHeaders
:
nil
];
// Perhaps there are other headers we should be preserving, but it's hard to know what we need to keep and what to throw away.
NSString
*
userAgent
=
[[
self
requestHeaders
]
objectForKey
:
@"User-Agent"
];
if
(
userAgent
)
{
[
self
setRequestHeaders
:[
NSMutableDictionary
dictionaryWithObject
:
userAgent
forKey
:
@"User-Agent"
]];
}
else
{
[
self
setRequestHeaders
:
nil
];
}
[
self
setHaveBuiltRequestHeaders
:
NO
];
}
else
{
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
9053274
...
...
@@ -447,6 +447,13 @@
success
=
([[[
request
originalURL
]
absoluteString
]
isEqualToString
:
@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect/301"
]);
GHAssertTrue
(
success
,
@"Failed to preserve original url"
);
// Ensure user agent is preserved
request
=
[
ASIHTTPRequest
requestWithURL
:[
NSURL
URLWithString
:
@"http://allseeing-i.com/ASIHTTPRequest/tests/redirect/301"
]];
[
request
addRequestHeader
:
@"User-Agent"
value
:
@"test"
];
[
request
startSynchronous
];
success
=
([[[
request
requestHeaders
]
objectForKey
:
@"User-Agent"
]
isEqualToString
:
@"test"
]);
GHAssertTrue
(
success
,
@"Failed to preserve original user agent on redirect"
);
}
// Using a persistent connection for HTTP 305-307 would cause crashes on the redirect, not really sure why
...
...
@@ -1604,5 +1611,6 @@
}
@synthesize
responseData
;
@end
\ No newline at end of file
...
...
Please
register
or
login
to post a comment