Home | History | Annotate | Download | only in dump_cache
      1 // Copyright (c) 2010 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 #ifndef NET_TOOLS_DUMP_CACHE_URL_UTILITIES_H_
      6 #define NET_TOOLS_DUMP_CACHE_URL_UTILITIES_H_
      7 
      8 #include <string>
      9 
     10 namespace net {
     11 
     12 struct UrlUtilities {
     13   // Gets the host from an url, strips the port number as well if the url
     14   // has one.
     15   // For example: calling GetUrlHost(www.foo.com:8080/boo) returns www.foo.com
     16   static std::string GetUrlHost(const std::string& url);
     17 
     18   // Get the host + path portion of an url
     19   // e.g   http://www.foo.com/path
     20   //       returns www.foo.com/path
     21   static std::string GetUrlHostPath(const std::string& url);
     22 
     23   // Gets the path portion of an url.
     24   // e.g   http://www.foo.com/path
     25   //       returns /path
     26   static std::string GetUrlPath(const std::string& url);
     27 
     28   // Unescape a url, converting all %XX to the the actual char 0xXX.
     29   // For example, this will convert "foo%21bar" to "foo!bar".
     30   static std::string Unescape(const std::string& escaped_url);
     31 };
     32 
     33 }  // namespace net
     34 
     35 #endif  // NET_TOOLS_DUMP_CACHE_URL_UTILITIES_H_
     36