HTTP headers are all lowercase in responses
Wednesday, 26 June 2024 · 3 messages · last reply 1 Jul 2024
ML
Marco Lettere26 Jun 2024 19:14 #
Dear all,
just by trying the example of the documentation [1] (at least since 10.4+) you should be able to verify that the response contains all headers with lower-case names.
I think a client should not take the freedom to alter HTTP responses if this is not strictly required. What is the concrete reason for this behaviour?
hHanks,
Marco.
[1]
http:send-request(<http:request method='get'
href='http://www.google.com' timeout='10'/>)MS
Michael Seiferle27 Jun 2024 15:29 #
Hi Marco,
I am not 100% sure, whether BaseX or the Java HTTP Client actually does the conversion, but it might be due to the fact, that we use the new Java HTTP Client since BaseX 10.
By default, it uses HTTP/2 where headers must be lower-case while in versions before HTTP/2 the headers are defined to be case-insensitive. Hence, my guess is:
The conversion happens because it must in HTTP/2 while it’s valid in HTTP/1/1.1. I hope this doesn’t cause too much trouble on your end.
Best
Michael
Quoted text · BaseX-Talk · 15 lines
Von: BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> im Auftrag von Marco Lettere <m.lettere at gmail.com> Datum: Mittwoch, 26. Juni 2024 um 19:14 An: basex-talk at mailman.uni-konstanz.de <basex-talk at mailman.uni-konstanz.de> Betreff: [basex-talk] HTTP headers are all lowercase in responses Dear all, just by trying the example of the documentation [1] (at least since 10.4+) you should be able to verify that the response contains all headers with lower-case names. I think a client should not take the freedom to alter HTTP responses if this is not strictly required. What is the concrete reason for this behaviour? hHanks, Marco. [1] http:send-request(<http:request method='get' href='http://www.google.com' timeout='10'/>)
CG
Christian Grün1 Jul 2024 09:19 #
Hi Marco,
As Michael has already confirmed, BaseX 10 and later is based on the new Java HTTP Client, which returns all response header field names in lowercase as required by HTTP/2 [1].
Best,
Christian
[1] https://www.rfc-editor.org/rfc/rfc7540#section-8.1.2
Quoted text · Michael Seiferle · 63 lines
On Thu, Jun 27, 2024 at 3:29 PM Michael Seiferle <ms at basex.org> wrote: > Hi Marco, > > > > I am not 100% sure, whether BaseX or the Java HTTP Client actually does > the conversion, but it might be due to the fact, that we use the new Java > HTTP Client since BaseX 10. > > > > By default, it uses HTTP/2 where headers must be lower-case while in > versions before HTTP/2 the headers are defined to be case-insensitive. > > Hence, my guess is: > > The conversion happens because it must in HTTP/2 while it’s valid in > HTTP/1/1.1. > > I hope this doesn’t cause too much trouble on your end. > > > > Best > > Michael > > > > > > > > > > > > > > *Von: *BaseX-Talk <basex-talk-bounces at mailman.uni-konstanz.de> im Auftrag > von Marco Lettere <m.lettere at gmail.com> > *Datum: *Mittwoch, 26. Juni 2024 um 19:14 > *An: *basex-talk at mailman.uni-konstanz.de < > basex-talk at mailman.uni-konstanz.de> > *Betreff: *[basex-talk] HTTP headers are all lowercase in responses > > Dear all, > > just by trying the example of the documentation [1] (at least since > 10.4+) you should be able to verify that the response contains all > headers with lower-case names. > > I think a client should not take the freedom to alter HTTP responses if > this is not strictly required. What is the concrete reason for this > behaviour? > > hHanks, > > Marco. > > [1] http:send-request(<http:request method='get' > href='http://www.google.com' timeout='10'/>) >
Written for BaseX 11.0. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery