Back to index

lightning-sunbird  0.9+nobinonly
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Static Private Attributes | Friends
nsStandardURL Class Reference

#include <nsStandardURL.h>

Inheritance diagram for nsStandardURL:
Inheritance graph
[legend]
Collaboration diagram for nsStandardURL:
Collaboration graph
[legend]

List of all members.

Classes

class  nsPrefObserver
class  nsSegmentEncoder
struct  URLSegment

Public Member Functions

NS_DECL_ISUPPORTS
NS_DECL_NSIURI NS_DECL_NSIURL
NS_DECL_NSIFILEURL
NS_DECL_NSISTANDARDURL
NS_DECL_NSISERIALIZABLE
NS_DECL_NSICLASSINFO 
nsStandardURL (PRBool aSupportsFileURL=PR_FALSE)
virtual ~nsStandardURL ()
AUTF8String getCommonBaseSpec (in nsIURI aURIToCompare)
 This method takes a uri and compares the two.
AUTF8String getRelativeSpec (in nsIURI aURIToCompare)
 This method takes a uri and returns a substring of this if it can be made relative to the uri passed in.
boolean equals (in nsIURI other)
 URI equivalence test (not a strict string comparison).
boolean schemeIs (in string scheme)
 An optimization to do scheme checks without requiring the users of nsIURI to GetScheme, thereby saving extra allocating and freeing.
nsIURI clone ()
 Clones the current URI.
AUTF8String resolve (in AUTF8String relativePath)
 This method resolves a relative string into an absolute URI string, using this URI as the base.
void init (in unsigned long aUrlType, in long aDefaultPort, in AUTF8String aSpec, in string aOriginCharset, in nsIURI aBaseURI)
 Initialize a standard URL.
void read (in nsIObjectInputStream aInputStream)
 Initialize the object implementing nsISerializable, which must have been freshly constructed via CreateInstance.
void write (in nsIObjectOutputStream aOutputStream)
 Serialize the object implementing nsISerializable to aOutputStream, by writing each data member that must be recovered later to reconstitute a working replica of this object, in a canonical member and byte order, to aOutputStream.
void getInterfaces (out PRUint32 count,[array, size_is(count), retval] out nsIIDPtr array)
 Get an ordered list of the interface ids that instances of the class promise to implement.
nsISupports getHelperForLanguage (in PRUint32 language)
 Get a language mapping specific helper object that may assist in using objects of this class in a specific lanaguage.

Static Public Member Functions

static void InitGlobalObjects ()
static void ShutdownGlobalObjects ()

Public Attributes

attribute nsIFile file
 Get/Set nsIFile corresponding to this URL.
attribute AUTF8String filePath
 Returns a path including the directory and file portions of a URL.
attribute AUTF8String param
 Returns the parameters specified after the ; in the URL.
attribute AUTF8String query
 Returns the query portion (the part after the "?") of the URL.
attribute AUTF8String ref
 Returns the reference portion (the part after the "#") of the URL.
attribute AUTF8String directory
 Returns the directory portion of a URL.
attribute AUTF8String fileName
 Returns the file name portion of a URL.
attribute AUTF8String fileBaseName
 Returns the file basename portion of a filename in a url.
attribute AUTF8String fileExtension
 Returns the file extension portion of a filename in a url.
attribute AUTF8String spec
 Returns a string representation of the URI.
readonly attribute AUTF8String prePath
 The prePath (eg.
attribute ACString scheme
 The Scheme is the protocol to which this URI refers.
attribute AUTF8String userPass
 The username:password (or username only if value doesn't contain a ':')
attribute AUTF8String username
 The optional username and password, assuming the preHost consists of username:password.
attribute AUTF8String password
attribute AUTF8String hostPort
 The host:port (or simply the host, if port == -1).
attribute AUTF8String host
 The host is the internet domain name to which this URI refers.
attribute long port
 A port value of -1 corresponds to the protocol's default port (eg.
attribute AUTF8String path
 The path, typically including at least a leading '/' (but may also be empty, depending on the protocol).
readonly attribute ACString asciiSpec
 The URI spec with an ASCII compatible encoding.
readonly attribute ACString asciiHost
 The URI host with an ASCII compatible encoding.
readonly attribute ACString originCharset
 The charset of the document from which this URI originated.
const unsigned long URLTYPE_STANDARD = 1
 blah:foo/bar => blah://foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar
const unsigned long URLTYPE_AUTHORITY = 2
 blah:foo/bar => blah://foo/bar blah:/foo/bar => blah://foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah://foo/bar
const unsigned long URLTYPE_NO_AUTHORITY = 3
 blah:foo/bar => blah:///foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar
attribute boolean mutable
 Control whether or not this URL can be modified.
readonly attribute string contractID
 A contract ID through which an instance of this class can be created (or accessed as a service, if |flags & SINGLETON|), or null.
readonly attribute string classDescription
 A human readable string naming the class, or null.
readonly attribute nsCIDPtr classID
 A class ID through which an instance of this class can be created (or accessed as a service, if |flags & SINGLETON|), or null.
readonly attribute PRUint32 implementationLanguage
 Return language type from list in nsIProgrammingLanguage.
const PRUint32 SINGLETON = 1 << 0
 Bitflags for 'flags' attribute.
const PRUint32 THREADSAFE = 1 << 1
const PRUint32 MAIN_THREAD_ONLY = 1 << 2
const PRUint32 DOM_OBJECT = 1 << 3
const PRUint32 PLUGIN_OBJECT = 1 << 4
const PRUint32 EAGER_CLASSINFO = 1 << 5
const PRUint32 CONTENT_NODE = 1 << 6
 'flags' attribute bitflag: whether objects of this type implement nsIContent.
const PRUint32 RESERVED = 1 << 31
readonly attribute PRUint32 flags
readonly attribute nsCID classIDNoAlloc
 Also a class ID through which an instance of this class can be created (or accessed as a service, if |flags & SINGLETON|).

Protected Member Functions

virtual nsStandardURLStartClone ()
virtual nsresult EnsureFile ()

Protected Attributes

nsCOMPtr< nsIFilemFile

Private Types

enum  { eEncoding_Unknown, eEncoding_ASCII, eEncoding_UTF8 }

Private Member Functions

PRInt32 Port ()
void Clear ()
void InvalidateCache (PRBool invalidateCachedFile=PR_TRUE)
PRBool EscapeIPv6 (const char *host, nsCString &result)
PRBool NormalizeIDN (const nsCSubstring &host, nsCString &result)
void CoalescePath (netCoalesceFlags coalesceFlag, char *path)
PRUint32 AppendSegmentToBuf (char *, PRUint32, const char *, URLSegment &, const nsCString *esc=nsnull, PRBool useEsc=PR_FALSE)
PRUint32 AppendToBuf (char *, PRUint32, const char *, PRUint32)
nsresult BuildNormalizedSpec (const char *spec)
PRBool SegmentIs (const URLSegment &s1, const char *val)
PRBool SegmentIs (const char *spec, const URLSegment &s1, const char *val)
PRBool SegmentIs (const URLSegment &s1, const char *val, const URLSegment &s2)
PRInt32 ReplaceSegment (PRUint32 pos, PRUint32 len, const char *val, PRUint32 valLen)
PRInt32 ReplaceSegment (PRUint32 pos, PRUint32 len, const nsACString &val)
nsresult ParseURL (const char *spec, PRInt32 specLen)
nsresult ParsePath (const char *spec, PRUint32 pathPos, PRInt32 pathLen=-1)
char * AppendToSubstring (PRUint32 pos, PRInt32 len, const char *tail, PRInt32 tailLen=-1)
const nsDependentCSubstring Segment (PRUint32 pos, PRInt32 len)
const nsDependentCSubstring Segment (const URLSegment &s)
const nsDependentCSubstring Prepath ()
const nsDependentCSubstring Scheme ()
const nsDependentCSubstring Userpass (PRBool includeDelim=PR_FALSE)
const nsDependentCSubstring Username ()
const nsDependentCSubstring Password ()
const nsDependentCSubstring Hostport ()
const nsDependentCSubstring Host ()
const nsDependentCSubstring Path ()
const nsDependentCSubstring Filepath ()
const nsDependentCSubstring Directory ()
const nsDependentCSubstring Filename ()
const nsDependentCSubstring Basename ()
const nsDependentCSubstring Extension ()
const nsDependentCSubstring Param ()
const nsDependentCSubstring Query ()
const nsDependentCSubstring Ref ()
void ShiftFromAuthority (PRInt32 diff)
void ShiftFromUsername (PRInt32 diff)
void ShiftFromPassword (PRInt32 diff)
void ShiftFromHost (PRInt32 diff)
void ShiftFromPath (PRInt32 diff)
void ShiftFromFilepath (PRInt32 diff)
void ShiftFromDirectory (PRInt32 diff)
void ShiftFromBasename (PRInt32 diff)
void ShiftFromExtension (PRInt32 diff)
void ShiftFromParam (PRInt32 diff)
void ShiftFromQuery (PRInt32 diff)
void ShiftFromRef (PRInt32 diff)
nsresult ReadSegment (nsIBinaryInputStream *, URLSegment &)
nsresult WriteSegment (nsIBinaryOutputStream *, const URLSegment &)

Static Private Member Functions

static void PrefsChanged (nsIPrefBranch *prefs, const char *pref)
static nsresult ACEtoDisplayIDN (const nsCSubstring &in, nsCString &out)
static nsresult UTF8toDisplayIDN (const nsCSubstring &in, nsCString &out)
static PRBool IsInWhitelist (const nsCSubstring &host)

Private Attributes

nsCString mSpec
PRInt32 mDefaultPort
PRInt32 mPort
URLSegment mScheme
URLSegment mAuthority
URLSegment mUsername
URLSegment mPassword
URLSegment mHost
URLSegment mPath
URLSegment mFilepath
URLSegment mDirectory
URLSegment mBasename
URLSegment mExtension
URLSegment mParam
URLSegment mQuery
URLSegment mRef
nsCString mOriginCharset
nsCOMPtr< nsIURLParsermParser
char * mHostA
PRUint32 mHostEncoding: 2
PRUint32 mSpecEncoding: 2
PRUint32 mURLType: 2
PRUint32 mMutable: 1
PRUint32 mSupportsFileURL: 1

Static Private Attributes

static nsIIDNServicegIDN = nsnull
static nsICharsetConverterManagergCharsetMgr = nsnull
static PRBool gInitialized = PR_FALSE
static PRBool gEscapeUTF8 = PR_TRUE
static PRBool gAlwaysEncodeInUTF8 = PR_TRUE
static PRBool gShowPunycode = PR_FALSE
static nsIPrefBranchgIDNWhitelistPrefBranch = nsnull

Friends

class nsPrefObserver
class nsSegmentEncoder

Detailed Description

Definition at line 66 of file nsStandardURL.h.


Member Enumeration Documentation

anonymous enum [private]
Enumerator:
eEncoding_Unknown 
eEncoding_ASCII 
eEncoding_UTF8 

Definition at line 257 of file nsStandardURL.h.


Constructor & Destructor Documentation

nsStandardURL::nsStandardURL ( PRBool  aSupportsFileURL = PR_FALSE)

Definition at line 265 of file nsStandardURL.cpp.

    : mDefaultPort(-1)
    , mPort(-1)
    , mHostA(nsnull)
    , mHostEncoding(eEncoding_ASCII)
    , mSpecEncoding(eEncoding_Unknown)
    , mURLType(URLTYPE_STANDARD)
    , mMutable(PR_TRUE)
    , mSupportsFileURL(aSupportsFileURL)
{
#if defined(PR_LOGGING)
    if (!gStandardURLLog)
        gStandardURLLog = PR_NewLogModule("nsStandardURL");
#endif

    LOG(("Creating nsStandardURL @%p\n", this));

    if (!gInitialized) {
        gInitialized = PR_TRUE;
        InitGlobalObjects();
    }

    // default parser in case nsIStandardURL::Init is never called
    mParser = net_GetStdURLParser();
}

Here is the call graph for this function:

Definition at line 291 of file nsStandardURL.cpp.

{
    LOG(("Destroying nsStandardURL @%p\n", this));

    CRTFREEIF(mHostA);
}

Member Function Documentation

nsresult nsStandardURL::ACEtoDisplayIDN ( const nsCSubstring in,
nsCString out 
) [static, private]

Definition at line 857 of file nsStandardURL.cpp.

{
    if (gShowPunycode || !IsInWhitelist(host)) {
        result = host;
        return NS_OK;
    }

    return gIDN->ConvertACEtoUTF8(host, result);
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRUint32 nsStandardURL::AppendSegmentToBuf ( char *  buf,
PRUint32  i,
const char *  str,
URLSegment seg,
const nsCString esc = nsnull,
PRBool  useEsc = PR_FALSE 
) [private]

Definition at line 435 of file nsStandardURL.cpp.

{
    if (seg.mLen > 0) {
        if (useEscaped) {
            seg.mLen = escapedStr->Length();
            memcpy(buf + i, escapedStr->get(), seg.mLen);
        }
        else
            memcpy(buf + i, str + seg.mPos, seg.mLen);
        seg.mPos = i;
        i += seg.mLen;
    }
    return i;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRUint32 nsStandardURL::AppendToBuf ( char *  buf,
PRUint32  i,
const char *  str,
PRUint32  len 
) [private]

Definition at line 451 of file nsStandardURL.cpp.

{
    memcpy(buf + i, str, len);
    return i + len;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char * nsStandardURL::AppendToSubstring ( PRUint32  pos,
PRInt32  len,
const char *  tail,
PRInt32  tailLen = -1 
) [private]

Definition at line 769 of file nsStandardURL.cpp.

{
    if (tailLen < 0)
        tailLen = strlen(tail);

    char *result = (char *) malloc(len + tailLen + 1);
    if (result) {
        memcpy(result, mSpec.get() + pos, len);
        memcpy(result + len, tail, tailLen);
        result[len + tailLen] = '\0';
    }
    return result;
}

Here is the call graph for this function:

Definition at line 196 of file nsStandardURL.h.

{ return Segment(mBasename); }

Here is the call graph for this function:

Definition at line 463 of file nsStandardURL.cpp.

{
    // Assumptions: all member URLSegments must be relative the |spec| argument
    // passed to this function.

    // buffers for holding escaped url segments (these will remain empty unless
    // escaping is required).
    nsCAutoString encUsername, encPassword, encHost, encDirectory,
      encBasename, encExtension, encParam, encQuery, encRef;
    PRBool useEncUsername, useEncPassword, useEncHost, useEncDirectory,
      useEncBasename, useEncExtension, useEncParam, useEncQuery, useEncRef;

    //
    // escape each URL segment, if necessary, and calculate approximate normalized
    // spec length.
    //
    PRUint32 approxLen = 3; // includes room for "://"

    // the scheme is already ASCII
    if (mScheme.mLen > 0)
        approxLen += mScheme.mLen;

    // encode URL segments; convert UTF-8 to origin charset and possibly escape.
    // results written to encXXX variables only if |spec| is not already in the
    // appropriate encoding.
    {
        GET_SEGMENT_ENCODER(encoder);
        approxLen += encoder.EncodeSegmentCount(spec, mUsername,  esc_Username,      encUsername,  useEncUsername);
        approxLen += encoder.EncodeSegmentCount(spec, mPassword,  esc_Password,      encPassword,  useEncPassword);
        approxLen += encoder.EncodeSegmentCount(spec, mDirectory, esc_Directory,     encDirectory, useEncDirectory);
        approxLen += encoder.EncodeSegmentCount(spec, mBasename,  esc_FileBaseName,  encBasename,  useEncBasename);
        approxLen += encoder.EncodeSegmentCount(spec, mExtension, esc_FileExtension, encExtension, useEncExtension);
        approxLen += encoder.EncodeSegmentCount(spec, mParam,     esc_Param,         encParam,     useEncParam);
        approxLen += encoder.EncodeSegmentCount(spec, mQuery,     esc_Query,         encQuery,     useEncQuery);
        approxLen += encoder.EncodeSegmentCount(spec, mRef,       esc_Ref,           encRef,       useEncRef);
    }

    // do not escape the hostname, if IPv6 address literal, mHost will
    // already point to a [ ] delimited IPv6 address literal.
    // However, perform Unicode normalization on it, as IDN does.
    mHostEncoding = eEncoding_ASCII;
    if (mHost.mLen > 0) {
        const nsCSubstring& tempHost =
            Substring(spec + mHost.mPos, spec + mHost.mPos + mHost.mLen);
        if (tempHost.FindChar('\0') != kNotFound)
            return NS_ERROR_MALFORMED_URI;  // null embedded in hostname
        if ((useEncHost = NormalizeIDN(tempHost, encHost)))
            approxLen += encHost.Length();
        else
            approxLen += mHost.mLen;
    }

    //
    // generate the normalized URL string
    //
    if (!EnsureStringLength(mSpec, approxLen + 32))
        return NS_ERROR_OUT_OF_MEMORY;
    char *buf;
    mSpec.BeginWriting(buf);
    PRUint32 i = 0;

    if (mScheme.mLen > 0) {
        i = AppendSegmentToBuf(buf, i, spec, mScheme);
        net_ToLowerCase(buf + mScheme.mPos, mScheme.mLen);
        i = AppendToBuf(buf, i, "://", 3);
    }

    // record authority starting position
    mAuthority.mPos = i;

    // append authority
    if (mUsername.mLen > 0) {
        i = AppendSegmentToBuf(buf, i, spec, mUsername, &encUsername, useEncUsername);
        if (mPassword.mLen >= 0) {
            buf[i++] = ':';
            i = AppendSegmentToBuf(buf, i, spec, mPassword, &encPassword, useEncPassword);
        }
        buf[i++] = '@';
    }
    if (mHost.mLen > 0) {
        i = AppendSegmentToBuf(buf, i, spec, mHost, &encHost, useEncHost);
        net_ToLowerCase(buf + mHost.mPos, mHost.mLen);
        if (mPort != -1 && mPort != mDefaultPort) {
            nsCAutoString portbuf;
            portbuf.AppendInt(mPort);
            buf[i++] = ':';
            i = AppendToBuf(buf, i, portbuf.get(), portbuf.Length());
        }
    }

    // record authority length
    mAuthority.mLen = i - mAuthority.mPos;

    // path must always start with a "/"
    if (mPath.mLen <= 0) {
        LOG(("setting path=/"));
        mDirectory.mPos = mFilepath.mPos = mPath.mPos = i;
        mDirectory.mLen = mFilepath.mLen = mPath.mLen = 1;
        // basename must exist, even if empty (bug 113508)
        mBasename.mPos = i+1;
        mBasename.mLen = 0;
        buf[i++] = '/';
    }
    else {
        PRUint32 leadingSlash = 0;
        if (spec[mPath.mPos] != '/') {
            LOG(("adding leading slash to path\n"));
            leadingSlash = 1;
            buf[i++] = '/';
        }

        // record corrected (file)path starting position
        mPath.mPos = mFilepath.mPos = i - leadingSlash;

        i = AppendSegmentToBuf(buf, i, spec, mDirectory, &encDirectory, useEncDirectory);

        // the directory must end with a '/'
        if (buf[i-1] != '/') {
            buf[i++] = '/';
            mDirectory.mLen++;
        }

        i = AppendSegmentToBuf(buf, i, spec, mBasename, &encBasename, useEncBasename);

        // make corrections to directory segment if leadingSlash
        if (leadingSlash) {
            mDirectory.mPos = mPath.mPos;
            if (mDirectory.mLen >= 0)
                mDirectory.mLen += leadingSlash;
            else
                mDirectory.mLen = 1;
        }

        if (mExtension.mLen >= 0) {
            buf[i++] = '.';
            i = AppendSegmentToBuf(buf, i, spec, mExtension, &encExtension, useEncExtension);
        }
        // calculate corrected filepath length
        mFilepath.mLen = i - mFilepath.mPos;

        if (mParam.mLen >= 0) {
            buf[i++] = ';';
            i = AppendSegmentToBuf(buf, i, spec, mParam, &encParam, useEncParam);
        }
        if (mQuery.mLen >= 0) {
            buf[i++] = '?';
            i = AppendSegmentToBuf(buf, i, spec, mQuery, &encQuery, useEncQuery);
        }
        if (mRef.mLen >= 0) {
            buf[i++] = '#';
            i = AppendSegmentToBuf(buf, i, spec, mRef, &encRef, useEncRef);
        }
        // calculate corrected path length
        mPath.mLen = i - mPath.mPos;
    }

    buf[i] = '\0';

    if (mDirectory.mLen > 1) {
        netCoalesceFlags coalesceFlag = NET_COALESCE_NORMAL;
        if (SegmentIs(buf,mScheme,"ftp")) {
            coalesceFlag = (netCoalesceFlags) (coalesceFlag 
                                        | NET_COALESCE_ALLOW_RELATIVE_ROOT
                                        | NET_COALESCE_DOUBLE_SLASH_IS_ROOT);
        }
        CoalescePath(coalesceFlag, buf + mDirectory.mPos);
    }
    mSpec.SetLength(strlen(buf));
    NS_ASSERTION(mSpec.Length() <= approxLen+32, "We've overflowed the mSpec buffer!");
    return NS_OK;
}

Here is the call graph for this function:

void nsStandardURL::Clear ( void  ) [private]

Definition at line 334 of file nsStandardURL.cpp.

Here is the call graph for this function:

nsIURI nsIURI::clone ( ) [inherited]

Clones the current URI.

For some protocols, this is more than just an optimization. For example, under MacOS, the spec of a file URL does not necessarily uniquely identify a file since two volumes could share the same name.

Here is the caller graph for this function:

void nsStandardURL::CoalescePath ( netCoalesceFlags  coalesceFlag,
char *  path 
) [private]

Definition at line 421 of file nsStandardURL.cpp.

{
    net_CoalesceDirs(coalesceFlag, path);
    PRInt32 newLen = strlen(path);
    if (newLen < mPath.mLen) {
        PRInt32 diff = newLen - mPath.mLen;
        mPath.mLen = newLen;
        mDirectory.mLen += diff;
        mFilepath.mLen += diff;
        ShiftFromBasename(diff);
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 194 of file nsStandardURL.h.

{ return Segment(mDirectory); }

Here is the call graph for this function:

nsresult nsStandardURL::EnsureFile ( ) [protected, virtual]

Reimplemented in nsResURL.

Definition at line 2422 of file nsStandardURL.cpp.

{
    NS_PRECONDITION(mSupportsFileURL,
                    "EnsureFile() called on a URL that doesn't support files!");
    if (mFile) {
        // Nothing to do
        return NS_OK;
    }

    // Parse the spec if we don't have a cached result
    if (mSpec.IsEmpty()) {
        NS_ERROR("url not initialized");
        return NS_ERROR_NOT_INITIALIZED;
    }

    if (!SegmentIs(mScheme, "file")) {
        NS_ERROR("not a file URL");
        return NS_ERROR_FAILURE;
    }

    return net_GetFileFromURLSpec(mSpec, getter_AddRefs(mFile));
}

Here is the call graph for this function:

boolean nsIURI::equals ( in nsIURI  other) [inherited]

URI equivalence test (not a strict string comparison).

eg. http://foo.com:80/ == http://foo.com/

PRBool nsStandardURL::EscapeIPv6 ( const char *  host,
nsCString result 
) [private]

Definition at line 369 of file nsStandardURL.cpp.

{
    // Escape IPv6 address literal by surrounding it with []'s
    if (host && (host[0] != '[') && PL_strchr(host, ':')) {
        result.Assign('[');
        result.Append(host);
        result.Append(']');
        return PR_TRUE;
    }
    return PR_FALSE;
}

Here is the call graph for this function:

Definition at line 197 of file nsStandardURL.h.

{ return Segment(mExtension); }

Here is the call graph for this function:

Definition at line 354 of file nsStandardURL.h.

{
    PRUint32 pos=0, len=0;
    // if there is no basename, then there can be no extension
    if (mBasename.mLen > 0) {
        pos = mBasename.mPos;
        len = mBasename.mLen;
        if (mExtension.mLen >= 0)
            len += (mExtension.mLen + 1);
    }
    return Substring(mSpec, pos, len);
}

Here is the call graph for this function:

Definition at line 193 of file nsStandardURL.h.

{ return Segment(mFilepath); }

Here is the call graph for this function:

AUTF8String nsIURL::getCommonBaseSpec ( in nsIURI  aURIToCompare) [inherited]

This method takes a uri and compares the two.

The common uri portion is returned as a string. The minimum common uri portion is the protocol, and any of these if present: login, password, host and port If no commonality is found, "" is returned. If they are identical, the whole path with file/ref/etc. is returned. For file uris, it is expected that the common spec would be at least "file:///" since '/' is a shared common root.

Examples: this.spec aURIToCompare.spec result 1) http://mozilla.org/ http://www.mozilla.org/ "" 2) http://foo.com/bar/ ftp://foo.com/bar/ "" 3) http://foo.com:8080/ http://foo.com/bar/ "" 4) ftp://user@foo.com/ ftp://user:pw@foo.com/ "" 5) ftp://foo.com/bar/ ftp://foo.com/bar ftp://foo.com/ 6) ftp://foo.com/bar/ ftp://foo.com/bar/b.html ftp://foo.com/bar/ 7) http://foo.com/a.htm#i http://foo.com/b.htm http://foo.com/ 8) ftp://foo.com/c.htm#i ftp://foo.com/c.htm ftp://foo.com/c.htm 9) file:///a/b/c.html file:///d/e/c.html file:///

nsISupports nsIClassInfo::getHelperForLanguage ( in PRUint32  language) [inherited]

Get a language mapping specific helper object that may assist in using objects of this class in a specific lanaguage.

For instance, if asked for the helper for nsIProgrammingLanguage::JAVASCRIPT this might return an object that can be QI'd into the nsIXPCScriptable interface to assist XPConnect in supplying JavaScript specific behavior to callers of the instance object.

see: nsIProgrammingLanguage.idl

Should return null if no helper available for given language.

void nsIClassInfo::getInterfaces ( out PRUint32  count,
[array, size_is(count), retval] out nsIIDPtr  array 
) [inherited]

Get an ordered list of the interface ids that instances of the class promise to implement.

Note that nsISupports is an implicit member of any such list and need not be included.

Should set *count = 0 and *array = null and return NS_OK if getting the list is not supported.

AUTF8String nsIURL::getRelativeSpec ( in nsIURI  aURIToCompare) [inherited]

This method takes a uri and returns a substring of this if it can be made relative to the uri passed in.

If no commonality is found, the entire uri spec is returned. If they are identical, "" is returned. Filename, query, etc are always returned except when uris are identical.

Definition at line 339 of file nsStandardURL.h.

{
    PRUint32 pos=0, len=0;
    if (mHost.mLen > 0) {
        pos = mHost.mPos;
        len = mHost.mLen;
        if (mSpec.CharAt(pos) == '[' && mSpec.CharAt(pos + len - 1) == ']') {
            pos++;
            len -= 2;
        }
    }
    return Substring(mSpec, pos, len);
}

Here is the call graph for this function:

Definition at line 328 of file nsStandardURL.h.

{
    PRUint32 pos=0, len=0;
    if (mAuthority.mLen > 0) {
        pos = mHost.mPos;
        len = mAuthority.mPos + mAuthority.mLen - pos;
    }
    return Substring(mSpec, pos, len);
}

Here is the call graph for this function:

void nsIStandardURL::init ( in unsigned long  aUrlType,
in long  aDefaultPort,
in AUTF8String  aSpec,
in string  aOriginCharset,
in nsIURI  aBaseURI 
) [inherited]

Initialize a standard URL.

Parameters:
aUrlType- one of the URLTYPE_ flags listed above.
aDefaultPort- if the port parsed from the URL string matches this port, then the port will be removed from the canonical form of the URL.
aSpec- URL string.
aOriginCharset- the charset from which this URI string originated. this corresponds to the charset that should be used when communicating this URI to an origin server, for example. if null, then provide aBaseURI implements this interface, the origin charset of aBaseURI will be assumed, otherwise defaulting to UTF-8 (i.e., no charset transformation from aSpec).
aBaseURI- if null, aSpec must specify an absolute URI. otherwise, aSpec will be resolved relative to aBaseURI.

Definition at line 299 of file nsStandardURL.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::InvalidateCache ( PRBool  invalidateCachedFile = PR_TRUE) [private]

Definition at line 360 of file nsStandardURL.cpp.

{
    if (invalidateCachedFile)
        mFile = 0;
    CRTFREEIF(mHostA);
    mSpecEncoding = eEncoding_Unknown;
}

Here is the caller graph for this function:

PRBool nsStandardURL::IsInWhitelist ( const nsCSubstring host) [static, private]

Definition at line 891 of file nsStandardURL.cpp.

{
    PRInt32 pos; 
    PRBool safe;

    // XXX This code uses strings inefficiently.

    if (gIDNWhitelistPrefBranch && 
        (pos = nsCAutoString(host).RFind(".")) != kNotFound &&
        NS_SUCCEEDED(gIDNWhitelistPrefBranch->
                     GetBoolPref(nsCAutoString(Substring(host, pos + 1)).get(),
                                 &safe)))
        return safe;

    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsStandardURL::NormalizeIDN ( const nsCSubstring host,
nsCString result 
) [private]

Definition at line 382 of file nsStandardURL.cpp.

{
    // If host is ACE, then convert to UTF-8.  Else, if host is already UTF-8,
    // then make sure it is normalized per IDN.

    // this function returns PR_TRUE iff it writes something to |result|.

    // NOTE: As a side-effect this function sets mHostEncoding.  While it would
    // be nice to avoid side-effects in this function, the implementation of
    // this function is already somewhat bound to the behavior of the
    // callsites.  Anyways, this function exists to avoid code duplication, so
    // side-effects abound :-/

    NS_ASSERTION(mHostEncoding == eEncoding_ASCII, "unexpected default encoding");

    if (IsASCII(host)) {
        PRBool isACE;
        if (gIDN &&
            NS_SUCCEEDED(gIDN->IsACE(host, &isACE)) && isACE &&
            NS_SUCCEEDED(ACEtoDisplayIDN(host, result))) {
            mHostEncoding = eEncoding_UTF8;
            return PR_TRUE;
        }
    }
    else {
        mHostEncoding = eEncoding_UTF8;
        if (gIDN && NS_SUCCEEDED(UTF8toDisplayIDN(host, result))) {
            // normalization could result in an ASCII only hostname
            if (IsASCII(result))
                mHostEncoding = eEncoding_ASCII;
            return PR_TRUE;
        }
    }

    result.Truncate();
    return PR_FALSE;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 198 of file nsStandardURL.h.

{ return Segment(mParam); }

Here is the call graph for this function:

nsresult nsStandardURL::ParsePath ( const char *  spec,
PRUint32  pathPos,
PRInt32  pathLen = -1 
) [private]

Definition at line 740 of file nsStandardURL.cpp.

{
    nsresult rv = mParser->ParsePath(spec + pathPos, pathLen,
                                     &mFilepath.mPos, &mFilepath.mLen,
                                     &mParam.mPos, &mParam.mLen,
                                     &mQuery.mPos, &mQuery.mLen,
                                     &mRef.mPos, &mRef.mLen);
    if (NS_FAILED(rv)) return rv;

    mFilepath.mPos += pathPos;
    mParam.mPos += pathPos;
    mQuery.mPos += pathPos;
    mRef.mPos += pathPos;

    if (mFilepath.mLen > 0) {
        rv = mParser->ParseFilePath(spec + mFilepath.mPos, mFilepath.mLen,
                                    &mDirectory.mPos, &mDirectory.mLen,
                                    &mBasename.mPos, &mBasename.mLen,
                                    &mExtension.mPos, &mExtension.mLen);
        if (NS_FAILED(rv)) return rv;

        mDirectory.mPos += mFilepath.mPos;
        mBasename.mPos += mFilepath.mPos;
        mExtension.mPos += mFilepath.mPos;
    }
    return NS_OK;
}

Here is the caller graph for this function:

nsresult nsStandardURL::ParseURL ( const char *  spec,
PRInt32  specLen 
) [private]

Definition at line 700 of file nsStandardURL.cpp.

{
    nsresult rv;

    //
    // parse given URL string
    //
    rv = mParser->ParseURL(spec, specLen,
                           &mScheme.mPos, &mScheme.mLen,
                           &mAuthority.mPos, &mAuthority.mLen,
                           &mPath.mPos, &mPath.mLen);
    if (NS_FAILED(rv)) return rv;

#ifdef DEBUG
    if (mScheme.mLen <= 0) {
        printf("spec=%s\n", spec);
        NS_WARNING("malformed url: no scheme");
    }
#endif
     
    if (mAuthority.mLen > 0) {
        rv = mParser->ParseAuthority(spec + mAuthority.mPos, mAuthority.mLen,
                                     &mUsername.mPos, &mUsername.mLen,
                                     &mPassword.mPos, &mPassword.mLen,
                                     &mHost.mPos, &mHost.mLen,
                                     &mPort);
        if (NS_FAILED(rv)) return rv;

        mUsername.mPos += mAuthority.mPos;
        mPassword.mPos += mAuthority.mPos;
        mHost.mPos += mAuthority.mPos;
    }

    if (mPath.mLen > 0)
        rv = ParsePath(spec, mPath.mPos, mPath.mLen);

    return rv;
}

Here is the call graph for this function:

Definition at line 189 of file nsStandardURL.h.

{ return Segment(mPassword); }

Here is the call graph for this function:

Definition at line 192 of file nsStandardURL.h.

{ return Segment(mPath); }

Here is the call graph for this function:

PRInt32 nsStandardURL::Port ( ) [inline, private]

Definition at line 154 of file nsStandardURL.h.

{ return mPort == -1 ? mDefaultPort : mPort; }
void nsStandardURL::PrefsChanged ( nsIPrefBranch prefs,
const char *  pref 
) [static, private]

Definition at line 815 of file nsStandardURL.cpp.

{
    PRBool val;

    LOG(("nsStandardURL::PrefsChanged [pref=%s]\n", pref));

#define PREF_CHANGED(p) ((pref == nsnull) || !strcmp(pref, p))
#define GOT_PREF(p, b) (NS_SUCCEEDED(prefs->GetBoolPref(p, &b)))

    if (PREF_CHANGED(NS_NET_PREF_ENABLEIDN)) {
        NS_IF_RELEASE(gIDN);
        if (GOT_PREF(NS_NET_PREF_ENABLEIDN, val) && val) {
            // initialize IDN
            nsCOMPtr<nsIIDNService> serv(do_GetService(NS_IDNSERVICE_CONTRACTID));
            if (serv)
                NS_ADDREF(gIDN = serv.get());
        }
        LOG(("IDN support %s\n", gIDN ? "enabled" : "disabled"));
    }
    
    if (PREF_CHANGED(NS_NET_PREF_ESCAPEUTF8)) {
        if (GOT_PREF(NS_NET_PREF_ESCAPEUTF8, val))
            gEscapeUTF8 = val;
        LOG(("escape UTF-8 %s\n", gEscapeUTF8 ? "enabled" : "disabled"));
    }
        
    if (PREF_CHANGED(NS_NET_PREF_ALWAYSENCODEINUTF8)) {
        if (GOT_PREF(NS_NET_PREF_ALWAYSENCODEINUTF8, val))
            gAlwaysEncodeInUTF8 = val;
        LOG(("encode in UTF-8 %s\n", gAlwaysEncodeInUTF8 ? "enabled" : "disabled"));
    }

    if (PREF_CHANGED(NS_NET_PREF_SHOWPUNYCODE)) {
        if (GOT_PREF(NS_NET_PREF_SHOWPUNYCODE, val))
            gShowPunycode = val;
        LOG(("show punycode %s\n", gShowPunycode ? "enabled" : "disabled"));
    }
#undef PREF_CHANGED
#undef GOT_PREF
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 303 of file nsStandardURL.h.

{
    PRUint32 len = 0;
    if (mAuthority.mLen >= 0)
        len = mAuthority.mPos + mAuthority.mLen;
    return Substring(mSpec, 0, len);
}

Here is the call graph for this function:

Definition at line 199 of file nsStandardURL.h.

{ return Segment(mQuery); }

Here is the call graph for this function:

void nsISerializable::read ( in nsIObjectInputStream  aInputStream) [inherited]

Initialize the object implementing nsISerializable, which must have been freshly constructed via CreateInstance.

All data members that can't be set to default values must have been serialized by write, and should be read from aInputStream in the same order by this method.

Definition at line 787 of file nsStandardURL.cpp.

{
    nsresult rv;

    rv = stream->Read32(&seg.mPos);
    if (NS_FAILED(rv)) return rv;

    rv = stream->Read32((PRUint32 *) &seg.mLen);
    if (NS_FAILED(rv)) return rv;

    return NS_OK;
}

Definition at line 200 of file nsStandardURL.h.

{ return Segment(mRef); }

Here is the call graph for this function:

PRInt32 nsStandardURL::ReplaceSegment ( PRUint32  pos,
PRUint32  len,
const char *  val,
PRUint32  valLen 
) [private]

Definition at line 674 of file nsStandardURL.cpp.

{
    if (val && valLen) {
        if (len == 0)
            mSpec.Insert(val, pos, valLen);
        else
            mSpec.Replace(pos, len, nsDependentCString(val, valLen));
        return valLen - len;
    }

    // else remove the specified segment
    mSpec.Cut(pos, len);
    return -PRInt32(len);
}
PRInt32 nsStandardURL::ReplaceSegment ( PRUint32  pos,
PRUint32  len,
const nsACString &  val 
) [private]

Definition at line 690 of file nsStandardURL.cpp.

{
    if (len == 0)
        mSpec.Insert(val, pos);
    else
        mSpec.Replace(pos, len, val);
    return val.Length() - len;
}
AUTF8String nsIURI::resolve ( in AUTF8String  relativePath) [inherited]

This method resolves a relative string into an absolute URI string, using this URI as the base.

NOTE: some implementations may have no concept of a relative URI.

Definition at line 186 of file nsStandardURL.h.

{ return Segment(mScheme); }

Here is the call graph for this function:

boolean nsIURI::schemeIs ( in string  scheme) [inherited]

An optimization to do scheme checks without requiring the users of nsIURI to GetScheme, thereby saving extra allocating and freeing.

Returns true if the schemes match (case ignored).

const nsDependentCSubstring nsStandardURL::Segment ( PRUint32  pos,
PRInt32  len 
) [inline, private]

Definition at line 293 of file nsStandardURL.h.

{
    if (len < 0) {
        pos = 0;
        len = 0;
    }
    return Substring(mSpec, pos, PRUint32(len));
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 182 of file nsStandardURL.h.

{ return Segment(s.mPos, s.mLen); }

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsStandardURL::SegmentIs ( const URLSegment s1,
const char *  val 
) [private]

Definition at line 636 of file nsStandardURL.cpp.

{
    // one or both may be null
    if (!val || mSpec.IsEmpty())
        return (!val && (mSpec.IsEmpty() || seg.mLen < 0));
    if (seg.mLen < 0)
        return PR_FALSE;
    // if the first |seg.mLen| chars of |val| match, then |val| must
    // also be null terminated at |seg.mLen|.
    return !strncmp(mSpec.get() + seg.mPos, val, seg.mLen)
        && (val[seg.mLen] == '\0');
}

Here is the call graph for this function:

Here is the caller graph for this function:

PRBool nsStandardURL::SegmentIs ( const char *  spec,
const URLSegment s1,
const char *  val 
) [private]

Definition at line 650 of file nsStandardURL.cpp.

{
    // one or both may be null
    if (!val || !spec)
        return (!val && (!spec || seg.mLen < 0));
    if (seg.mLen < 0)
        return PR_FALSE;
    // if the first |seg.mLen| chars of |val| match, then |val| must
    // also be null terminated at |seg.mLen|.
    return !strncmp(spec + seg.mPos, val, seg.mLen)
        && (val[seg.mLen] == '\0');
}
PRBool nsStandardURL::SegmentIs ( const URLSegment s1,
const char *  val,
const URLSegment s2 
) [private]

Definition at line 664 of file nsStandardURL.cpp.

{
    if (seg1.mLen != seg2.mLen)
        return PR_FALSE;
    if (seg1.mLen == -1 || (!val && mSpec.IsEmpty()))
        return PR_TRUE; // both are empty
    return !strncmp(mSpec.get() + seg1.mPos, val + seg2.mPos, seg1.mLen); 
}

Here is the call graph for this function:

void nsStandardURL::ShiftFromAuthority ( PRInt32  diff) [inline, private]

Definition at line 203 of file nsStandardURL.h.

Here is the call graph for this function:

void nsStandardURL::ShiftFromBasename ( PRInt32  diff) [inline, private]

Definition at line 210 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromDirectory ( PRInt32  diff) [inline, private]

Definition at line 209 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromExtension ( PRInt32  diff) [inline, private]

Definition at line 211 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromFilepath ( PRInt32  diff) [inline, private]

Definition at line 208 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromHost ( PRInt32  diff) [inline, private]

Definition at line 206 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromParam ( PRInt32  diff) [inline, private]

Definition at line 212 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromPassword ( PRInt32  diff) [inline, private]

Definition at line 205 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromPath ( PRInt32  diff) [inline, private]

Definition at line 207 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromQuery ( PRInt32  diff) [inline, private]

Definition at line 213 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromRef ( PRInt32  diff) [inline, private]

Definition at line 214 of file nsStandardURL.h.

{ mRef.mPos += diff; }

Here is the call graph for this function:

Here is the caller graph for this function:

void nsStandardURL::ShiftFromUsername ( PRInt32  diff) [inline, private]

Definition at line 204 of file nsStandardURL.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 322 of file nsStandardURL.cpp.

Here is the caller graph for this function:

nsStandardURL * nsStandardURL::StartClone ( ) [protected, virtual]

Reimplemented in nsResURL.

Definition at line 1650 of file nsStandardURL.cpp.

Here is the call graph for this function:

Definition at line 188 of file nsStandardURL.h.

{ return Segment(mUsername); }

Here is the call graph for this function:

const nsDependentCSubstring nsStandardURL::Userpass ( PRBool  includeDelim = PR_FALSE) [inline, private]

Definition at line 312 of file nsStandardURL.h.

{
    PRUint32 pos=0, len=0;
    // if there is no username, then there can be no password
    if (mUsername.mLen > 0) {
        pos = mUsername.mPos;
        len = mUsername.mLen;
        if (mPassword.mLen >= 0)
            len += (mPassword.mLen + 1);
        if (includeDelim)
            len++;
    }
    return Substring(mSpec, pos, len);
}

Here is the call graph for this function:

nsresult nsStandardURL::UTF8toDisplayIDN ( const nsCSubstring in,
nsCString out 
) [static, private]

Definition at line 868 of file nsStandardURL.cpp.

{
    // We have to normalize the hostname before testing against the domain
    // whitelist.  See bug 315411.

    nsCAutoString temp;
    if (gShowPunycode || NS_FAILED(gIDN->Normalize(host, temp)))
        return gIDN->ConvertUTF8toACE(host, result);

    PRBool isACE = PR_FALSE;
    gIDN->IsACE(temp, &isACE);

    // If host is converted to ACE by the normalizer, then the host may contain
    // unsafe characters.  See bug 283016, bug 301694, and bug 309311.
 
    if (!isACE && !IsInWhitelist(temp))
        return gIDN->ConvertUTF8toACE(temp, result);

    result = temp;
    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void nsISerializable::write ( in nsIObjectOutputStream  aOutputStream) [inherited]

Serialize the object implementing nsISerializable to aOutputStream, by writing each data member that must be recovered later to reconstitute a working replica of this object, in a canonical member and byte order, to aOutputStream.

NB: a class that implements nsISerializable must also implement nsIClassInfo, in particular nsIClassInfo::GetClassID.

Here is the caller graph for this function:

Definition at line 801 of file nsStandardURL.cpp.

{
    nsresult rv;

    rv = stream->Write32(seg.mPos);
    if (NS_FAILED(rv)) return rv;

    rv = stream->Write32(PRUint32(seg.mLen));
    if (NS_FAILED(rv)) return rv;

    return NS_OK;
}

Friends And Related Function Documentation

friend class nsPrefObserver [friend]

Definition at line 111 of file nsStandardURL.h.

friend class nsSegmentEncoder [friend]

Definition at line 143 of file nsStandardURL.h.


Member Data Documentation

readonly attribute ACString nsIURI::asciiHost [inherited]

The URI host with an ASCII compatible encoding.

Follows the IDNA draft spec for converting internationalized domain names (UTF-8) to ASCII for compatibility with existing internet infrasture.

Definition at line 220 of file nsIURI.idl.

readonly attribute ACString nsIURI::asciiSpec [inherited]

The URI spec with an ASCII compatible encoding.

Host portion follows the IDNA draft spec. Other parts are URL-escaped per the rules of RFC2396. The result is strictly ASCII.

Definition at line 213 of file nsIURI.idl.

A human readable string naming the class, or null.

Definition at line 86 of file nsIClassInfo.idl.

readonly attribute nsCIDPtr nsIClassInfo::classID [inherited]

A class ID through which an instance of this class can be created (or accessed as a service, if |flags & SINGLETON|), or null.

Definition at line 92 of file nsIClassInfo.idl.

Also a class ID through which an instance of this class can be created (or accessed as a service, if |flags & SINGLETON|).

If the class does not have a CID, it should return NS_ERROR_NOT_AVAILABLE. This attribute exists so C++ callers can avoid allocating and freeing a CID, as would happen if they used classID.

Definition at line 130 of file nsIClassInfo.idl.

'flags' attribute bitflag: whether objects of this type implement nsIContent.

Definition at line 113 of file nsIClassInfo.idl.

A contract ID through which an instance of this class can be created (or accessed as a service, if |flags & SINGLETON|), or null.

Definition at line 81 of file nsIClassInfo.idl.

attribute AUTF8String nsIURL::directory [inherited]

Returns the directory portion of a URL.

If the URL denotes a path to a directory and not a file, e.g. http://foo/bar/, then the Directory attribute accesses the complete /foo/bar/ portion, and the FileName is the empty string. If the trailing slash is omitted, then the Directory is /foo/ and the file is bar (i.e. this is a syntactic, not a semantic breakdown of the Path). And hence dont rely on this for something to be a definitely be a file. But you can get just the leading directory portion for sure.

Some characters may be escaped.

Definition at line 117 of file nsIURL.idl.

const PRUint32 nsIClassInfo::DOM_OBJECT = 1 << 3 [inherited]

Definition at line 106 of file nsIClassInfo.idl.

Definition at line 108 of file nsIClassInfo.idl.

Get/Set nsIFile corresponding to this URL.

  • Getter returns a reference to an immutable object. Callers must clone before attempting to modify the returned nsIFile object. NOTE: this constraint might not be enforced at runtime, so beware!!
  • Setter clones the nsIFile object (allowing the caller to safely modify the nsIFile object after setting it on this interface).

Definition at line 63 of file nsIFileURL.idl.

attribute AUTF8String nsIURL::fileBaseName [inherited]

Returns the file basename portion of a filename in a url.

Some characters may be escaped.

Definition at line 142 of file nsIURL.idl.

attribute AUTF8String nsIURL::fileExtension [inherited]

Returns the file extension portion of a filename in a url.

If a file extension does not exist, the empty string is returned.

Some characters may be escaped.

Definition at line 150 of file nsIURL.idl.

attribute AUTF8String nsIURL::fileName [inherited]

Returns the file name portion of a URL.

If the URL denotes a path to a directory and not a file, e.g. http://foo/bar/, then the Directory attribute accesses the complete /foo/bar/ portion, and the FileName is the empty string. Note that this is purely based on searching for the last trailing slash. And hence dont rely on this to be a definite file.

Some characters may be escaped.

Definition at line 130 of file nsIURL.idl.

attribute AUTF8String nsIURL::filePath [inherited]

Returns a path including the directory and file portions of a URL.

For example, the filePath of "http://foo/bar.html#baz" is "/foo/bar.html".

Some characters may be escaped.

Definition at line 73 of file nsIURL.idl.

readonly attribute PRUint32 nsIClassInfo::flags [inherited]

Definition at line 121 of file nsIClassInfo.idl.

Definition at line 275 of file nsStandardURL.h.

Definition at line 272 of file nsStandardURL.h.

Definition at line 274 of file nsStandardURL.h.

nsIIDNService * nsStandardURL::gIDN = nsnull [static, private]

Definition at line 271 of file nsStandardURL.h.

Definition at line 277 of file nsStandardURL.h.

Definition at line 273 of file nsStandardURL.h.

Definition at line 276 of file nsStandardURL.h.

attribute AUTF8String nsIURI::host [inherited]

The host is the internet domain name to which this URI refers.

It could be an IPv4 (or IPv6) address literal. If supported, it could be a non-ASCII internationalized domain name.

Characters are NOT escaped.

Definition at line 152 of file nsIURI.idl.

attribute AUTF8String nsIURI::hostPort [inherited]

The host:port (or simply the host, if port == -1).

Characters are NOT escaped.

Definition at line 143 of file nsIURI.idl.

Return language type from list in nsIProgrammingLanguage.

Definition at line 98 of file nsIClassInfo.idl.

Definition at line 105 of file nsIClassInfo.idl.

Definition at line 234 of file nsStandardURL.h.

Definition at line 241 of file nsStandardURL.h.

Definition at line 229 of file nsStandardURL.h.

Definition at line 240 of file nsStandardURL.h.

Definition at line 242 of file nsStandardURL.h.

Definition at line 252 of file nsStandardURL.h.

Definition at line 239 of file nsStandardURL.h.

Definition at line 237 of file nsStandardURL.h.

char* nsStandardURL::mHostA [private]

Definition at line 255 of file nsStandardURL.h.

Definition at line 263 of file nsStandardURL.h.

Definition at line 266 of file nsStandardURL.h.

Definition at line 247 of file nsStandardURL.h.

Definition at line 243 of file nsStandardURL.h.

Definition at line 248 of file nsStandardURL.h.

Definition at line 236 of file nsStandardURL.h.

Definition at line 238 of file nsStandardURL.h.

Definition at line 230 of file nsStandardURL.h.

Definition at line 244 of file nsStandardURL.h.

Definition at line 245 of file nsStandardURL.h.

Definition at line 233 of file nsStandardURL.h.

Definition at line 228 of file nsStandardURL.h.

Definition at line 264 of file nsStandardURL.h.

Definition at line 267 of file nsStandardURL.h.

Definition at line 265 of file nsStandardURL.h.

Definition at line 235 of file nsStandardURL.h.

Control whether or not this URL can be modified.

Protocol handlers can set this flag before handing out an URL to ensure that it is not inadvertently modified.

Definition at line 110 of file nsIStandardURL.idl.

readonly attribute ACString nsIURI::originCharset [inherited]

The charset of the document from which this URI originated.

An empty value implies UTF-8.

If this value is something other than UTF-8 then the URI components (e.g., spec, prePath, username, etc.) will all be fully URL-escaped. Otherwise, the URI components may contain unescaped multibyte UTF-8 characters.

Definition at line 231 of file nsIURI.idl.

attribute AUTF8String nsIURL::param [inherited]

Returns the parameters specified after the ; in the URL.

Some characters may be escaped.

Definition at line 80 of file nsIURL.idl.

attribute AUTF8String nsIURI::password [inherited]

Definition at line 136 of file nsIURI.idl.

attribute AUTF8String nsIURI::path [inherited]

The path, typically including at least a leading '/' (but may also be empty, depending on the protocol).

Some characters may be escaped.

Definition at line 166 of file nsIURI.idl.

Definition at line 107 of file nsIClassInfo.idl.

A port value of -1 corresponds to the protocol's default port (eg.

-1 implies port 80 for http URIs).

Definition at line 158 of file nsIURI.idl.

readonly attribute AUTF8String nsIURI::prePath [inherited]

The prePath (eg.

scheme://user:password:port) returns the string before the path. This is useful for authentication or managing sessions.

Some characters may be escaped.

Definition at line 114 of file nsIURI.idl.

attribute AUTF8String nsIURL::query [inherited]

Returns the query portion (the part after the "?") of the URL.

If there isn't one, an empty string is returned.

Some characters may be escaped.

Definition at line 88 of file nsIURL.idl.

attribute AUTF8String nsIURL::ref [inherited]

Returns the reference portion (the part after the "#") of the URL.

If there isn't one, an empty string is returned.

Some characters may be escaped.

Definition at line 96 of file nsIURL.idl.

const PRUint32 nsIClassInfo::RESERVED = 1 << 31 [inherited]

Definition at line 118 of file nsIClassInfo.idl.

attribute ACString nsIURI::scheme [inherited]

The Scheme is the protocol to which this URI refers.

The scheme is restricted to the US-ASCII charset per RFC2396.

Definition at line 120 of file nsIURI.idl.

const PRUint32 nsIClassInfo::SINGLETON = 1 << 0 [inherited]

Bitflags for 'flags' attribute.

Definition at line 103 of file nsIClassInfo.idl.

attribute AUTF8String nsIURI::spec [inherited]

Returns a string representation of the URI.

Setting the spec causes the new spec to be parsed, initializing the URI.

Some characters may be escaped.

Definition at line 106 of file nsIURI.idl.

const PRUint32 nsIClassInfo::THREADSAFE = 1 << 1 [inherited]

Definition at line 104 of file nsIClassInfo.idl.

const unsigned long nsIStandardURL::URLTYPE_AUTHORITY = 2 [inherited]

blah:foo/bar => blah://foo/bar blah:/foo/bar => blah://foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah://foo/bar

Definition at line 69 of file nsIStandardURL.idl.

blah:foo/bar => blah:///foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar

Definition at line 77 of file nsIStandardURL.idl.

const unsigned long nsIStandardURL::URLTYPE_STANDARD = 1 [inherited]

blah:foo/bar => blah://foo/bar blah:/foo/bar => blah:///foo/bar blah://foo/bar => blah://foo/bar blah:///foo/bar => blah:///foo/bar

Definition at line 61 of file nsIStandardURL.idl.

attribute AUTF8String nsIURI::username [inherited]

The optional username and password, assuming the preHost consists of username:password.

Some characters may be escaped.

Definition at line 135 of file nsIURI.idl.

attribute AUTF8String nsIURI::userPass [inherited]

The username:password (or username only if value doesn't contain a ':')

Some characters may be escaped.

Definition at line 127 of file nsIURI.idl.


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