blob: 0349232d6092f5a32de21dc65847e17e7a9c1573 (
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright (c) 2010 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/base/mapped_host_resolver.h"
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "net/base/host_port_pair.h"
#include "net/base/net_util.h"
namespace net {
MappedHostResolver::MappedHostResolver(HostResolver* impl)
: impl_(impl) {
}
int MappedHostResolver::Resolve(const RequestInfo& info,
AddressList* addresses,
CompletionCallback* callback,
RequestHandle* out_req,
const BoundNetLog& net_log) {
// Modify the request before forwarding it to |impl_|.
RequestInfo modified_info = info;
HostPortPair host_port(info.hostname(), info.port());
if (rules_.RewriteHost(&host_port)) {
modified_info.set_hostname(host_port.host());
modified_info.set_port(host_port.port());
}
return impl_->Resolve(modified_info, addresses, callback, out_req, net_log);
}
void MappedHostResolver::CancelRequest(RequestHandle req) {
impl_->CancelRequest(req);
}
void MappedHostResolver::AddObserver(Observer* observer) {
impl_->AddObserver(observer);
}
void MappedHostResolver::RemoveObserver(Observer* observer) {
impl_->RemoveObserver(observer);
}
HostResolverImpl* MappedHostResolver::GetAsHostResolverImpl() {
return impl_->GetAsHostResolverImpl();
}
MappedHostResolver::~MappedHostResolver() {
}
} // namespace net
|