File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
src/Middleware/HostFiltering/src Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 2
2
// The .NET Foundation licenses this file to you under the MIT license.
3
3
4
4
using System . Runtime . CompilerServices ;
5
- using System . Text ;
6
5
using Microsoft . AspNetCore . Http ;
7
6
using Microsoft . Extensions . Logging ;
8
7
using Microsoft . Extensions . Options ;
@@ -16,14 +15,14 @@ namespace Microsoft.AspNetCore.HostFiltering;
16
15
public class HostFilteringMiddleware
17
16
{
18
17
// Matches Http.Sys.
19
- private static readonly byte [ ] DefaultResponse = Encoding . ASCII . GetBytes (
20
- "<!DOCTYPE HTML PUBLIC \" -//W3C//DTD HTML 4.01//EN\" \" http://www.w3.org/TR/html4/strict.dtd\" >\r \n "
21
- + "<HTML><HEAD><TITLE>Bad Request</TITLE>\r \n "
22
- + "<META HTTP-EQUIV=\" Content-Type\" Content=\" text/html; charset=us-ascii\" ></ HEAD >\r \n "
23
- + "<BODY><h2>Bad Request - Invalid Hostname</h2>\r \n "
24
- + "<hr><p>HTTP Error 400. The request hostname is invalid.</p>\r \n "
25
- + "</BODY></HTML>"
26
- ) ;
18
+ private static readonly byte [ ] DefaultResponse = (
19
+ "<!DOCTYPE HTML PUBLIC \" -//W3C//DTD HTML 4.01//EN\" \" http://www.w3.org/TR/html4/strict.dtd\" >\r \n "u8
20
+ + "<HTML><HEAD><TITLE>Bad Request</TITLE>\r \n "u8
21
+ + "<META HTTP-EQUIV=\" Content-Type\" Content=\" text/html; charset=us-ascii\" ></ HEAD >\r \n "u8
22
+ + "<BODY><h2>Bad Request - Invalid Hostname</h2>\r \n "u8
23
+ + "<hr><p>HTTP Error 400. The request hostname is invalid.</p>\r \n "u8
24
+ + "</BODY></HTML>"u8
25
+ ) . ToArray ( ) ;
27
26
28
27
private readonly RequestDelegate _next ;
29
28
private readonly ILogger < HostFilteringMiddleware > _logger ;
You can’t perform that action at this time.
0 commit comments