-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Set Headers now iterates over key #413
Conversation
The NameValueCollection iterator returns the string key, not a KeyValuePair.
Tabs -> spaces per cefsharp guidelines.
@rlmcneary2 Thanks for the contribution! Much appreciated 😄 As auto values = headers->GetValues(key);
for each (String^ val in values)
{
CefString value = StringUtils::ToNative(val);
hm.insert(std::make_pair(name, value));
} Thoughts? |
Out of curiosity, in what scenario do you manually Set headers? |
@amaitland I don't use NameValueCollection often so I forgot it allows duplicate keys. What's the process? Should go ahead and make the change and submit a new pull request? Way too long answer to second comment - Long ago I created a small set of interfaces around the C# WebBrowser control (IE) that is used in a product I work on. Later there was a desire to have the same browser available on XP and Win7, and to use a "modern" browser. So I implemented the same interfaces around CefSharp1 (now we can decide at runtime which browser to start). At that time I needed to set headers and the only way to get it to work consistently was through the OnBeforeResourceLoad method. Two headers are set: "Accept-Language" because we always have the OS in US English but allow the application language to be changed while the application is running, and "User-Agent" because some web sites (Face_COUGH_book) sniff the user agent and return a mobile or desktop layout based on that even if you have requested a specific layout. Now that I'm implementing CefSharp3 (to get an even "moderner" browser) I just want to do as much of a search and replace of CefSharp1 as I can. |
For each key get each of the values that matches the key.
@rlmcneary2 No need to create a new PR, you can simply commit changes then push, and they should appear here no problem. Thanks for the long/short answer, always curious about how people are using CefSharp 😄 |
@rlmcneary2 I see you've pushed another change, nice! 😄 I'll check it out tomorrow, first glance looks 👍 |
Works as advertised 👍 Thanks! |
Set Headers now iterates over key
The NameValueCollection iterator returns the string key, not a KeyValuePair.