-
Notifications
You must be signed in to change notification settings - Fork 378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Headers lost when recieving headers with same key #158
Comments
I agree with ElonDusk, that changing HeaderField from std::map to std::multimap would be a good idea. That std::multimap should use the same caseless sorting, that I have already proposed in #157 Unfortunately, changing to multimap is going to break code, that already uses this library, as std::map::at() and std::map::operator[], which are commonly used to search for header fields, have no counterparts in std::multimap. Instead, std::multimap::find() and std::multimap::equal_range() need to be used now, which makes code more lengthy. So this old code:
now becomes something ugly like this:
On the other hand, the library user would now be able to iterate over all Cookies received:
Suggestion
Any further suggestions? |
@ElonDusk26 and @KaiPetzke maybe the two of you could work together on that change? |
Expected behaviour
the following code sends a request to instagram and prints all of the recieved headers in to the console:
outputs:
Where it should be:
Theres a difference in the headers but the point is that its deleting set-cookie headers instead of appending them with something like an id or index number.
Solution
Append headers with an id as to not overwrite existing headers.
EDIT:
After doing some digging i found that HeaderField is made of std::map<std::string, std::string> which is not optimal, should be changed to a multimap to support multiple values of same key
The text was updated successfully, but these errors were encountered: