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

Side by Side Diff: mojo/services/network/http_connection_impl.cc

Issue 1224553010: Replace base::str[n]casecmp with helper functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « media/video/capture/fake_video_capture_device_factory.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #include "mojo/services/network/http_connection_impl.h" 5 #include "mojo/services/network/http_connection_impl.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 std::string content_type; 368 std::string content_type;
369 for (size_t i = 0; i < response->headers.size(); ++i) { 369 for (size_t i = 0; i < response->headers.size(); ++i) {
370 const HttpHeader& header = *(response->headers[i]); 370 const HttpHeader& header = *(response->headers[i]);
371 371
372 if (body) { 372 if (body) {
373 // net::HttpServerResponseInfo::SetBody() automatically sets 373 // net::HttpServerResponseInfo::SetBody() automatically sets
374 // Content-Length and Content-Types, so skip the two here. 374 // Content-Length and Content-Types, so skip the two here.
375 // 375 //
376 // TODO(yzshen): Consider adding to net::HttpServerResponseInfo a simple 376 // TODO(yzshen): Consider adding to net::HttpServerResponseInfo a simple
377 // setter for body which doesn't fiddle with headers. 377 // setter for body which doesn't fiddle with headers.
378 if (base::strcasecmp(header.name.data(), 378 base::StringPiece name_piece(header.name.data(), header.name.size());
379 net::HttpRequestHeaders::kContentLength) == 0) { 379 if (base::EqualsCaseInsensitiveASCII(
380 name_piece, net::HttpRequestHeaders::kContentLength)) {
380 continue; 381 continue;
381 } else if (base::strcasecmp(header.name.data(), 382 } else if (base::EqualsCaseInsensitiveASCII(
382 net::HttpRequestHeaders::kContentType) == 0) { 383 name_piece, net::HttpRequestHeaders::kContentType)) {
383 content_type = header.value; 384 content_type = header.value;
384 continue; 385 continue;
385 } 386 }
386 } 387 }
387 info.AddHeader(header.name, header.value); 388 info.AddHeader(header.name, header.value);
388 } 389 }
389 390
390 if (body) 391 if (body)
391 info.SetBody(*body, content_type); 392 info.SetBody(*body, content_type);
392 393
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // The close operation is initiated by this object. 425 // The close operation is initiated by this object.
425 NotifyOwnerCloseIfAllDone(); 426 NotifyOwnerCloseIfAllDone();
426 } else { 427 } else {
427 // The close operation is initiated by |web_socket_|; start closing this 428 // The close operation is initiated by |web_socket_|; start closing this
428 // object. 429 // object.
429 Close(); 430 Close();
430 } 431 }
431 } 432 }
432 433
433 } // namespace mojo 434 } // namespace mojo
OLDNEW
« no previous file with comments | « media/video/capture/fake_video_capture_device_factory.cc ('k') | net/base/mime_sniffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698