Back to index

lightning-sunbird  0.9+nobinonly
Defines | Functions
nsFingerChannel.cpp File Reference
#include "nsFingerChannel.h"
#include "nsIServiceManager.h"
#include "nsILoadGroup.h"
#include "nsIInterfaceRequestor.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsXPIDLString.h"
#include "nsISocketTransportService.h"
#include "nsIStringStream.h"
#include "nsMimeTypes.h"
#include "nsIStreamConverterService.h"
#include "nsITXTToHTMLConv.h"
#include "nsIProgressEventSink.h"
#include "nsEventQueueUtils.h"
#include "nsNetUtil.h"
#include "nsCRT.h"

Go to the source code of this file.

Defines

#define BUFFER_SEG_SIZE   (4*1024)
#define BUFFER_MAX_SIZE   (64*1024)

Functions

static NS_DEFINE_CID (kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID)
static NS_DEFINE_CID (kStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID)
 NS_IMPL_ISUPPORTS4 (nsFingerChannel, nsIChannel, nsIRequest, nsIStreamListener, nsIRequestObserver) nsresult nsFingerChannel

Define Documentation

#define BUFFER_MAX_SIZE   (64*1024)

Definition at line 63 of file nsFingerChannel.cpp.

#define BUFFER_SEG_SIZE   (4*1024)

Definition at line 62 of file nsFingerChannel.cpp.


Function Documentation

static NS_DEFINE_CID ( kSocketTransportServiceCID  ,
NS_SOCKETTRANSPORTSERVICE_CID   
) [static]
static NS_DEFINE_CID ( kStreamConverterServiceCID  ,
NS_STREAMCONVERTERSERVICE_CID   
) [static]

Definition at line 77 of file nsFingerChannel.cpp.

{
    nsresult rv;
    nsCAutoString autoBuffer;

    NS_ASSERTION(uri, "no uri");

    mURI = uri;
    mProxyInfo = proxyInfo;

//  For security reasons, we do not allow the user to specify a
//  non-default port for finger: URL's.

    mPort = FINGER_PORT;

    rv = mURI->GetPath(autoBuffer); // autoBuffer = user@host
    if (NS_FAILED(rv)) return rv;

    // Now parse out the user and host
    const char* buf = autoBuffer.get();
    const char* pos = strchr(buf, '@');

    // Catch the case of just the host being given
    if (!pos) {
        mUser.Truncate();
        mHost.Assign(buf);
    } else {
        mUser.Assign(buf, pos-buf);
        mHost.Assign(pos+1); // ignore '@'
    }

    if (mHost.IsEmpty())
        return NS_ERROR_MALFORMED_URI;

    mContentType.AssignLiteral(TEXT_HTML); // expected content-type
    return NS_OK;
}

Here is the call graph for this function: