OLD | NEW |
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 Loading... |
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 if (base::EqualsCaseInsensitiveASCII( |
379 net::HttpRequestHeaders::kContentLength) == 0) { | 379 header.name, net::HttpRequestHeaders::kContentLength)) { |
380 continue; | 380 continue; |
381 } else if (base::strcasecmp(header.name.data(), | 381 } else if (base::EqualsCaseInsensitiveASCII( |
382 net::HttpRequestHeaders::kContentType) == 0) { | 382 header.name, net::HttpRequestHeaders::kContentType)) { |
383 content_type = header.value; | 383 content_type = header.value; |
384 continue; | 384 continue; |
385 } | 385 } |
386 } | 386 } |
387 info.AddHeader(header.name, header.value); | 387 info.AddHeader(header.name, header.value); |
388 } | 388 } |
389 | 389 |
390 if (body) | 390 if (body) |
391 info.SetBody(*body, content_type); | 391 info.SetBody(*body, content_type); |
392 | 392 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 // The close operation is initiated by this object. | 424 // The close operation is initiated by this object. |
425 NotifyOwnerCloseIfAllDone(); | 425 NotifyOwnerCloseIfAllDone(); |
426 } else { | 426 } else { |
427 // The close operation is initiated by |web_socket_|; start closing this | 427 // The close operation is initiated by |web_socket_|; start closing this |
428 // object. | 428 // object. |
429 Close(); | 429 Close(); |
430 } | 430 } |
431 } | 431 } |
432 | 432 |
433 } // namespace mojo | 433 } // namespace mojo |
OLD | NEW |