Back to index

lightning-sunbird  0.9+nobinonly
Defines | Enumerations | Functions | Variables
nsURLHelper.h File Reference
#include "nsString.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NET_MAX_ADDRESS   (((char*)0)-1)

Enumerations

enum  netCoalesceFlags { NET_COALESCE_NORMAL = 0, NET_COALESCE_ALLOW_RELATIVE_ROOT = 1<<0, NET_COALESCE_DOUBLE_SLASH_IS_ROOT = 1<<1 }

Functions

 NS_HIDDEN_ (void) net_ParseContentType(const nsACString &aHeaderStr
 Parses a content-type header and returns the content type and charset (if any).
 NS_HIDDEN_ (nsIURLParser *) net_GetAuthURLParser()
 NS_HIDDEN_ (nsresult) net_ResolveRelativePath(const nsACString &relativePath
 Resolves a relative path string containing "." and ".." with respect to a base path (assumed to already be resolved).
 NS_HIDDEN_ (PRBool) net_FilterURIString(const char *str
 Filter out whitespace from a URI string.
PRBool net_IsValidScheme (const nsAFlatCString &scheme)
 NS_HIDDEN_ (char *) net_FindCharInSet(const char *str
 returns pointer to first character of |str| in the given set.
char * net_FindCharInSet (const char *str, const char *set)
char * net_FindCharNotInSet (const char *str, const char *set)
char * net_RFindCharInSet (const char *str, const char *set)
char * net_RFindCharNotInSet (const char *str, const char *set)

Variables

nsACString nsIFile nsACString & outDirectory
nsACString nsIFile nsACString
nsACString & 
outFileBaseName
nsACString nsIFile nsACString
nsACString nsACString & 
outFileExtension
char * path
const nsACString & basePath
const nsACString nsACString & result
PRUint32startPos
PRUint32 PRUint32endPos
PRUint32 PRUint32 nsACString * scheme = nsnull)
PRUint32 schemeLen
PRUint32 length
const char * end
const char const char * set
nsACString & aContentType
nsACString nsACString & aContentCharset
nsACString nsACString PRBoolaHadCharset

Define Documentation

#define NET_MAX_ADDRESS   (((char*)0)-1)

Definition at line 213 of file nsURLHelper.h.


Enumeration Type Documentation

Enumerator:
NET_COALESCE_NORMAL 
NET_COALESCE_ALLOW_RELATIVE_ROOT 

retains /../ that reach above dir root (useful for FTP servers in which the root of the FTP URL is not necessarily the root of the FTP filesystem).

NET_COALESCE_DOUBLE_SLASH_IS_ROOT 

recognizes /%2F and // as markers for the root directory and handles them properly.

Definition at line 46 of file nsURLHelper.h.


Function Documentation

char* net_FindCharInSet ( const char *  str,
const char *  set 
) [inline]

Definition at line 215 of file nsURLHelper.h.

Here is the call graph for this function:

char* net_FindCharNotInSet ( const char *  str,
const char *  set 
) [inline]

Definition at line 219 of file nsURLHelper.h.

Here is the call graph for this function:

PRBool net_IsValidScheme ( const nsAFlatCString scheme) [inline]

Definition at line 122 of file nsURLHelper.h.

{
    return net_IsValidScheme(scheme.get(), scheme.Length());
}

Here is the call graph for this function:

char* net_RFindCharInSet ( const char *  str,
const char *  set 
) [inline]

Definition at line 223 of file nsURLHelper.h.

{
    return net_RFindCharInSet(str, str + strlen(str), set);
}

Here is the call graph for this function:

char* net_RFindCharNotInSet ( const char *  str,
const char *  set 
) [inline]

Definition at line 227 of file nsURLHelper.h.

{
    return net_RFindCharNotInSet(str, str + strlen(str), set);
}

Here is the call graph for this function:

NS_HIDDEN_ ( void  ) const

Parses a content-type header and returns the content type and charset (if any).

aCharset is not modified if no charset is specified in anywhere in aHeaderStr. In that case (no charset specified), aHadCharset is set to false. Otherwise, it's set to true. Note that aContentCharset can be empty even if aHadCharset is true.

NS_HIDDEN_ ( nsresult  ) const

Resolves a relative path string containing "." and ".." with respect to a base path (assumed to already be resolved).

Extract URI-Scheme if possible.

For example, resolving "../../foo/./bar/../baz.html" w.r.t. "/a/b/c/d/e/" yields "/a/b/c/foo/baz.html". Attempting to ascend above the base results in the NS_ERROR_MALFORMED_URI exception. If basePath is null, it treats it as "/".

Parameters:
relativePatha relative URI
basePatha base URI
Returns:
a new string, representing canonical uri
Parameters:
inURIURI spec
startPosstart of scheme (may be null)
endPosend of scheme; index of colon (may be null)
schemescheme copied to this buffer on return (may be null)
NS_HIDDEN_ ( PRBool  ) const

Filter out whitespace from a URI string.

This function returns true if the given hostname does not include any restricted characters.

The input is the |str| pointer. |result| is written to if and only if there is whitespace that has to be filtered out. The return value is true if and only if |result| is written to.

This function strips out all whitespace at the beginning and end of the URL and strips out ,
, from the middle of the URL. This makes it safe to call on things like javascript: urls or data: urls, where we may in fact run into whitespace that is not properly encoded.

Parameters:
strthe pointer to the string to filter. Must be non-null.
resultthe out param to write to if filtering happens
Returns:
whether result was written to

Otherwise, false is returned.

NS_HIDDEN_ ( char *  ) const

returns pointer to first character of |str| in the given set.

returns pointer to last character of |str| NOT in the given set.

returns pointer to last character of |str| in the given set.

returns pointer to first character of |str| NOT in the given set.

if not found, then |end| is returned. stops prematurely if a null byte is encountered, and returns the address of the null byte.

if all characters are in the given set, then |end| is returned. if '\0' is not included in |set|, then stops prematurely if a null byte is encountered, and returns the address of the null byte.

if not found, then |str - 1| is returned.

if all characters are in the given set, then |str - 1| is returned.


Variable Documentation

nsACString nsACString& aContentCharset

Definition at line 206 of file nsURLHelper.h.

nsACString& aContentType

Definition at line 206 of file nsURLHelper.h.

nsACString nsACString PRBool* aHadCharset

Definition at line 206 of file nsURLHelper.h.

const nsACString& basePath

Definition at line 103 of file nsURLHelper.h.

const char* end

Definition at line 175 of file nsURLHelper.h.

Definition at line 115 of file nsURLHelper.h.

Definition at line 167 of file nsURLHelper.h.

nsACString nsIFile nsACString& outDirectory

Definition at line 82 of file nsURLHelper.h.

nsACString nsIFile nsACString nsACString& outFileBaseName

Definition at line 82 of file nsURLHelper.h.

nsACString nsIFile nsACString nsACString nsACString& outFileExtension

Definition at line 82 of file nsURLHelper.h.

char* path

Definition at line 87 of file nsURLHelper.h.

nsACString& result

Definition at line 103 of file nsURLHelper.h.

PRUint32 PRUint32 nsACString* scheme = nsnull)

Definition at line 117 of file nsURLHelper.h.

Definition at line 120 of file nsURLHelper.h.

Definition at line 175 of file nsURLHelper.h.

Definition at line 115 of file nsURLHelper.h.