Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7182)

Unified Diff: chrome_frame/http_negotiate.cc

Issue 4792002: Fix a crash in the code which attempts to append the user agent to the list o... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/http_negotiate.cc
===================================================================
--- chrome_frame/http_negotiate.cc (revision 65626)
+++ chrome_frame/http_negotiate.cc (working copy)
@@ -135,22 +135,23 @@
DCHECK(headers);
using net::HttpUtil;
- std::string ascii_headers(WideToASCII(headers));
+ if (headers) {
+ std::string ascii_headers(WideToASCII(headers));
- // Extract "User-Agent" from the headers.
- HttpUtil::HeadersIterator headers_iterator(ascii_headers.begin(),
- ascii_headers.end(), "\r\n");
+ // Extract "User-Agent" from the headers.
+ HttpUtil::HeadersIterator headers_iterator(ascii_headers.begin(),
+ ascii_headers.end(), "\r\n");
- // Build new headers, skip the existing user agent value from
- // existing headers.
- std::string new_headers;
- while (headers_iterator.GetNext()) {
- std::string name(headers_iterator.name());
- if (!LowerCaseEqualsASCII(name, kLowerCaseUserAgent)) {
- new_headers += name + ": " + headers_iterator.values() + "\r\n";
+ // Build new headers, skip the existing user agent value from
+ // existing headers.
+ std::string new_headers;
+ while (headers_iterator.GetNext()) {
+ std::string name(headers_iterator.name());
+ if (!LowerCaseEqualsASCII(name, kLowerCaseUserAgent)) {
+ new_headers += name + ": " + headers_iterator.values() + "\r\n";
+ }
}
}
-
new_headers += "User-Agent: " + user_agent_value;
new_headers += "\r\n";
return new_headers;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698