-
-
Notifications
You must be signed in to change notification settings - Fork 179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
missing Content-Length Header in POST requests sent with EXPath HTTP Client #4642
Comments
http-client:send-request
http-client:send-request
In HTTP 1.1 the If you want HTTP 1.0 behaviour instead, you just need to specify that option explicitly on your Otherwise, if you believe this is an issue with the EXPath HTTP Client then it should be moved to - https://github.com/expath/expath-http-client-java/issues. |
@adamretter What is the non-default value of transfer-encoding that allows to set the content-length header and how does one set this in the example above? |
I found some interesting info in here about undocumented attributes that can be set |
Will retest with chunked="false" |
I can confirm that the above works. xquery version "3.1";
import module namespace hc = "http://expath.org/ns/http-client";
hc:send-request(
<hc:request href="http://localhost:8080/exist/apps/test/controller.xq"
method="POST" timeout="300" chunked="false">
<hc:body media-type="application/xml" method="xml">
<some>content</some>
</hc:body>
</hc:request>
) |
Describe the bug
When sending a request with an XML body via POST
The
content-type
-header is set butcontent-length
is absent.This leads to
request:get-data()
to be empty, when such a request is received by any XQuery module in eXist-6.0.1.In contrast a simple curl request
does set the necessary header and therefore the body can be read.
Affected version: current stable (eXist-6.0.1)
This is fixed in 6.1.0 because
request:get-data()
does receive contents even ifconent-length
is absentI was able to trace it down to the class
org.expath.httpclient.impl.SinglePartRequestBody
. In thesetHeaders
method only thecontent-type
header is set. This is confirmed for XML-like payloads but judging from the source code it applies to any single body regardless of its type.The source code I checked was decompiled from http-client-java-1.4.1.jar
Expected behavior
To either the content-length header to be set automatically or for users to be able to set it manually.
To Reproduce
create collection
/db/apps/test
create resource
/db/apps/test/controller.xq
curl http://localhost:8080/exist/apps/test/ --data "<some>content</some>" -H "Content-Type:application/xml"
Context (please always complete the following information):
Additional context
conf.xml
? noneThe text was updated successfully, but these errors were encountered: