OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "net/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
6 | 6 |
7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 } | 546 } |
547 | 547 |
548 void URLRequestHttpJob::AddExtraHeaders() { | 548 void URLRequestHttpJob::AddExtraHeaders() { |
549 // Supply Accept-Encoding headers first so that it is more likely that they | 549 // Supply Accept-Encoding headers first so that it is more likely that they |
550 // will be in the first transmitted packet. This can sometimes make it easier | 550 // will be in the first transmitted packet. This can sometimes make it easier |
551 // to filter and analyze the streams to assure that a proxy has not damaged | 551 // to filter and analyze the streams to assure that a proxy has not damaged |
552 // these headers. Some proxies deliberately corrupt Accept-Encoding headers. | 552 // these headers. Some proxies deliberately corrupt Accept-Encoding headers. |
553 if (!SdchManager::Global() || | 553 if (!SdchManager::Global() || |
554 !SdchManager::Global()->IsInSupportedDomain(request_->url())) { | 554 !SdchManager::Global()->IsInSupportedDomain(request_->url())) { |
555 // Tell the server what compression formats we support (other than SDCH). | 555 // Tell the server what compression formats we support (other than SDCH). |
556 request_info_.extra_headers += "Accept-Encoding: gzip,deflate,bzip2\r\n"; | 556 request_info_.extra_headers += "Accept-Encoding: gzip,deflate\r\n"; |
557 } else { | 557 } else { |
558 // Supply SDCH related headers, as well as accepting that encoding. | 558 // Supply SDCH related headers, as well as accepting that encoding. |
559 // Tell the server what compression formats we support. | 559 // Tell the server what compression formats we support. |
560 request_info_.extra_headers += "Accept-Encoding: " | 560 request_info_.extra_headers += "Accept-Encoding: " |
561 "gzip,deflate,bzip2,sdch\r\n"; | 561 "gzip,deflate,sdch\r\n"; |
562 | 562 |
563 // TODO(jar): See if it is worth optimizing away these bytes when the URL is | 563 // TODO(jar): See if it is worth optimizing away these bytes when the URL is |
564 // probably an img or such. (and SDCH encoding is not likely). | 564 // probably an img or such. (and SDCH encoding is not likely). |
565 std::string avail_dictionaries; | 565 std::string avail_dictionaries; |
566 SdchManager::Global()->GetAvailDictionaryList(request_->url(), | 566 SdchManager::Global()->GetAvailDictionaryList(request_->url(), |
567 &avail_dictionaries); | 567 &avail_dictionaries); |
568 if (!avail_dictionaries.empty()) { | 568 if (!avail_dictionaries.empty()) { |
569 request_info_.extra_headers += "Avail-Dictionary: " | 569 request_info_.extra_headers += "Avail-Dictionary: " |
570 + avail_dictionaries + "\r\n"; | 570 + avail_dictionaries + "\r\n"; |
571 request_info_.load_flags |= net::LOAD_SDCH_DICTIONARY_ADVERTISED; | 571 request_info_.load_flags |= net::LOAD_SDCH_DICTIONARY_ADVERTISED; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 DCHECK(response_info_); | 606 DCHECK(response_info_); |
607 DCHECK(response_cookies_.empty()); | 607 DCHECK(response_cookies_.empty()); |
608 | 608 |
609 std::string name = "Set-Cookie"; | 609 std::string name = "Set-Cookie"; |
610 std::string value; | 610 std::string value; |
611 | 611 |
612 void* iter = NULL; | 612 void* iter = NULL; |
613 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) | 613 while (response_info_->headers->EnumerateHeader(&iter, name, &value)) |
614 response_cookies_.push_back(value); | 614 response_cookies_.push_back(value); |
615 } | 615 } |
OLD | NEW |