private void PostProcessHeaders() { if (HttpVersion == "1.1" && Host == null) { RequestError("400", "HTTP/1.1 requests must include Host header"); return; } if (Client.Server.RequireAuthentication && Server.Authenticator.Authenticate(Username, Password) == false) { Response.SetHeader("WWW-Authenticate", "Basic realm=\"" + Client.Server.AuthenticateRealm + "\""); RequestError("401", StatusCodes.GetDescription("401")); return; } try { // Try parsing a relative URI //uri = new Uri(client.server.ServerUri, requestUri); Uri = Client.Server.GetRelUri(requestUri); } catch { try { // Try parsing an absolute URI //uri = new Uri(requestUri); Uri = Client.Server.GetAbsUri(requestUri); } catch (UriFormatException) { RequestError("400", "Invalid URI"); return; } catch (IndexOutOfRangeException) // System.Uri in .NET 1.1 throws this exception in certain cases { RequestError("400", "Invalid URI"); return; } } if (Host != null) { Uri = Client.Server.GetHostUri(Host, requestUri); } // Try to determine the time difference between the client and this computer; adjust ifModifiedSince and ifUnmodifiedSince accordingly if (Date != DateTime.MinValue) { if (IfModifiedSince != DateTime.MinValue) { IfModifiedSince = IfModifiedSince.Add(DateTime.UtcNow.Subtract(Date)); } if (IfUnmodifiedSince != DateTime.MinValue) { IfUnmodifiedSince = IfUnmodifiedSince.Add(DateTime.UtcNow.Subtract(Date)); } } if (Method == "POST") { if (ContentLength == long.MinValue) { RequestError("411", StatusCodes.GetDescription("411")); return; } Mode = DataMode.Binary; } else { IsRequestFinished = true; } }