Giter Site home page Giter Site logo

Comments (5)

reem avatar reem commented on September 21, 2024

I think this is fine, since you can choose your own representation for a Header if you want better support for a non-standard value for that Header.

from hyper.

reem avatar reem commented on September 21, 2024

However, I think we have to be very careful with Headers like TransferEncoding, Date, and Host, which are baked into hyper.

from hyper.

seanmonstar avatar seanmonstar commented on September 21, 2024

Hm, oh right! The hyper server uses those headers internally to meet the spec, and if someone wants a completely different struct of handle TransferEncoding or something, then the Typed return value would be wrong (I think currently that would be a downcast to the wrong type), and there'd be no more Raw to rebuild a different format.

I'm starting to think that design in teepee (keeping raw around even after parsing) makes more sense... I just was hoping to save on memory.

from hyper.

reem avatar reem commented on September 21, 2024

Uh oh, you're right. It just occurred to me that the existing scheme is entirely unsafe. If you try to access a header through two representations, you'll get an undefined transmute!

from hyper.

reem avatar reem commented on September 21, 2024

This is fixable by tracking TypeId, but I don't see a good way to allow access under two representations in the same app - if you use one representation you can make a change that might not be represented in the raw header. i.e. I can write the transfer encoding to gzip using one representation, but another representation still sees the original encoding.

from hyper.

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.