The server is MarkLogic, s maybe they are biased against BaseX ;) I'm not
sure about the configuration, but replacing the User-Agent header with
"curl/7.71.1" didn't help.
Attached is the HTTP info for the curl requests. I also tried it in the
Postman GUI, which worked as well. I noticed that in both curl and Postman
the first request says, "[HTTP request 1/2]," whereas BaseX says, "[HTTP
request 1/1]"
Tim
On Wed, Feb 2, 2022 at 3:38 PM Christian Grün <[email protected]>
wrote:
> Dommage.
>
> Do you know more about the server you are communicating with? Maybe it
> rejects http (POST?) requests sent by Java?
>
> You could try to supply the curl-specific request headers (such as
> User-Agent, and others) with http:send-request.
>
> Could you additionally forward the full Wireshark logs for curl?
>
> I remember that Adam (Retter) added the http-version option to the new
> version of the HTTP Client Module (it’s not available in 1.0 yet). In the
> given case, I’d assume that http-version=1.1 should be okay, because curl
> uses it as well.
>
>
>
> Tim Thompson <[email protected]> schrieb am Mi., 2. Feb. 2022, 21:22:
>
>> Thanks for that. Still no luck, I'm afraid. Attached is the full HTTP
>> info for the requests from BaseX (hostname info replaced with "
>> example.org").
>>
>> I should be able to stick with GET requests for now, but would be nice to
>> have access to POST as well.
>>
>> All best,
>> Tim
>>
>>
>> --
>> Tim A. Thompson
>> Metadata Librarian
>> Yale University Library
>>
>>
>> On Wed, Feb 2, 2022 at 2:20 PM Christian Grün <[email protected]>
>> wrote:
>>
>>> > I notice that curl doesn't include the Authorization header on the
>>> first request, but I am out of my depth here.
>>>
>>> That could be an interesting hint. In the latest snapshot [1], I have
>>> removed the Authorization header from the first request. Can you check
>>> if it makes a difference?
>>>
>>> If not, could you share the headers of the second requests with us?
>>>
>>> [1] https://files.basex.org/releases/latest/
>>>
>>
Hypertext Transfer Protocol
POST /v1/graphs/sparql HTTP/1.1\r\n
[Expert Info (Chat/Sequence): POST /v1/graphs/sparql HTTP/1.1\r\n]
Request Method: POST
Request URI: /v1/graphs/sparql
Request Version: HTTP/1.1
Host: example.org\r\n
User-Agent: curl/7.71.1\r\n
Accept: */*\r\n
Content-type: application/sparql-query\r\n
Content-Length: 0\r\n
\r\n
[Full request URI: http://example.org/v1/graphs/sparql]
[HTTP request 1/2]
[Response in frame: 76]
[Next request in frame: 78]
Hypertext Transfer Protocol
HTTP/1.1 401 Unauthorized\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 401 Unauthorized\r\n]
Response Version: HTTP/1.1
Status Code: 401
[Status Code Description: Unauthorized]
Response Phrase: Unauthorized
Date: Wed, 02 Feb 2022 21:11:25 GMT\r\n
Content-Type: application/json; charset=utf-8\r\n
Content-Length: 104\r\n
Connection: keep-alive\r\n
Set-Cookie:
AWSALB=E+C5iXeqdhPvATdqaa35WllN1c+XOg5C1L0cN04X+K5zzUU9ZYRyociQWkZFyVGksz3M08Y017BV8pFD/llPWEM6FeTqiMoE7q8UJ0E3Fxpk9Rpz5zN6hxl+D/Lp;
Expires=Wed, 09 Feb 2022 21:11:25 GMT; Path=/\r\n
Set-Cookie:
AWSALBCORS=E+C5iXeqdhPvATdqaa35WllN1c+XOg5C1L0cN04X+K5zzUU9ZYRyociQWkZFyVGksz3M08Y017BV8pFD/llPWEM6FeTqiMoE7q8UJ0E3Fxpk9Rpz5zN6hxl+D/Lp;
Expires=Wed, 09 Feb 2022 21:11:25 GMT; Path=/; SameSite=None\r\n
Server: MarkLogic\r\n
WWW-Authenticate: Digest realm="public", qop="auth",
nonce="3a669a9acad6d8:8nwokPa+YActQ7KDb3R5gg==", opaque="e225558330e43e07"\r\n
\r\n
[HTTP response 1/2]
[Time since request: 0.032887000 seconds]
[Request in frame: 72]
[Next request in frame: 78]
[Next response in frame: 170]
[Request URI: http://example.org/v1/graphs/sparql]
File Data: 104 bytes
JavaScript Object Notation: application/json
Hypertext Transfer Protocol
POST /v1/graphs/sparql HTTP/1.1\r\n
[Expert Info (Chat/Sequence): POST /v1/graphs/sparql HTTP/1.1\r\n]
Request Method: POST
Request URI: /v1/graphs/sparql
Request Version: HTTP/1.1
Host: example.org\r\n
[truncated]Authorization: Digest username="[...]", realm="public",
nonce="[...]", uri="/v1/graphs/sparql", cnonce="[...]", nc=00000001, qop=auth,
response="[...]"
User-Agent: curl/7.71.1\r\n
Accept: */*\r\n
Content-type: application/sparql-query\r\n
Content-Length: 35\r\n
\r\n
[Full request URI: http://example.org/v1/graphs/sparql]
[HTTP request 2/2]
[Prev request in frame: 72]
[Response in frame: 170]
File Data: 35 bytes
Media Type
Media type: application/sparql-query (35 bytes)
Hypertext Transfer Protocol
HTTP/1.1 200 OK\r\n
[Expert Info (Chat/Sequence): HTTP/1.1 200 OK\r\n]
Response Version: HTTP/1.1
Status Code: 200
[Status Code Description: OK]
Response Phrase: OK
Date: Wed, 02 Feb 2022 21:11:28 GMT\r\n
Content-Type: application/sparql-results+json; charset=UTF-8\r\n
Content-Length: 247\r\n
Connection: keep-alive\r\n
Set-Cookie:
AWSALB=Ai0D8OHThYcPE4WvRGaJjBWA9flGCU01Y/ewyec5ntDu0q7xzZAYJmwjQPF7eMjA4/QCjkZij8IpUZQBrBY3XPpqxHFSfhTnjQunEjqPxrLJvsxa3dpqWbDdmkR3;
Expires=Wed, 09 Feb 2022 21:11:25 GMT; Path=/\r\n
Set-Cookie:
AWSALBCORS=Ai0D8OHThYcPE4WvRGaJjBWA9flGCU01Y/ewyec5ntDu0q7xzZAYJmwjQPF7eMjA4/QCjkZij8IpUZQBrBY3XPpqxHFSfhTnjQunEjqPxrLJvsxa3dpqWbDdmkR3;
Expires=Wed, 09 Feb 2022 21:11:25 GMT; Path=/; SameSite=None\r\n
ML-Effective-Timestamp: 16438362609754000\r\n
Server: MarkLogic\r\n
\r\n
[HTTP response 2/2]
[Time since request: 3.011839000 seconds]
[Prev request in frame: 72]
[Prev response in frame: 76]
[Request in frame: 78]
[Request URI: http://example.org/v1/graphs/sparql]
File Data: 247 bytes
Media Type
Media type: application/sparql-results+json; charset=UTF-8 (247 bytes)