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

Side by Side Diff: net/base/net_util.h

Issue 6711046: Add an opt-out header for HTTP throttling. Never throttle for localhost. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 9 years, 9 months 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef NET_BASE_NET_UTIL_H_ 5 #ifndef NET_BASE_NET_UTIL_H_
6 #define NET_BASE_NET_UTIL_H_ 6 #define NET_BASE_NET_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 // Returns the value of |info's| port (in host byte ordering). 421 // Returns the value of |info's| port (in host byte ordering).
422 int GetPortFromAddrinfo(const struct addrinfo* info); 422 int GetPortFromAddrinfo(const struct addrinfo* info);
423 423
424 // Same except for struct sockaddr. 424 // Same except for struct sockaddr.
425 const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address, 425 const uint16* GetPortFieldFromSockaddr(const struct sockaddr* address,
426 socklen_t address_len); 426 socklen_t address_len);
427 int GetPortFromSockaddr(const struct sockaddr* address, 427 int GetPortFromSockaddr(const struct sockaddr* address,
428 socklen_t address_len); 428 socklen_t address_len);
429 429
430 // Returns true if |host| is one of the names (e.g. "localhost") or IP
431 // addresses (IPv4 127.0.0.0/8 or IPv6 ::1) that indicate a loopback.
432 //
433 // Note that this function does not check for IP addresses other than
434 // the above that have been mapped back to the local machine, i.e.
wtc 2011/03/25 19:06:24 Nit: "mapped back to the local machine" is a littl
Jói 2011/03/25 21:26:51 Yes, I mean via /etc/hosts or by the host admin ma
435 // it only checks for IP addresses that by definition are loopback
436 // addresses.
437 bool IsLocalhost(const std::string& host);
438
430 // struct that is used by GetNetworkList() to represent a network 439 // struct that is used by GetNetworkList() to represent a network
431 // interface. 440 // interface.
432 struct NetworkInterface { 441 struct NetworkInterface {
433 NetworkInterface(); 442 NetworkInterface();
434 NetworkInterface(const std::string& name, const IPAddressNumber& address); 443 NetworkInterface(const std::string& name, const IPAddressNumber& address);
435 ~NetworkInterface(); 444 ~NetworkInterface();
436 445
437 std::string name; 446 std::string name;
438 IPAddressNumber address; 447 IPAddressNumber address;
439 }; 448 };
440 449
441 typedef std::list<NetworkInterface> NetworkInterfaceList; 450 typedef std::list<NetworkInterface> NetworkInterfaceList;
442 451
443 // Returns list of network interfaces except loopback interface. If an 452 // Returns list of network interfaces except loopback interface. If an
444 // interface has more than one address, a separate entry is added to 453 // interface has more than one address, a separate entry is added to
445 // the list for each address. 454 // the list for each address.
446 // Can be called only on a thread that allows IO. 455 // Can be called only on a thread that allows IO.
447 bool GetNetworkList(NetworkInterfaceList* networks); 456 bool GetNetworkList(NetworkInterfaceList* networks);
448 457
449 } // namespace net 458 } // namespace net
450 459
451 #endif // NET_BASE_NET_UTIL_H_ 460 #endif // NET_BASE_NET_UTIL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698