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