public override void SendKnownResponseHeader(int index, string value) { if (_headersSent) { return; } switch (index) { case HttpWorkerRequest.HeaderServer: case HttpWorkerRequest.HeaderDate: case HttpWorkerRequest.HeaderConnection: // ignore these return; case HttpWorkerRequest.HeaderAcceptRanges: if (value == "bytes") { // use this header to detect when we're processing a static file _specialCaseStaticFileHeaders = true; return; } break; case HttpWorkerRequest.HeaderExpires: case HttpWorkerRequest.HeaderLastModified: if (_specialCaseStaticFileHeaders) { // NOTE: Ignore these for static files. These are generated // by the StaticFileHandler, but they shouldn't be. return; } break; case HttpWorkerRequest.HeaderContentType: /* * MakeContentTypeHeader handles some mime types, noteably SVG, * that are not automagically handled via SimpleRequest, and returns * null otherwise. */ string contentType = Connection.MakeContentTypeHeader(_pathTranslated); value = contentType ?? value; break; } _responseHeadersBuilder.Append(GetKnownResponseHeaderName(index)); _responseHeadersBuilder.Append(": "); _responseHeadersBuilder.Append(value); _responseHeadersBuilder.Append("\r\n"); }