Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Private Member Functions
nsUrlClassifierUtils Class Reference

#include <nsUrlClassifierUtils.h>

Inheritance diagram for nsUrlClassifierUtils:
Inheritance graph
Collaboration diagram for nsUrlClassifierUtils:
Collaboration graph

List of all members.

Public Member Functions

 nsUrlClassifierUtils ()
 ~nsUrlClassifierUtils ()
SpecialEncode (const nsACString &url, nsACString &_retval)
ACString canonicalizeURL (in ACString url)
 Canonicalize a URL.

Private Member Functions

 nsUrlClassifierUtils (const nsUrlClassifierUtils &)
PRBool ShouldURLEscape (const unsigned char c) const

Detailed Description

Definition at line 42 of file nsUrlClassifierUtils.h.

Constructor & Destructor Documentation

Definition at line 48 of file nsUrlClassifierUtils.cpp.


Definition at line 46 of file nsUrlClassifierUtils.h.


Member Function Documentation

ACString nsIUrlClassifierUtils::canonicalizeURL ( in ACString  url) [inherited]

Canonicalize a URL.

DON'T USE THIS DIRECTLY. Use PROT_EnchashDecrypter.prototype.getCanonicalUrl instead. This method url-decodes a string, but it doesn't normalize the hostname. The method in EnchashDecrypter first calls this method, then normalizes the hostname.

urlString to canonicalize
String containing the canonicalized url (maximally url-decoded, then specially url-encoded)
PRBool nsUrlClassifierUtils::ShouldURLEscape ( const unsigned char  c) const [private]

Definition at line 100 of file nsUrlClassifierUtils.cpp.

  return c <= 32 || c == '%' || c >=127;

Here is the caller graph for this function:

PRBool nsUrlClassifierUtils::SpecialEncode ( const nsACString &  url,
nsACString &  _retval 

Definition at line 72 of file nsUrlClassifierUtils.cpp.

  PRBool changed = PR_FALSE;
  const char* curChar = url.BeginReading();
  const char* end = url.EndReading();

  while (curChar != end) {
    unsigned char c = NS_STATIC_CAST(unsigned char, *curChar);
    if (ShouldURLEscape(c)) {
      // We don't want to deal with 0, as it can break certain strings, just
      // encode as one.
      if (c == 0)
        c = 1;

      _retval.Append(int_to_hex_digit(c / 16));
      _retval.Append(int_to_hex_digit(c % 16));

      changed = PR_TRUE;
    } else {
  return changed;

Here is the call graph for this function:

Here is the caller graph for this function:

The documentation for this class was generated from the following files: