bug #10739. Reworking header APIs... I've added a new IDL file - nsIHTTPHeader.idl and remove 3 obsolete header files...

This commit is contained in:
rpotts%netscape.com 1999-08-05 08:26:57 +00:00
Родитель 2443f1c614
Коммит 6e6cdb32c5
7 изменённых файлов: 37 добавлений и 257 удалений

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

@ -26,6 +26,7 @@ VPATH = @srcdir@
XPIDL_MODULE = necko_http
XPIDLSRCS = \
nsIHTTPHeader.idl \
nsIHTTPChannel.idl \
nsIHttpNotify.idl \
nsIHTTPProtocolHandler.idl \
@ -34,9 +35,6 @@ XPIDLSRCS = \
EXPORTS = \
nsIHttpEventSink.h \
nsHTTPEnums.h \
nsIHTTPCommonHeaders.h \
nsIHTTPRequest.h \
nsIHTTPResponse.h \
$(NULL)
include $(DEPTH)/config/autoconf.mk

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

@ -23,6 +23,7 @@ include <$(DEPTH)/config/config.mak>
XPIDL_MODULE = necko_http
XPIDLSRCS = \
.\nsIHTTPHeader.idl \
.\nsIHTTPChannel.idl \
.\nsIHttpNotify.idl \
.\nsIHTTPProtocolHandler.idl \

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

@ -20,6 +20,8 @@
interface nsIHTTPEventSink;
interface nsIStreamListener;
interface nsISimpleEnumerator;
interface nsIAtom;
interface nsIInputStream;
[scriptable, uuid(35c00430-1938-11d3-933a-000064657374)]
@ -37,8 +39,9 @@ interface nsIHTTPChannel : nsIChannel
be set before Load() function gets called. Calling them after
the Load() method will result in a NS_ERROR_ALREADY_CONNECTED
*/
string GetRequestHeader(in string headerName);
void SetRequestHeader(in string headerName, in string value);
string GetRequestHeader(in nsIAtom headerAtom);
void SetRequestHeader(in nsIAtom headerAtom, in string value);
nsISimpleEnumerator GetRequestHeaderEnumerator();
void SetRequestMethod(in unsigned long method);
// NS_IMETHOD SetRequestMethod(HTTPMethod i_Method=HM_GET) = 0;
@ -53,7 +56,8 @@ interface nsIHTTPChannel : nsIChannel
Response funtions. A call to any of these implicitly calls Load() on this
protocol instance.
*/
string GetResponseHeader(in string headerName);
string GetResponseHeader(in nsIAtom headerAtom);
nsISimpleEnumerator GetResponseHeaderEnumerator();
readonly attribute unsigned long ResponseStatus;

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

@ -1,143 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsIHTTPCommonHeaders_h_
#define _nsIHTTPCommonHeaders_h_
#include "nsIHeader.h"
/*
nsIHTTPCommonHeaders. This class provides all the common headers
between a request and a response HTTP object. These headers are
classified in two categories. For the moment I did not split
them in two classes but maybe eventually that might be the right
thing to do. The reason to split this should be evident if you
look from a client's perspective. A consumer of the data from
Nunet should not have to worry about transaction information
associated with a connection.
The first category is the Entity headers that deal with a specific
entity that is the key to the transaction (A transaction is either
an HTTP request or a response) A common example of an Entity header
is "Content-Length"
The second category is the Transaction headers that are common to
both HTTP Request and HTTP Response. These specify information about
the transaction (the connection, etc.) and not about the entity
being moved. A common example is "Connection: Keep-Alive"
- Gagan Saksena 03/27/99
*/
class nsIHTTPCommonHeaders : public nsIHeader
{
public:
// Entity headers.
NS_IMETHOD SetAllow(const char* i_Value) = 0;
NS_IMETHOD GetAllow(char* *o_Value) = 0;
NS_IMETHOD SetContentBase(const char* i_Value) = 0;
NS_IMETHOD GetContentBase(char* *o_Value) = 0;
NS_IMETHOD SetContentEncoding(const char* i_Value) = 0;
NS_IMETHOD GetContentEncoding(char* *o_Value) = 0;
NS_IMETHOD SetContentLanguage(const char* i_Value) = 0;
NS_IMETHOD GetContentLanguage(char* *o_Value) = 0;
NS_IMETHOD SetContentLength(const char* i_Value) = 0;
NS_IMETHOD GetContentLength(char* *o_Value) = 0;
NS_IMETHOD SetContentLocation(const char* i_Value) = 0;
NS_IMETHOD GetContentLocation(char* *o_Value) = 0;
NS_IMETHOD SetContentMD5(const char* i_Value) = 0;
NS_IMETHOD GetContentMD5(char* *o_Value) = 0;
NS_IMETHOD SetContentRange(const char* i_Value) = 0;
NS_IMETHOD GetContentRange(char* *o_Value) = 0;
NS_IMETHOD SetContentTransferEncoding(const char* i_Value) = 0;
NS_IMETHOD GetContentTransferEncoding(char* *o_Value) = 0;
NS_IMETHOD SetContentType(const char* i_Value) = 0;
NS_IMETHOD GetContentType(char* *o_Value) = 0;
NS_IMETHOD SetDerivedFrom(const char* i_Value) = 0;
NS_IMETHOD GetDerivedFrom(char* *o_Value) = 0;
NS_IMETHOD SetETag(const char* i_Value) = 0;
NS_IMETHOD GetETag(char* *o_Value) = 0;
NS_IMETHOD SetExpires(const char* i_Value) = 0;
NS_IMETHOD GetExpires(char* *o_Value) = 0;
NS_IMETHOD SetLastModified(const char* i_Value) = 0;
NS_IMETHOD GetLastModified(char* *o_Value) = 0;
/*
To set multiple link headers, call set link again.
*/
NS_IMETHOD SetLink(const char* i_Value) = 0;
NS_IMETHOD GetLink(char* *o_Value) = 0;
NS_IMETHOD GetLinkMultiple(
const char** *o_ValueArray,
int count) const = 0;
NS_IMETHOD SetTitle(const char* i_Value) = 0;
NS_IMETHOD GetTitle(char* *o_Value) = 0;
NS_IMETHOD SetURI(const char* i_Value) = 0;
NS_IMETHOD GetURI(char* *o_Value) = 0;
NS_IMETHOD SetVersion(const char* i_Value) = 0;
NS_IMETHOD GetVersion(char* *o_Value) = 0;
// Common Transaction headers
NS_IMETHOD SetConnection(const char* i_Value) = 0;
NS_IMETHOD GetConnection(char* *o_Value) = 0;
NS_IMETHOD SetDate(const char* i_Value) = 0;
NS_IMETHOD GetDate(char* *o_Value) = 0;
NS_IMETHOD SetPragma(const char* i_Value) = 0;
NS_IMETHOD GetPragma(char* *o_Value) = 0;
NS_IMETHOD SetForwarded(const char* i_Value) = 0;
NS_IMETHOD GetForwarded(char* *o_Value) = 0;
NS_IMETHOD SetMessageID(const char* i_Value) = 0;
NS_IMETHOD GetMessageID(char* *o_Value) = 0;
NS_IMETHOD SetMIME(const char* i_Value) = 0;
NS_IMETHOD GetMIME(char* *o_Value) = 0;
NS_IMETHOD SetTrailer(const char* i_Value) = 0;
NS_IMETHOD GetTrailer(char* *o_Value) = 0;
NS_IMETHOD SetTransfer(const char* i_Value) = 0;
NS_IMETHOD GetTransfer(char* *o_Value) = 0;
static const nsIID& GetIID() {
// {C81A4600-EBC0-11d2-B018-006097BFC036}
static const nsIID NS_IHTTP_COMMON_HEADERS_IID =
{ 0xc81a4600, 0xebc0, 0x11d2, { 0xb0, 0x18, 0x0, 0x60, 0x97, 0xbf, 0xc0, 0x36 } };
return NS_IHTTP_COMMON_HEADERS_IID ;
};
};
#endif // _nsIHTTPCommonHeaders_h_

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

@ -0,0 +1,28 @@
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#include "nsISupports.idl"
interface nsIAtom;
[scriptable, uuid(a3ec67f0-465a-11d3-9a89-0080c7cb1080)]
interface nsIHTTPHeader : nsISupports
{
void GetField(out nsIAtom headerAtom);
void GetValue(out string headerValue);
};

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

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsIHTTPRequest_h_
#define _nsIHTTPRequest_h_
#include "nsIHTTPCommonHeaders.h"
// #include "nsIHTTPHandler.h"
#include "nsHTTPEnums.h"
/*
The nsIHTTPRequest class is the interface to an intance
of the HTTP request that gets created on a per URL/connection basis.
-Gagan Saksena 03/06/99
*/
class nsIHTTPRequest : public nsIHTTPCommonHeaders
{
public:
NS_IMETHOD SetAccept(const char* i_AcceptHeader) = 0;
NS_IMETHOD SetUserAgent(const char* i_UserAgent) = 0;
NS_IMETHOD SetHTTPVersion(HTTPVersion i_Version = HTTP_ONE_ONE) = 0;
static const nsIID& GetIID() {
// {A4FD6E61-FE7B-11d2-B019-006097BFC036}
static const nsIID NS_IHTTPRequest_IID =
{ 0xa4fd6e61, 0xfe7b, 0x11d2, { 0xb0, 0x19, 0x0, 0x60, 0x97, 0xbf, 0xc0, 0x36 } };
return NS_IHTTPRequest_IID;
};
};
//Possible errors- place holder
//#define NS_ERROR_WHATEVER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 400);
#endif /* _nsIHTTPRequest_h_ */

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

@ -1,54 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
#ifndef _nsIHTTPResponse_h_
#define _nsIHTTPResponse_h_
#include "nsIHTTPCommonHeaders.h"
/*
The nsIHTTPResponse class is the interface to the response
associated with a request.
-Gagan Saksena 03/06/99
*/
class nsIHTTPResponse : public nsIHTTPCommonHeaders
{
public:
NS_IMETHOD GetContentLength(PRInt32* o_Value) const = 0;
NS_IMETHOD GetStatus(PRUint32* o_Value) const = 0;
NS_IMETHOD GetStatusString(char* *o_String) const = 0;
NS_IMETHOD GetServer(char* *o_String) const = 0;
static const nsIID& GetIID() {
// {A4FD6E60-FE7B-11d2-B019-006097BFC036}
static const nsIID NS_IHTTPResponse_IID =
{ 0xa4fd6e60, 0xfe7b, 0x11d2, { 0xb0, 0x19, 0x0, 0x60, 0x97, 0xbf, 0xc0, 0x36 } };
return NS_IHTTPResponse_IID;
};
};
//Possible errors- place holder
//#define NS_ERROR_WHATEVER NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_NETWORK, 400);
#endif /* _nsIHTTPResponse_h_ */