Open GoogleCodeExporter opened 8 years ago
[deleted comment]
[deleted comment]
This may turn out to be a more general issue regarding (at least) how 3xx
responses are reported. And it may not be specific to POST, but apply to other
HTTP methods as well.
When using the <http> task to GET a resource URL that returns a 302 Moved
Temporarily response, the default output emitted by that task includes (eliding
whitespace) 'Status: 200'. In addition, the value of its statusProperty is
also set to '200'.
Sample:
<http method="GET"
url="http://demo.collectionspace.org/collectionspace/ui/core/html"
statusProperty="status.property.redirect" >
</http>
<echo message="${status.property.redirect}" />
(A '200' status code appears in the output from the <http> task, and is also
output by the <echo> task.)
When sending this same GET request via 'curl', however, a '302' response is
received, as in this excerpt:
curl -i http://demo.collectionspace.org/collectionspace/ui/core/html
HTTP/1.1 302 Moved Temporarily
...
Location:
http://demo.collectionspace.org/collectionspace/ui/core/html/index.html
Original comment by aronrobe...@gmail.com
on 19 Aug 2011 at 10:38
I see this problem with 1.1.3, Ant 1.7.1, Java 1.6.0_27.
The statusProperty for the 'http' ant task is set to 200 whereas I have my web
server configured to return 301 for a specific page. When I inspect the element
in Chrome I do see the 301 followed by the 200 when it lands on the destination
of the redirect.
If it was possible to prevent redirects being followed perhaps the status of
the initial request could be captured. (For example: boolean: 'followRedirects')
Original comment by stuart.w...@gmail.com
on 18 Oct 2012 at 3:46
For now I have hard-code redirects in my local
'org.missinglink.http.client.HttpClient' at line 349:
// disable following redirects
httpUrlConnection.setFollowRedirects(false);
If time permits I will create a patch so the Ant task can configure this value.
Original comment by stuart.w...@gmail.com
on 18 Oct 2012 at 6:33
Original issue reported on code.google.com by
aronrobe...@gmail.com
on 19 Aug 2011 at 8:47