Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(610)

Side by Side Diff: net/base/fixed_host_resolver.cc

Issue 345034: Add a command line flag to force all network traffic through a particular ser... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/base/fixed_host_resolver.h ('k') | net/base/host_resolver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/base/fixed_host_resolver.h"
6
7 #include "net/base/net_errors.h"
8 #include "net/base/net_util.h"
9 #include "net/base/host_resolver_impl.h"
10
11 namespace net {
12
13 FixedHostResolver::FixedHostResolver(const std::string& host_and_port)
14 : initialized_(false) {
15 std::string host;
16 int port = 0;
17 if (!ParseHostAndPort(host_and_port, &host, &port)) {
18 LOG(ERROR) << "Invalid FixedHostResolver information: " << host_and_port;
19 return;
20 }
21
22 int rv = SystemHostResolverProc(host, net::ADDRESS_FAMILY_UNSPECIFIED,
23 &address_);
24 if (rv != OK) {
25 LOG(ERROR) << "Could not resolve fixed host: " << host;
26 return;
27 }
28
29 if (port <= 0) {
30 LOG(ERROR) << "FixedHostResolver must contain a port number";
31 return;
32 }
33
34 address_.SetPort(port);
35 initialized_ = true;
36 }
37
38 int FixedHostResolver::Resolve(const RequestInfo& info,
39 AddressList* addresses,
40 CompletionCallback* callback,
41 RequestHandle* out_req,
42 LoadLog* load_log) {
43 if (!initialized_)
44 return ERR_NAME_NOT_RESOLVED;
45
46 DCHECK(addresses);
47 *addresses = address_;
48 return OK;
49 }
50
51 } // namespace net
52
OLDNEW
« no previous file with comments | « net/base/fixed_host_resolver.h ('k') | net/base/host_resolver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698