Revenj.Http.HttpSocketContext.AddHeader C# (CSharp) Méthode

AddHeader() public méthode

public AddHeader ( string type, string value ) : void
type string
value string
Résultat 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);
        }

Usage Example

Exemple #1
0
 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);
     }
 }
All Usage Examples Of Revenj.Http.HttpSocketContext::AddHeader