Back to index

lightning-sunbird  0.9+nobinonly
Private Member Functions | Private Attributes | Friends
nsHttpAuthNode Class Reference

#include <nsHttpAuthCache.h>

List of all members.

Private Member Functions

 nsHttpAuthNode ()
 ~nsHttpAuthNode ()
nsHttpAuthEntryLookupEntryByPath (const char *path)
nsHttpAuthEntryLookupEntryByRealm (const char *realm)
nsresult SetAuthEntry (const char *path, const char *realm, const char *credentials, const char *challenge, const nsHttpAuthIdentity &ident, nsISupports *metadata)
void ClearAuthEntry (const char *realm)
PRUint32 EntryCount ()

Private Attributes

nsVoidArray mList

Friends

class nsHttpAuthCache

Detailed Description

Definition at line 164 of file nsHttpAuthCache.h.


Constructor & Destructor Documentation

Definition at line 447 of file nsHttpAuthCache.cpp.

{
    LOG(("Creating nsHttpAuthNode @%x\n", this));
}

Definition at line 452 of file nsHttpAuthCache.cpp.

{
    LOG(("Destroying nsHttpAuthNode @%x\n", this));

    PRInt32 i;
    for (i=0; i<mList.Count(); ++i)
        delete (nsHttpAuthEntry *) mList[i];
    mList.Clear();
}

Member Function Documentation

void nsHttpAuthNode::ClearAuthEntry ( const char *  realm) [private]

Definition at line 538 of file nsHttpAuthCache.cpp.

{
    nsHttpAuthEntry *entry = LookupEntryByRealm(realm);
    if (entry) {
        mList.RemoveElement(entry); // double search OK
        delete entry;
    }
}

Here is the call graph for this function:

PRUint32 nsHttpAuthNode::EntryCount ( ) [inline, private]

Definition at line 187 of file nsHttpAuthCache.h.

{ return (PRUint32) mList.Count(); }

Definition at line 463 of file nsHttpAuthCache.cpp.

{
    nsHttpAuthEntry *entry;

    // null path matches empty path
    if (!path)
        path = "";

    // look for an entry that either matches or contains this directory.
    // ie. we'll give out credentials if the given directory is a sub-
    // directory of an existing entry.
    for (PRInt32 i=0; i<mList.Count(); ++i) {
        entry = (nsHttpAuthEntry *) mList[i];
        nsHttpAuthPath *authPath = entry->RootPath();
        while (authPath) {
            const char *entryPath = authPath->mPath;
            // proxy auth entries have no path, so require exact match on
            // empty path string.
            if (entryPath[0] == '\0') {
                if (path[0] == '\0')
                    return entry;
            }
            else if (strncmp(path, entryPath, nsCRT::strlen(entryPath)) == 0)
                return entry;

            authPath = authPath->mNext;
        }
    }
    return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 495 of file nsHttpAuthCache.cpp.

{
    nsHttpAuthEntry *entry;

    // null realm matches empty realm
    if (!realm)
        realm = "";

    // look for an entry that matches this realm
    PRInt32 i;
    for (i=0; i<mList.Count(); ++i) {
        entry = (nsHttpAuthEntry *) mList[i];
        if (strcmp(realm, entry->Realm()) == 0)
            return entry;
    }
    return nsnull;
}

Here is the call graph for this function:

Here is the caller graph for this function:

nsresult nsHttpAuthNode::SetAuthEntry ( const char *  path,
const char *  realm,
const char *  credentials,
const char *  challenge,
const nsHttpAuthIdentity ident,
nsISupports *  metadata 
) [private]

Definition at line 514 of file nsHttpAuthCache.cpp.

{
    // look for an entry with a matching realm
    nsHttpAuthEntry *entry = LookupEntryByRealm(realm);
    if (!entry) {
        entry = new nsHttpAuthEntry(path, realm, creds, challenge, ident, metadata);
        if (!entry)
            return NS_ERROR_OUT_OF_MEMORY;
        mList.AppendElement(entry);
    }
    else {
        // update the entry...
        entry->Set(path, realm, creds, challenge, ident, metadata);
    }

    return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsHttpAuthCache [friend]

Definition at line 192 of file nsHttpAuthCache.h.


Member Data Documentation

Definition at line 190 of file nsHttpAuthCache.h.


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