Skip to content

Conversation

srp
Copy link

@srp srp commented Oct 29, 2014

Unfortunately, HTTP can have duplicate headers, namely 'Set-Cookie'.
We could just store headers as Dict{String,Vector{String}}, but
that would push the pain onto everybody, where few are going to care.

By creating a 'Headers' type which impliments 'Associative' the users
can interact with headers as simply as if it were a
Dict{String,String}, but it's still safe for duplicate headers.

Unfortunately, HTTP can have duplicate headers, namely 'Set-Cookie'.
We could just store headers as Dict{String,Vector{String}}, but
that would push the pain onto everybody, where few are going to care.

By creating a 'Headers' type which impliments 'Associative' the users
can interact with headers as simply as if it were a
Dict{String,String}, but it's still safe for duplicate headers.
@coveralls
Copy link

Coverage Status

Coverage increased (+0.43%) when pulling 91192ea on srp:headers into 83579f7 on JuliaWeb:master.

@jiahao
Copy link

jiahao commented Oct 29, 2014

This looks like a good change, but perhaps it makes more sense to contribute a general purpose Associative type to JuliaLang/DataStructures.jl and then use it here for HTTP headers.

@srp
Copy link
Author

srp commented Oct 29, 2014

Associative already exists and is an abstract type for things like Dict. But you're right, having a "multimap" type Dict could be useful for others, so I'll look into that

@wildart
Copy link
Collaborator

wildart commented May 3, 2015

@malmaud
Copy link
Contributor

malmaud commented Aug 14, 2015

@srp DataStructures.jl now contains a SortedMultidict type. Are you still interested in working on this PR, or shall I take it over (no pressure either way)?

@srp
Copy link
Author

srp commented Aug 14, 2015

Awesome, I hadn't seen that! Feel free to work on it, I probably won't get
to it anytime soon. Thanks

On Thu, Aug 13, 2015 at 7:17 PM, Jonathan Malmaud notifications@github.com
wrote:

@srp https://github.com/srp DataStructures.jl now contains a
SortedMultidict type. Are you still interested in working on this PR, or
shall I take it over (no pressure either way)?


Reply to this email directly or view it on GitHub
#20 (comment)
.

@malmaud
Copy link
Contributor

malmaud commented Aug 27, 2015

I'm going to close this for now in favor of #24, which essentailly special-cases cookies. If repeated headers besides set-cookie are actually a real problem for your use case, please reopen and we can think of a solution.

@malmaud malmaud closed this Aug 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants