public AddHeader ( string type, string value ) : void | ||
type | string | |
value | string | |
return | void |
public void AddHeader(string type, string value)
{
if (ResponseHeadersLength == ResponseHeaders.Length)
{
var newHeaders = new HeaderPair[ResponseHeaders.Length * 2];
Array.Copy(ResponseHeaders, newHeaders, ResponseHeaders.Length);
ResponseHeaders = newHeaders;
}
if (type == "Content-Type")
ContentTypeResponseIndex = ResponseHeadersLength;
ResponseHeaders[ResponseHeadersLength++] = new HeaderPair(type, value);
}
private void CheckAuth(Socket socket, HttpAuth.AuthorizeOrError auth, HttpSocketContext ctx) { if (auth.SendAuthenticate) { ctx.AddHeader("WWW-Authenticate", MissingBasicAuth); ctx.ReturnError(socket, (int)auth.ResponseCode, auth.Error, true); } else { ctx.ReturnError(socket, (int)auth.ResponseCode, auth.Error, true); } }