1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3
* The contents of this file are subject to the Mozilla Public
4
* License Version 1.1 (the "License"); you may not use this file
5
* except in compliance with the License. You may obtain a copy of
6
* the License at http://www.mozilla.org/MPL/
8
* Software distributed under the License is distributed on an "AS
9
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10
* implied. See the License for the specific language governing
11
* rights and limitations under the License.
13
* The Original Code is Mozilla.
15
* The Initial Developer of the Original Code is Netscape
16
* Communications. Portions created by Netscape Communications are
17
* Copyright (C) 2001 by Netscape Communications. All
21
* Darin Fisher <darin@netscape.com> (original author)
24
#ifndef nsHttpHeaderArray_h__
25
#define nsHttpHeaderArray_h__
27
#include "nsVoidArray.h"
28
#include "nsIHttpChannel.h"
29
#include "nsIHttpHeaderVisitor.h"
34
class nsHttpHeaderArray
37
nsHttpHeaderArray() {}
38
~nsHttpHeaderArray() { Clear(); }
40
const char *PeekHeader(nsHttpAtom header);
42
nsresult SetHeader(nsHttpAtom header, const nsACString &value, PRBool merge = PR_FALSE);
43
nsresult GetHeader(nsHttpAtom header, nsACString &value);
44
void ClearHeader(nsHttpAtom h);
46
nsresult VisitHeaders(nsIHttpHeaderVisitor *visitor);
48
// parse a header line, return the header atom and a pointer to the
49
// header value (the substring of the header line -- do not free).
50
void ParseHeaderLine(char *line, nsHttpAtom *header=nsnull, char **value=nsnull);
52
void Flatten(nsACString &, PRBool pruneProxyHeaders=PR_FALSE);
54
PRUint32 Count() { return (PRUint32) mHeaders.Count(); }
56
const char *PeekHeaderAt(PRUint32 i, nsHttpAtom &header);
63
nsEntry(nsHttpAtom h, const nsACString &v)
64
: header(h) { value = v; }
70
PRInt32 LookupEntry(nsHttpAtom header, nsEntry **);
71
PRBool CanAppendToHeader(nsHttpAtom header);
74
nsAutoVoidArray mHeaders;