Hello,

I'm trying to post a SPARQL query to an endpoint using Digest authentication with the HTTP client.

The query works fine using curl:

curl --digest --user user:pass -X POST -d@'test.rq' \
    -H "Content-type: application/sparql-query" \
    'http://example.org/sparql'


But the equivalent request in BaseX fails with 401 Unauthorized:

let $endpoint := "http://example.org/sparql"
let $user := "user"
let $pass := "pass"
let $type := "application/sparql-query"

let $response := (    
  http:send-request(
    <http:request
        method="POST"        
        href="{$endpoint}"
        username="{$user}"
        password="{$pass}"
        auth-method="Digest"
        send-authorization="true">        
        <http:header
            name="Content-Type"
            value="{$type}; charset=utf-8"/>        
        <http:body
            media-type="{$type}">{
            ``[              
              select * where {?s ?p ?o} limit 1
            ]``
          }</http:body>        
    </http:request>
  )
)
return
  $response

Any ideas about what might be causing the BaseX HTTP client to be denied here?

Thanks in advance,
Tim


--
Tim A. Thompson
Metadata Librarian
Yale University Library