OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "url_request_peer.h" | 5 #include "url_request_peer.h" |
6 | 6 |
7 #include "base/strings/string_number_conversions.h" | 7 #include "base/strings/string_number_conversions.h" |
8 #include "net/base/load_flags.h" | 8 #include "net/base/load_flags.h" |
9 #include "net/http/http_status_code.h" | 9 #include "net/http/http_status_code.h" |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 68 |
69 | 69 |
70 std::string URLRequestPeer::GetHeader(const std::string &name) const { | 70 std::string URLRequestPeer::GetHeader(const std::string &name) const { |
71 std::string value; | 71 std::string value; |
72 if (url_request_ != NULL) { | 72 if (url_request_ != NULL) { |
73 url_request_->GetResponseHeaderByName(name, &value); | 73 url_request_->GetResponseHeaderByName(name, &value); |
74 } | 74 } |
75 return value; | 75 return value; |
76 } | 76 } |
77 | 77 |
78 bool URLRequestPeer::GetFullRequestHeaders( | |
79 net::HttpRequestHeaders* headers) const { | |
80 if (url_request_ == NULL) { | |
81 return false; | |
82 } | |
83 return url_request_->GetFullRequestHeaders(headers); | |
mef
2014/08/04 21:12:43
This returns *request* headers, not *response* hea
miloslav
2014/08/18 17:42:25
Oh my, I must have been really tired before my vac
| |
84 } | |
85 | |
86 | |
78 void URLRequestPeer::Start() { | 87 void URLRequestPeer::Start() { |
79 context_->GetNetworkTaskRunner()->PostTask( | 88 context_->GetNetworkTaskRunner()->PostTask( |
80 FROM_HERE, | 89 FROM_HERE, |
81 base::Bind(&URLRequestPeer::OnInitiateConnection, | 90 base::Bind(&URLRequestPeer::OnInitiateConnection, |
82 base::Unretained(this))); | 91 base::Unretained(this))); |
83 } | 92 } |
84 | 93 |
85 void URLRequestPeer::OnAppendChunk(const char* bytes, | 94 void URLRequestPeer::OnAppendChunk(const char* bytes, |
86 int bytes_len, | 95 int bytes_len, |
87 bool is_last_chunk) { | 96 bool is_last_chunk) { |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 | 280 |
272 delegate_->OnBytesRead(this); | 281 delegate_->OnBytesRead(this); |
273 delegate_->OnRequestFinished(this); | 282 delegate_->OnRequestFinished(this); |
274 } | 283 } |
275 | 284 |
276 unsigned char* URLRequestPeer::Data() const { | 285 unsigned char* URLRequestPeer::Data() const { |
277 return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer()); | 286 return reinterpret_cast<unsigned char*>(read_buffer_->StartOfBuffer()); |
278 } | 287 } |
279 | 288 |
280 } // namespace cronet | 289 } // namespace cronet |
OLD | NEW |