2008-11-17 18:29:00 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
2008-03-05 09:52:00 -05:00
|
|
|
//
|
|
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
//
|
2008-11-17 18:29:00 -05:00
|
|
|
// ----------------------------------------------------------------------------
|
2008-03-05 09:52:00 -05:00
|
|
|
|
|
|
|
using System.Collections.Specialized;
|
|
|
|
|
|
|
|
public class HttpResponse
|
|
|
|
{
|
|
|
|
private string fContentType;
|
|
|
|
private byte[] fBodyData;
|
|
|
|
private StringDictionary fHeaders;
|
|
|
|
private int fStatusCode;
|
|
|
|
|
|
|
|
internal HttpResponse()
|
|
|
|
{
|
|
|
|
fHeaders = new StringDictionary();
|
|
|
|
}
|
|
|
|
|
|
|
|
public int ContentLength
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
2008-11-17 18:29:00 -05:00
|
|
|
if (fBodyData != null) {
|
2008-03-05 09:52:00 -05:00
|
|
|
return fBodyData.Length;
|
|
|
|
}
|
2008-11-17 18:29:00 -05:00
|
|
|
else {
|
|
|
|
return 0;
|
|
|
|
}
|
2008-03-05 09:52:00 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public string ContentType
|
|
|
|
{
|
|
|
|
get { return fContentType; }
|
|
|
|
set { fContentType = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public byte[] BodyData
|
|
|
|
{
|
|
|
|
get { return fBodyData; }
|
|
|
|
set { fBodyData = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public int StatusCode
|
|
|
|
{
|
|
|
|
get { return fStatusCode; }
|
|
|
|
set { fStatusCode = value; }
|
|
|
|
}
|
|
|
|
|
|
|
|
public string GetHeader(string! headerName)
|
|
|
|
{
|
|
|
|
return fHeaders[headerName.ToLower()];
|
|
|
|
}
|
|
|
|
|
|
|
|
public void AddHeader(string! headerName, string! headerValue)
|
|
|
|
{
|
|
|
|
fHeaders[headerName.ToLower()] = headerValue;
|
|
|
|
}
|
|
|
|
}
|