Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Difference between LWP::UserAgent and AnyEvent::HTTP

by sectokia (Pilgrim)
on Sep 06, 2021 at 04:03 UTC ( [id://11136491]=note: print w/replies, xml ) Need Help??


in reply to Difference between LWP::UserAgent and AnyEvent::HTTP

After doing packet capture, I determined that AnyEvent::HTTP is sending the header 'X-AcceptDeltaUpdates' as 'X-acceptdeltaupdates', which the server ignores.

LWP useragent retains the case you feed it.

I believe in general the problem is that AnyEvent::HTTP should not be applying the line $hdr{lc $k} = $v to headers that start with "X-"? Anyone know HTTP spec says about this?

Replies are listed 'Best First'.
Re^2: Difference between LWP::UserAgent and AnyEvent::HTTP
by haukex (Archbishop) on Sep 06, 2021 at 04:37 UTC

    The HTTP/1.0 and 1.1 RFCs both state that header names are case-insensitive. I can't find any information on X-AcceptDeltaUpdates, but IMHO the server should probably accept the lowercase version as well.

      I can't find any information on X-AcceptDeltaUpdates

      IIRC, MIME (used both for Mail and for HTTP) allows to invent non-standard "experimental" headers by prefixing them with "X-". The other end should silently ignore all unknown experimental headers.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
        IIRC, MIME (used both for Mail and for HTTP) allows to invent non-standard "experimental" headers by prefixing them with "X-".

        Correct, though its use is now discouraged - from RFC7231 (emphasis mine):

        Authors of specifications defining new fields are advised to keep the name as short as practical and not to prefix the name with "X-" unless the header field will never be used on the Internet. (The "X-" prefix idiom has been extensively misused in practice; it was intended to only be used as a mechanism for avoiding name collisions inside proprietary software or intranet processing, since the prefix would ensure that private names never collide with a newly registered Internet name; see [BCP178] for further information).

        And the linked RFC6648 is dedicated to discussing the deprecation, with some interesting background in the appendicies.

      Yes it appears HTTP servers should do case insensitive matches to headers by specification.

      However it sort of appears by convention that HTTP libraries should not change case of headers that are specified to them.

      Lesson learned: Never trust either end!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11136491]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-19 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found