Detailed Description

Deals with HTTP headers. Internally the indices are always lowercase. Empty string is the status line.

Public Member Functions

void AddIfNew (string name, string value)
 Sets the named header only if it's not already set. More...
 
void Overwrite (string name, string value)
 Sets the named header with the given single value. More...
 
string Get (string header)
 Gets the last header with the named value. More...
 
List< string > GetAll (string header)
 Gets the set of headers of the given type. E.g. all Set-Cookie headers. More...
 
void Add (string name, string value)
 Appends the named header. More...
 
void Apply (string rawText)
 Applies the given raw headers, overwriting everything else in this set. More...
 
override string ToString ()
 Gets this as a valid string of HTTP headers. More...
 
Dictionary< string, string > ToSingleSet ()
 Gets the headers as a set for use by Unity's WWW. More...
 

Static Public Member Functions

static Dictionary< string,
List< string > > 
ParseHeaders (string rawHeaders)
 Converts a raw header string to a set of headers. The status line is indexed as the empty string. More...
 
static string HeaderString (Dictionary< string, List< string >> headers)
 Converts a list of headers to the raw header string. Always includes the status line. Note that the header set contains the status line indexed as the empty string. More...
 
static string ToHeaderCapitals (string h)
 Converts a header name, e.g. "content-type", to its capitalized form. This is technically not required by the standard, but some servers are non-compliant and don't work correctly if you send broken headers. More...
 

Public Attributes

Dictionary< string, List
< string > > 
lines
 The raw headers set. Indices are always lowercase. Empty string is the status line. More...
 

Properties

string status [get, set]
 The status line. Null if none set. More...
 
string this[string header] [get, set]
 Gets/ sets a header (overwrites rather than appends). More...
 

Static Private Attributes

static string[] HeaderSplit =new string[]{"\r\n"}
 Used to split headers up. More...
 

Member Function Documentation

void PowerUI.Http.Headers.Add ( string  name,
string  value 
)
inline

Appends the named header.

void PowerUI.Http.Headers.AddIfNew ( string  name,
string  value 
)
inline

Sets the named header only if it's not already set.

void PowerUI.Http.Headers.Apply ( string  rawText)
inline

Applies the given raw headers, overwriting everything else in this set.

string PowerUI.Http.Headers.Get ( string  header)
inline

Gets the last header with the named value.

List<string> PowerUI.Http.Headers.GetAll ( string  header)
inline

Gets the set of headers of the given type. E.g. all Set-Cookie headers.

static string PowerUI.Http.Headers.HeaderString ( Dictionary< string, List< string >>  headers)
inlinestatic

Converts a list of headers to the raw header string. Always includes the status line. Note that the header set contains the status line indexed as the empty string.

void PowerUI.Http.Headers.Overwrite ( string  name,
string  value 
)
inline

Sets the named header with the given single value.

static Dictionary<string,List<string> > PowerUI.Http.Headers.ParseHeaders ( string  rawHeaders)
inlinestatic

Converts a raw header string to a set of headers. The status line is indexed as the empty string.

static string PowerUI.Http.Headers.ToHeaderCapitals ( string  h)
inlinestatic

Converts a header name, e.g. "content-type", to its capitalized form. This is technically not required by the standard, but some servers are non-compliant and don't work correctly if you send broken headers.

Dictionary<string,string> PowerUI.Http.Headers.ToSingleSet ( )
inline

Gets the headers as a set for use by Unity's WWW.

override string PowerUI.Http.Headers.ToString ( )
inline

Gets this as a valid string of HTTP headers.

Member Data Documentation

string [] PowerUI.Http.Headers.HeaderSplit =new string[]{"\r\n"}
staticprivate

Used to split headers up.

Dictionary<string,List<string> > PowerUI.Http.Headers.lines

The raw headers set. Indices are always lowercase. Empty string is the status line.

Property Documentation

string PowerUI.Http.Headers.status
getset

The status line. Null if none set.

string PowerUI.Http.Headers.this[string header]
getset

Gets/ sets a header (overwrites rather than appends).