http-request creates empty content-type header
A Java implementation of XProc: An XML Pipeline Language
Status: Abandoned
Brought to you by:
xml-project-com
Hi!
While trying to interact with MarkLogic, I've found an issue with MorganaXProc that causes all our POST requests to fail. It seems that MorganaXProc adds an empty content-type header to its outbound HTTP requests, which some servers ignore and some do not.
Here's a test XProc to show the issue:
<p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
xmlns:c="http://www.w3.org/ns/xproc-step"
version="1.0"
name="test-http-post">
<p:http-request>
<p:input port="source">
<p:inline>
<c:request href="http://localhost:9090"
method="post">
<c:body content-type="application/xml">
<test/>
</c:body>
</c:request>
</p:inline>
</p:input>
</p:http-request>
<p:sink/>
</p:declare-step>
To see the request headers, one can run nc to listen on localhost port 9090 like so:
nc -l 9090
Here' s what MorganaXProc sends:
chrodon 1016_% nc -l 9090
POST / HTTP/1.1
Content-Type: application/xml
content-type:
Content-Length: 9
Host: localhost:9090
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_101)
<test />
As can be seen, there are two "content-type" headers, one with the correct "application/xml" value, and one that is empty. I've tried to locate where the problem is created in the Java source code, but I could not really find it. Any help would be greatly appreciated.
Thanks,
Hans
Will be fixed with MorganaXProc 1.0.12 (released on this weekend)
Last edit: xml-project.com 2018-02-12
Fixed with MorganaXProc 1.0.12 on 2018-02-18.