http:send-request, cookies and redirections
Tuesday, 4 August 2026 · 2 messages
AB
Andy Bunce4 Aug 2026 17:24 #
Hi,
Often scripting web site access requires sending of cookies supplied in previous responses. Currently, this seems what complicated . In BaseX
http:send-request cases with @follow-redirect="true" these cookies may not appear in the call result. The redirection is the default, although I can not see that clearly stated [1] , [2] [3]
This makes accessing some site data much harder than it could be. My use-case here is accessing the docs.basex.org download functionality :) I think I have a solution to that, but I wondered if there is work planned in this area?
I looked at the http_client2 ( somewhat abandoned?), and also the QT4 +EXPath adoptions discussions. I could find nothing related to this.
However, XProc has a solution( although,I think the spec could be more explicit [4]) I wonder if something like this could be considered for BaseX + EXpath :
- The http:send-request step automatically parses incoming Set-Cookie headers from responses and sends matching cookies back in subsequent requests within the same context or session configuration.
- You can control or disable automatic cookie tracking by setting a new attribute 'suppress-cookies' set to true or false () on the <http:request>
element [2].
/Andy
[1] https://docs.basex.org/13/Search?input=follow-redirects
[2] https://docs.basex.org/13/HTTP_Client_Functions#http:send-request [3] http://expath.org/spec/http-client
[4] https://lists.w3.org/Archives/Public/xproc-dev/2026Aug/0000.htmlCG
Christian Grün4 Aug 2026 18:40 #
Hi Andy,
That would certainly be something worth doing. – You mentioned you already have a solution at hand. Would you be interested in sending us a PR?
Best,
Christian
Quoted text · Andy Bunce · 16 lines
Von: Andy Bunce via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> Gesendet: Dienstag, 4. August 2026 17:24 An: BaseX Betreff: [basex-talk] http:send-request, cookies and redirections Hi, Often scripting web site access requires sending of cookies supplied in previous responses. Currently, this seems what complicated . In BaseX http:send-request cases with @follow-redirect="true" these cookies may not appear in the call result. The redirection is the default, although I can not see that clearly stated [1] , [2] [3] This makes accessing some site data much harder than it could be. My use-case here is accessing the docs.basex.org<http://docs.basex.org> download functionality :) I think I have a solution to that, but I wondered if there is work planned in this area? I looked at the http_client2 ( somewhat abandoned?), and also the QT4 +EXPath adoptions discussions. I could find nothing related to this. However, XProc has a solution( although,I think the spec could be more explicit [4]) I wonder if something like this could be considered for BaseX + EXpath : * The http:send-request step automatically parses incoming Set-Cookie headers from responses and sends matching cookies back in subsequent requests within the same context or session configuration. * You can control or disable automatic cookie tracking by setting a new attribute 'suppress-cookies' set to true or false () on the <http:request> element [2]. /Andy [1] https://docs.basex.org/13/Search?input=follow-redirects [2] https://docs.basex.org/13/HTTP_Client_Functions#http:send-request [3] http://expath.org/spec/http-client [4] https://lists.w3.org/Archives/Public/xproc-dev/2026Aug/0000.html
Written for BaseX 12.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery