summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_range_request_job.cc
blob: cad7b83604d83ea7502454052e93b60fe2eae370 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "net/url_request/url_range_request_job.h"

#include "net/base/net_errors.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_util.h"

namespace net {

URLRangeRequestJob::URLRangeRequestJob(URLRequest* request,
    NetworkDelegate* delegate)
    : URLRequestJob(request, delegate), range_parse_result_(OK) {
}

URLRangeRequestJob::~URLRangeRequestJob() {
}

void URLRangeRequestJob::SetExtraRequestHeaders(
    const HttpRequestHeaders& headers) {
  std::string range_header;
  if (headers.GetHeader(HttpRequestHeaders::kRange, &range_header)) {
    if (!HttpUtil::ParseRangeHeader(range_header, &ranges_)) {
      range_parse_result_ = ERR_REQUEST_RANGE_NOT_SATISFIABLE;
    }
  }
}

}  // namespace net