vipm-io / http-rest-client

HTTP REST Client Library for LabVIEW
BSD 3-Clause "New" or "Revised" License
30 stars 18 forks source link

HTTP headers case-insensitive #45

Open huipeng8 opened 7 months ago

huipeng8 commented 7 months ago

HTTP REST Client Library Version -- 2.1.0.34

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespace before the value is ignored.

Reference Information:https://developer.mozilla.org/en-US/docs/web/http/headers


Build Dictionary.vi&Get Header By Name.vi Variant attributes are used to store header information, but the uppercase and lowercase letters of names are considered different, which results in the header information not being read correctly. Perhaps we can convert to lowercase and then write the variant attributes.

20240415085539

francois-normandin commented 7 months ago

@huipeng8. Yes, I agree. Thanks for flagging this bug! However, it should be done only on the read from variant, so that the dictionary maintains the state as it was written by the client. That way, it is possible to maintain whichever original case was used, but still be case-insensitive to meet the specification.

For reference, I made a similar proposal/fix to this other project, which exhibited the same symptom: https://github.com/MediaMongrels-Ltd/LabVIEW-WebSockets-API/issues/7#issuecomment-715414408


From: huipeng8 @.> Sent: Sunday, April 14, 2024 6:22:38 PM To: vipm-io/http-rest-client @.> Cc: Subscribed @.***> Subject: [vipm-io/http-rest-client] HTTP headers case-insensitive (Issue #45)

HTTP REST Client Library Version -- 2.1.0.34

HTTP headers let the client and the server pass additional information with an HTTP request or response. An HTTP header consists of its case-insensitive name followed by a colon (:), then by its value. Whitespacehttps://developer.mozilla.org/en-US/docs/Glossary/Whitespace before the value is ignored.

Reference Information:https://developer.mozilla.org/en-US/docs/web/http/headers


Build Dictionary.vi&Get Header By Name.vi Variant attributes are used to store header information, but the uppercase and lowercase letters of names are considered different, which results in the header information not being read correctly. Perhaps we can convert to lowercase and then write the variant attributes.

20240415085539.png (view on web)https://github.com/vipm-io/http-rest-client/assets/17694228/51ae68f9-9041-484e-9531-7f0711ce5af6

— Reply to this email directly, view it on GitHubhttps://github.com/vipm-io/http-rest-client/issues/45, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ACZPNJEBIHMHTVRYWNVFTOLY5MTV5AVCNFSM6AAAAABGGNP5HSVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI2DENBZGQYDANI. You are receiving this because you are subscribed to this thread.Message ID: @.***>