-
Notifications
You must be signed in to change notification settings - Fork 10k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[3.1] Add latin1 support to IIS (#22798)
Co-authored-by: Chris Ross <Tratcher@Outlook.com>
- Loading branch information
Showing
18 changed files
with
220 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/Servers/IIS/IIS/test/Common.FunctionalTests/Inprocess/Latin1Tests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using System.Net; | ||
using System.Net.Http; | ||
using System.Threading.Tasks; | ||
using Microsoft.AspNetCore.Server.IIS.FunctionalTests.Utilities; | ||
using Microsoft.AspNetCore.Server.IntegrationTesting; | ||
using Microsoft.AspNetCore.Server.IntegrationTesting.IIS; | ||
using Microsoft.AspNetCore.Testing; | ||
using Xunit; | ||
|
||
namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests.InProcess | ||
{ | ||
[Collection(PublishedSitesCollection.Name)] | ||
public class Latin1Tests : IISFunctionalTestBase | ||
{ | ||
public Latin1Tests(PublishedSitesFixture fixture) : base(fixture) | ||
{ | ||
} | ||
|
||
[ConditionalFact] | ||
[RequiresNewHandler] | ||
public async Task Latin1Works() | ||
{ | ||
var deploymentParameters = Fixture.GetBaseDeploymentParameters(); | ||
deploymentParameters.TransformArguments((a, _) => $"{a} AddLatin1"); | ||
|
||
var deploymentResult = await DeployAsync(deploymentParameters); | ||
|
||
var client = new HttpClient(new LoggingHandler(new WinHttpHandler() { SendTimeout = TimeSpan.FromMinutes(3) }, deploymentResult.Logger)); | ||
|
||
var requestMessage = new HttpRequestMessage(HttpMethod.Get, $"{deploymentResult.ApplicationBaseUri}Latin1"); | ||
requestMessage.Headers.Add("foo", "£"); | ||
|
||
var result = await client.SendAsync(requestMessage); | ||
Assert.Equal(HttpStatusCode.OK, result.StatusCode); | ||
} | ||
|
||
[ConditionalFact] | ||
[RequiresNewHandler] | ||
public async Task Latin1ReplacedWithoutAppContextSwitch() | ||
{ | ||
var deploymentParameters = Fixture.GetBaseDeploymentParameters(); | ||
deploymentParameters.TransformArguments((a, _) => $"{a}"); | ||
|
||
var deploymentResult = await DeployAsync(deploymentParameters); | ||
|
||
var client = new HttpClient(new LoggingHandler(new WinHttpHandler() { SendTimeout = TimeSpan.FromMinutes(3) }, deploymentResult.Logger)); | ||
|
||
var requestMessage = new HttpRequestMessage(HttpMethod.Get, $"{deploymentResult.ApplicationBaseUri}InvalidCharacter"); | ||
requestMessage.Headers.Add("foo", "£"); | ||
|
||
var result = await client.SendAsync(requestMessage); | ||
Assert.Equal(HttpStatusCode.OK, result.StatusCode); | ||
} | ||
|
||
[ConditionalFact] | ||
[RequiresNewHandler] | ||
public async Task Latin1InvalidCharacters_HttpSysRejects() | ||
{ | ||
var deploymentParameters = Fixture.GetBaseDeploymentParameters(); | ||
deploymentParameters.TransformArguments((a, _) => $"{a} AddLatin1"); | ||
|
||
var deploymentResult = await DeployAsync(deploymentParameters); | ||
|
||
using (var connection = new TestConnection(deploymentResult.HttpClient.BaseAddress.Port)) | ||
{ | ||
await connection.Send( | ||
"GET /ReadAndFlushEcho HTTP/1.1", | ||
"Host: localhost", | ||
"Connection: close", | ||
"foo: £\0a", | ||
"", | ||
""); | ||
|
||
await connection.ReceiveStartsWith("HTTP/1.1 400 Bad Request"); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.