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 "net/url_request/url_range_request_job.h" | 5 #include "net/url_request/url_range_request_job.h" |
6 | 6 |
7 #include "net/base/net_errors.h" | 7 #include "net/base/net_errors.h" |
8 #include "net/http/http_request_headers.h" | 8 #include "net/http/http_request_headers.h" |
9 #include "net/http/http_util.h" | 9 #include "net/http/http_util.h" |
10 | 10 |
11 namespace net { | 11 namespace net { |
12 | 12 |
13 URLRangeRequestJob::URLRangeRequestJob(URLRequest* request, | 13 URLRangeRequestJob::URLRangeRequestJob(URLRequest* request, |
14 NetworkDelegate* delegate) | 14 NetworkDelegate* delegate) |
15 : URLRequestJob(request, delegate), range_parse_result_(OK) { | 15 : URLRequestJob(request, delegate), range_parse_result_(OK) { |
16 } | 16 } |
17 | 17 |
18 URLRangeRequestJob::~URLRangeRequestJob() { | 18 URLRangeRequestJob::~URLRangeRequestJob() { |
19 } | 19 } |
20 | 20 |
21 void URLRangeRequestJob::SetExtraRequestHeaders( | 21 void URLRangeRequestJob::SetExtraRequestHeaders( |
22 const HttpRequestHeaders& headers) { | 22 const HttpRequestHeaders& headers) { |
23 std::string range_header; | 23 std::string range_header; |
24 if (headers.GetHeader(HttpRequestHeaders::kRange, &range_header)) { | 24 if (headers.GetHeader(HttpRequestHeaders::kRange, &range_header)) { |
25 if (!HttpUtil::ParseRangeHeader(range_header, &ranges_)) { | 25 if (!HttpUtil::ParseRangeHeader(range_header, &ranges_)) { |
26 range_parse_result_ = ERR_REQUEST_RANGE_NOT_SATISFIABLE; | 26 range_parse_result_ = ERR_REQUEST_RANGE_NOT_SATISFIABLE; |
27 } | 27 } |
28 } | 28 } |
29 } | 29 } |
30 | 30 |
31 } // namespace net | 31 } // namespace net |
OLD | NEW |