http-client "hangs" if following a POST request
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zorba |
Fix Released
|
Medium
|
Matthias Brantner |
Bug Description
Making the following request to a resource that sends a 301 or 302 redirect doesn't terminate.
http:send-
<http:request href="http://
<http:header name="Content-
<http:body media-type=
</http:request>
)
The reason is that the http-client tells curl to follow the redirect. In turn, curl issues a GET request with the Content-Length header set to the size of the payload of the original POST request. However, the response doesn't come back because no data is sent with the redirected GET request.
A suggested solution is to raise an error if one tries to follow POST, PUT, or DELETE requests. The semantic of doing this is not clear and it's up to the user what to do. For example, the user might want to follow-up using a GET request or with another POST containing the same data. Raising an error allows the user of the http-client to do whatever is required.
Related branches
- Till Westmann: Approve
- Matthias Brantner: Approve
-
Diff: 192 lines (+51/-3)8 files modifiedChangeLog (+1/-0)
modules/com/zorba-xquery/www/modules/http-client-error.xq (+7/-0)
modules/com/zorba-xquery/www/modules/http-client.xq (+6/-0)
modules/com/zorba-xquery/www/modules/http-client.xq.src/http_client.cpp (+1/-1)
modules/com/zorba-xquery/www/modules/http-client.xq.src/request_parser.cpp (+27/-1)
modules/com/zorba-xquery/www/modules/http-client.xq.src/request_parser.h (+3/-1)
test/rbkt/Queries/zorba/http-client/send-request/http4-post-redirect.spec (+1/-0)
test/rbkt/Queries/zorba/http-client/send-request/http4-post-redirect.xq (+5/-0)
Changed in zorba: | |
milestone: | none → 2.2 |
Changed in zorba: | |
milestone: | 2.2 → 2.3 |
status: | New → In Progress |
Changed in zorba: | |
status: | In Progress → Fix Committed |
Changed in zorba: | |
status: | Fix Committed → Fix Released |