Indentation, whitespace, and comment cleanups.

This commit is contained in:
darin%netscape.com 2001-03-06 08:25:18 +00:00
Родитель 10290f8523
Коммит 9d61a23536
1 изменённых файлов: 71 добавлений и 78 удалений

Просмотреть файл

@ -17,14 +17,13 @@
* Copyright (C) 1998 Netscape Communications Corporation. All * Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved. * Rights Reserved.
* *
* Original Author: Gagan Saksena <gagan@netscape.com>
*
* Contributor(s): * Contributor(s):
* Gagan Saksena <gagan@netscape.com> (original author)
* Darin Fisher <darin@netscape.com>
*/ */
#ifndef _nsHTTPResponseListener_h_ #ifndef nsHTTPResponseListener_h__
#define _nsHTTPResponseListener_h_ #define nsHTTPResponseListener_h__
#include "nsIChannel.h" #include "nsIChannel.h"
#include "nsIStreamListener.h" #include "nsIStreamListener.h"
@ -38,35 +37,33 @@
#include "nsISupportsPrimitives.h" #include "nsISupportsPrimitives.h"
class nsIBufferInputStream;
class nsHTTPResponse; class nsHTTPResponse;
class nsHTTPChannel; class nsHTTPChannel;
/* /*
The nsHTTPResponseListener class is the response reader listener that * The nsHTTPResponseListener class is the response reader listener that
receives notifications of OnStartRequest, OnDataAvailable and * receives notifications of OnStartRequest, OnDataAvailable and
OnStopRequest as the data is received from the server. Each instance * OnStopRequest as the data is received from the server. Each instance
of this class is tied to the corresponding transport that it reads the * of this class is tied to the corresponding transport that it reads the
response data stream from. * response data stream from.
*
*
The essential purpose of this class is to create the actual response * The essential purpose of this class is to create the actual response
based on the data that is coming off the net. * based on the data that is coming off the net.
*
This class is internal to the protocol handler implementation and * This class is internal to the protocol handler implementation and
should theroetically not be used by the app or the core netlib. * should theroetically not be used by the app or the core netlib.
*
-Gagan Saksena 04/29/99 * -Gagan Saksena 04/29/99
*/ */
class nsHTTPResponseListener : public nsIStreamListener class nsHTTPResponseListener : public nsIStreamListener
{ {
public: public:
nsHTTPResponseListener (nsHTTPChannel* aConnection, nsHTTPHandler *handler);
virtual ~nsHTTPResponseListener();
// nsISupport methods...
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
nsHTTPResponseListener(nsHTTPChannel* aChannel,
nsHTTPHandler *aHandler);
virtual ~nsHTTPResponseListener();
// abstract methods implemented by the various ResponseListener // abstract methods implemented by the various ResponseListener
// subclasses... // subclasses...
@ -78,8 +75,8 @@ public:
protected: protected:
nsCOMPtr<nsIStreamListener> mResponseDataListener; nsCOMPtr<nsIStreamListener> mResponseDataListener;
nsHTTPChannel* mChannel; nsHTTPChannel *mChannel;
nsHTTPHandler* mHandler; nsHTTPHandler *mHandler;
}; };
@ -88,51 +85,54 @@ protected:
*/ */
class nsHTTPServerListener : public nsHTTPResponseListener class nsHTTPServerListener : public nsHTTPResponseListener
{ {
public: public:
nsHTTPServerListener (nsHTTPChannel* aConnection, nsHTTPHandler *handler, nsHTTPPipelinedRequest * request, PRBool aDoingProxySSLConnect);
virtual ~nsHTTPServerListener();
NS_DECL_NSISTREAMOBSERVER NS_DECL_NSISTREAMOBSERVER
NS_DECL_NSISTREAMLISTENER NS_DECL_NSISTREAMLISTENER
nsHTTPServerListener(nsHTTPChannel *aConnection,
nsHTTPHandler *aHandler,
nsHTTPPipelinedRequest *aRequest,
PRBool aDoingProxySSLConnect);
virtual ~nsHTTPServerListener();
virtual nsresult FireSingleOnData(nsIStreamListener *aListener, virtual nsresult FireSingleOnData(nsIStreamListener *aListener,
nsISupports *aContext); nsISupports *aContext);
virtual nsresult Abort(); virtual nsresult Abort();
nsresult Discard304Response(void); nsresult Discard304Response();
nsresult FinishedResponseHeaders (); nsresult FinishedResponseHeaders();
protected: protected:
// nsHTTPResponseListener methods... // nsHTTPResponseListener methods...
nsresult FireOnHeadersAvailable(); nsresult FireOnHeadersAvailable();
nsresult ParseStatusLine(nsIInputStream* in, PRUint32 aLength, nsresult ParseStatusLine(nsIInputStream *in,
PRUint32 aLength,
PRUint32 *aBytesRead); PRUint32 *aBytesRead);
nsresult ParseHTTPHeader(nsIInputStream* in, PRUint32 aLength, nsresult ParseHTTPHeader(nsIInputStream *in,
PRUint32* aBytesRead); PRUint32 aLength,
PRUint32 *aBytesRead);
protected: protected:
nsCString mHeaderBuffer; nsCString mHeaderBuffer;
nsHTTPResponse* mResponse; nsHTTPResponse *mResponse;
PRBool mFirstLineParsed; PRPackedBool mFirstLineParsed;
PRBool mHeadersDone; PRPackedBool mHeadersDone;
PRBool mSimpleResponse; PRPackedBool mSimpleResponse;
nsCOMPtr<nsIInputStream> mDataStream; nsCOMPtr<nsIInputStream> mDataStream;
PRUint32 mBytesReceived; PRUint32 mBytesReceived;
PRInt32 mBodyBytesReceived; PRInt32 mBodyBytesReceived;
PRBool mCompressHeaderChecked; PRPackedBool mCompressHeaderChecked;
PRBool mChunkHeaderChecked; PRPackedBool mChunkHeaderChecked;
PRBool mDataReceived; PRPackedBool mDataReceived;
nsCOMPtr<nsISupportsVoid> mChunkHeaderEOF; nsCOMPtr<nsISupportsVoid> mChunkHeaderEOF;
nsHTTPPipelinedRequest* mPipelinedRequest; nsHTTPPipelinedRequest *mPipelinedRequest;
nsHTTPChunkConvContext mChunkHeaderCtx; nsHTTPChunkConvContext mChunkHeaderCtx;
PRBool mDoingProxySSLConnect; PRPackedBool mDoingProxySSLConnect;
}; };
@ -142,21 +142,20 @@ protected:
class nsHTTPCacheListener : public nsHTTPResponseListener class nsHTTPCacheListener : public nsHTTPResponseListener
{ {
public: public:
nsHTTPCacheListener(nsHTTPChannel* aChannel, nsHTTPHandler *handler); NS_DECL_NSISTREAMOBSERVER
virtual ~nsHTTPCacheListener(); NS_DECL_NSISTREAMLISTENER
// nsIStreamObserver methods... nsHTTPCacheListener(nsHTTPChannel *aChannel,
NS_DECL_NSISTREAMOBSERVER nsHTTPHandler *aHandler);
virtual ~nsHTTPCacheListener();
// nsIStreamListener methods... virtual nsresult FireSingleOnData(nsIStreamListener *aListener,
NS_DECL_NSISTREAMLISTENER nsISupports *aContext);
virtual nsresult Abort();
virtual nsresult FireSingleOnData(nsIStreamListener *aListener,
nsISupports *aContext);
virtual nsresult Abort();
protected: protected:
PRInt32 mBodyBytesReceived; PRInt32 mBodyBytesReceived;
PRInt32 mContentLength; PRInt32 mContentLength;
}; };
/* /*
@ -165,39 +164,33 @@ protected:
class nsHTTPFinalListener : public nsIStreamListener class nsHTTPFinalListener : public nsIStreamListener
{ {
public: public:
nsHTTPFinalListener (nsHTTPChannel* aChannel,
nsIStreamListener *aListener, nsISupports* aContext);
virtual ~nsHTTPFinalListener();
// nsISupport methods...
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
// nsIStreamObserver methods...
NS_DECL_NSISTREAMOBSERVER NS_DECL_NSISTREAMOBSERVER
// nsIStreamListener methods...
NS_DECL_NSISTREAMLISTENER NS_DECL_NSISTREAMLISTENER
void FireNotifications (); nsHTTPFinalListener(nsHTTPChannel* aChannel,
void Shutdown (); nsIStreamListener *aListener,
nsISupports* aContext);
virtual ~nsHTTPFinalListener();
nsIStreamListener* GetListener () void FireNotifications();
void Shutdown();
nsIStreamListener *GetListener()
{ {
return mListener; return mListener;
} }
private: private:
nsHTTPChannel* mChannel; nsHTTPChannel *mChannel;
nsCOMPtr<nsISupports> mContext; nsCOMPtr<nsISupports> mContext;
nsCOMPtr<nsIStreamListener> mListener; nsCOMPtr<nsIStreamListener> mListener;
PRBool mOnStartFired; PRPackedBool mOnStartFired;
PRBool mOnStopFired; PRPackedBool mOnStopFired;
PRBool mShutdown; PRPackedBool mShutdown;
PRBool mBusy; PRPackedBool mBusy;
PRBool mOnStopPending; PRPackedBool mOnStopPending;
}; };
#endif
#endif /* _nsHTTPResponseListener_h_ */