From f6fb2de77993bbd88931ba205b0cc1e3423111f6 Mon Sep 17 00:00:00 2001 From: "ericroman@google.com" Date: Thu, 19 Feb 2009 08:11:42 +0000 Subject: Add parsing for PAC result strings -- ProxyInfo::UsePacString(). Added the support class ProxyServer to avoid losing the proxy server's type information (http, socks) when populating the list. The format of the configuration strings has been extended accordingly to include an optional ["://"] prefix. (i.e. "http://", "socks4://", "socks5://"). Review URL: http://codereview.chromium.org/20398 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10010 0039d316-1c4b-4281-b951-d872f2087c98 --- net/base/net_util.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'net/base/net_util.h') diff --git a/net/base/net_util.h b/net/base/net_util.h index ddaa77b..e62e95a 100644 --- a/net/base/net_util.h +++ b/net/base/net_util.h @@ -40,6 +40,19 @@ bool FileURLToFilePath(const GURL& url, FilePath* file_path); // Deprecated temporary compatibility function. bool FileURLToFilePath(const GURL& url, std::wstring* file_path); +// Split an input of the form [":"] into its consitituent parts. +// Saves the result into |*host| and |*port|. If the input did not have +// the optional port, sets |*port| to -1. +// Returns true if the parsing was successful, false otherwise. +// TODO(eroman): support IPv6 literals. +bool GetHostAndPort(std::string::const_iterator host_and_port_begin, + std::string::const_iterator host_and_port_end, + std::string* host, + int* port); +bool GetHostAndPort(const std::string& host_and_port, + std::string* host, + int* port); + // Return the value of the HTTP response header with name 'name'. 'headers' // should be in the format that URLRequest::GetResponseHeaders() returns. // Returns the empty string if the header is not found. -- cgit v1.1