/*++ Copyright (c) 1999 Microsoft Corporation Module Name : TRACE.java Abstract: This module implements the TRACE verb for static files in ASP. Author: Saurab Nog ( SaurabN ) 03-May-1999 Environment: COM+ - User Mode Managed Run Time Project: Web Server --*/ using System.IO; using System.ASP; namespace System.IIS { public class TraceHandler : IHttpHandler { /********************************************************************++ Routine Description: This function handles TRACE verb. Echoes the contents of the incoming request. --********************************************************************/ public void ProcessRequest(HttpContext context) { HttpRequest request = context.Request; HttpResponse response = context.Response; Stream RawRequest = request.InputStream; int length = (int) RawRequest.GetLength(); if (length > 0) { throw new HttpException(HttpStatus.BadRequest, "Entity with TRACE request"); } // Echo the request line response.Write(request.HttpMethod + " " + request.RawUrl); response.Write(" " + request.ServerVariables["SERVER_PROTOCOL"] + "\r\n"); // Echo the request headers (and trailing blank line) response.Write(request.ServerVariables["ALL_RAW"]); response.Write("\r\n"); // Set content type as message/http response.AppendHeader("Content-Type","message/http"); } public bool IsReusable() { return true; } }; }