Coder Social home page Coder Social logo

Comments (4)

oktal avatar oktal commented on August 15, 2024

Hello,

You are completely right. Currently, headers are stored in a std::unordered_map for constant-time access, which makes case-insensitive access a little bit tricky (we would need to define our own case-insensitive std::hash, or insert lower-case header names into the map).

I think I'll consider switching from std::unordered_map to std::vector or even SmallVector. Lookup will be linear this time but I do not really expect requests to have that much headers. Case-insensitive lookup should then be trivial

from pistache.

cyremur avatar cyremur commented on August 15, 2024

I would probably just transform all header lookup requests into lower-case and only insert lower-case header names into whatever data structure you choose to utilize. The case insensitive hash sounds like a somewhat complicated approach and you won't enforce that there is only one version of the case-insensitive string in the data structure.

from pistache.

nelsonhf avatar nelsonhf commented on August 15, 2024

I think this should be a mandatory change, because, according to IETF RFC 7230, section 3.2 (Header Fields):

Each header field consists of a case-insensitive field name followed
by a colon (":"), optional leading whitespace, the field value, and
optional trailing whitespace

I have a similar problem with Postman (a simple HTTP client) sending "content-length" instead of "Content-Length".

from pistache.

xoac avatar xoac commented on August 15, 2024

Should be closed? 54a3731

from pistache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.