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

Side by Side Diff: ios/net/protocol_handler_util.mm

Issue 1594973004: Remove use of void** from HttpResponseHeaders::EnumerateHeaderLines (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 4 years, 11 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/net/protocol_handler_util.h" 5 #import "ios/net/protocol_handler_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/i18n/icu_encoding_detection.h" 10 #include "base/i18n/icu_encoding_detection.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return [[[NSURLResponse alloc] initWithURL:url 83 return [[[NSURLResponse alloc] initWithURL:url
84 MIMEType:mime_type 84 MIMEType:mime_type
85 expectedContentLength:-1 85 expectedContentLength:-1
86 textEncodingName:charset] autorelease]; 86 textEncodingName:charset] autorelease];
87 } else { 87 } else {
88 // Iterate over all the headers and copy them. 88 // Iterate over all the headers and copy them.
89 bool has_content_type_header = false; 89 bool has_content_type_header = false;
90 NSMutableDictionary* header_fields = [NSMutableDictionary dictionary]; 90 NSMutableDictionary* header_fields = [NSMutableDictionary dictionary];
91 HttpResponseHeaders* headers = request->response_headers(); 91 HttpResponseHeaders* headers = request->response_headers();
92 if (headers != nullptr) { 92 if (headers != nullptr) {
93 void* iter = nullptr; 93 size_t iter = 0;
94 std::string name, value; 94 std::string name, value;
95 while (headers->EnumerateHeaderLines(&iter, &name, &value)) { 95 while (headers->EnumerateHeaderLines(&iter, &name, &value)) {
96 NSString* key = base::SysUTF8ToNSString(name); 96 NSString* key = base::SysUTF8ToNSString(name);
97 if (!key) { 97 if (!key) {
98 DLOG(ERROR) << "Header name is not in UTF8: " << name; 98 DLOG(ERROR) << "Header name is not in UTF8: " << name;
99 // Skip the invalid header. 99 // Skip the invalid header.
100 continue; 100 continue;
101 } 101 }
102 // Do not copy "Cache-Control" headers as we provide our own controls. 102 // Do not copy "Cache-Control" headers as we provide our own controls.
103 if ([key caseInsensitiveCompare:@"cache-control"] == NSOrderedSame) 103 if ([key caseInsensitiveCompare:@"cache-control"] == NSOrderedSame)
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 if (out_request->has_upload() && out_request->method() == "POST") { 204 if (out_request->has_upload() && out_request->method() == "POST") {
205 DLOG_IF(WARNING, !net_headers.HasHeader(HttpRequestHeaders::kContentType)) 205 DLOG_IF(WARNING, !net_headers.HasHeader(HttpRequestHeaders::kContentType))
206 << "Missing \"Content-Type\" header in POST request."; 206 << "Missing \"Content-Type\" header in POST request.";
207 net_headers.SetHeaderIfMissing(HttpRequestHeaders::kContentType, 207 net_headers.SetHeaderIfMissing(HttpRequestHeaders::kContentType,
208 "application/x-www-form-urlencoded"); 208 "application/x-www-form-urlencoded");
209 } 209 }
210 out_request->SetExtraRequestHeaders(net_headers); 210 out_request->SetExtraRequestHeaders(net_headers);
211 } 211 }
212 212
213 } // namespace net 213 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698