Skip to content

Commit bd94496

Browse files
committed
Merge branch 'main' into dmkorolev/tlsclienthello-improvements
2 parents 0c2dc96 + 8903721 commit bd94496

36 files changed

+274
-65
lines changed

.github/workflows/backport.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
backport:
17-
uses: dotnet/arcade/.github/workflows/backport-base.yml@080e393ba794356ef2b743cc89481774c4a26656 # 2025-01-13
17+
uses: dotnet/arcade/.github/workflows/backport-base.yml@fdcda9b4919dd16bd2388b5421cc5d55afac0e88 # 2025-01-13
1818
with:
1919
pr_description_template: |
2020
Backport of #%source_pr_number% to %target_branch%

.github/workflows/inter-branch-merge-flow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ permissions:
1010

1111
jobs:
1212
Merge:
13-
uses: dotnet/arcade/.github/workflows/backport-base.yml@080e393ba794356ef2b743cc89481774c4a26656 # 2024-06-24
13+
uses: dotnet/arcade/.github/workflows/backport-base.yml@fdcda9b4919dd16bd2388b5421cc5d55afac0e88 # 2024-06-24

eng/Version.Details.xml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -320,18 +320,6 @@
320320
<Uri>https://github.com/dotnet/dotnet</Uri>
321321
<Sha>0a01b394b186e190a80cb55740c13f6293cf5446</Sha>
322322
</Dependency>
323-
<!--
324-
Win-x64 is used here because we have picked an arbitrary runtime identifier to flow the version of the latest NETCore.App runtime.
325-
All Runtime.$rid packages should have the same version.
326-
-->
327-
<Dependency Name="Microsoft.NETCore.App.Runtime.win-x64" Version="10.0.0-preview.6.25278.103">
328-
<Uri>https://github.com/dotnet/dotnet</Uri>
329-
<Sha>0a01b394b186e190a80cb55740c13f6293cf5446</Sha>
330-
</Dependency>
331-
<Dependency Name="Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm" Version="10.0.0-preview.6.25278.103">
332-
<Uri>https://github.com/dotnet/dotnet</Uri>
333-
<Sha>0a01b394b186e190a80cb55740c13f6293cf5446</Sha>
334-
</Dependency>
335323
<Dependency Name="Microsoft.NETCore.BrowserDebugHost.Transport" Version="10.0.0-preview.6.25278.103">
336324
<Uri>https://github.com/dotnet/dotnet</Uri>
337325
<Sha>0a01b394b186e190a80cb55740c13f6293cf5446</Sha>

eng/Versions.props

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@
6969
<!-- Packages from dotnet/runtime -->
7070
<MicrosoftExtensionsDependencyModelVersion>10.0.0-preview.6.25278.103</MicrosoftExtensionsDependencyModelVersion>
7171
<MicrosoftNETCoreAppRefVersion>10.0.0-preview.6.25278.103</MicrosoftNETCoreAppRefVersion>
72-
<MicrosoftNETCoreAppRuntimewinx64Version>10.0.0-preview.6.25278.103</MicrosoftNETCoreAppRuntimewinx64Version>
7372
<MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>10.0.0-preview.6.25278.103</MicrosoftNETRuntimeMonoAOTCompilerTaskVersion>
7473
<MicrosoftNETRuntimeWebAssemblySdkVersion>10.0.0-preview.6.25278.103</MicrosoftNETRuntimeWebAssemblySdkVersion>
75-
<MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>10.0.0-preview.6.25278.103</MicrosoftNETCoreAppRuntimeAOTwinx64CrossbrowserwasmVersion>
7674
<MicrosoftNETCoreBrowserDebugHostTransportVersion>10.0.0-preview.6.25278.103</MicrosoftNETCoreBrowserDebugHostTransportVersion>
7775
<MicrosoftExtensionsCachingAbstractionsVersion>10.0.0-preview.6.25278.103</MicrosoftExtensionsCachingAbstractionsVersion>
7876
<MicrosoftExtensionsCachingMemoryVersion>10.0.0-preview.6.25278.103</MicrosoftExtensionsCachingMemoryVersion>

src/Components/Components/src/Routing/Router.cs

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ internal virtual void Refresh(bool isNavigationIntercepted)
223223
var relativePath = NavigationManager.ToBaseRelativePath(_locationAbsolute.AsSpan());
224224
var locationPathSpan = TrimQueryOrHash(relativePath);
225225
var locationPath = $"/{locationPathSpan}";
226-
Activity? activity = null;
226+
Activity? activity;
227227

228228
// In order to avoid routing twice we check for RouteData
229229
if (RoutingStateProvider?.RouteData is { } endpointRouteData)
@@ -286,7 +286,7 @@ internal virtual void Refresh(bool isNavigationIntercepted)
286286
// We did not find a Component that matches the route.
287287
// Only show the NotFound content if the application developer programatically got us here i.e we did not
288288
// intercept the navigation. In all other cases, force a browser navigation since this could be non-Blazor content.
289-
_renderHandle.Render(NotFound ?? DefaultNotFoundContent);
289+
RenderNotFound();
290290
}
291291
else
292292
{
@@ -382,25 +382,32 @@ private void OnNotFound(object sender, EventArgs args)
382382
if (_renderHandle.IsInitialized)
383383
{
384384
Log.DisplayingNotFound(_logger);
385-
_renderHandle.Render(builder =>
386-
{
387-
if (NotFoundPage != null)
388-
{
389-
builder.OpenComponent(0, NotFoundPage);
390-
builder.CloseComponent();
391-
}
392-
else if (NotFound != null)
393-
{
394-
NotFound(builder);
395-
}
396-
else
397-
{
398-
DefaultNotFoundContent(builder);
399-
}
400-
});
385+
RenderNotFound();
401386
}
402387
}
403388

389+
private void RenderNotFound()
390+
{
391+
_renderHandle.Render(builder =>
392+
{
393+
if (NotFoundPage != null)
394+
{
395+
builder.OpenComponent<RouteView>(0);
396+
builder.AddAttribute(1, nameof(RouteView.RouteData),
397+
new RouteData(NotFoundPage, _emptyParametersDictionary));
398+
builder.CloseComponent();
399+
}
400+
else if (NotFound != null)
401+
{
402+
NotFound(builder);
403+
}
404+
else
405+
{
406+
DefaultNotFoundContent(builder);
407+
}
408+
});
409+
}
410+
404411
async Task IHandleAfterRender.OnAfterRenderAsync()
405412
{
406413
if (!_navigationInterceptionEnabled)

src/Components/test/E2ETest/ServerRenderingTests/InteractivityTest.cs

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,4 +1411,41 @@ public void NavigatesWithInteractivityByRequestRedirection(bool controlFlowByExc
14111411
Browser.Click(By.Id("redirectButton"));
14121412
Browser.Equal("Routing test cases", () => Browser.Exists(By.Id("test-info")).Text);
14131413
}
1414+
1415+
[Theory]
1416+
// prerendering (SSR) is tested in NoInteractivityTest
1417+
[InlineData("ServerNonPrerendered")]
1418+
[InlineData("WebAssemblyNonPrerendered")]
1419+
public void ProgrammaticNavigationToNotExistingPathReExecutesTo404(string renderMode)
1420+
{
1421+
Navigate($"{ServerPathBase}/reexecution/redirection-not-found?renderMode={renderMode}&navigate-programmatically=true");
1422+
Assert404ReExecuted();
1423+
}
1424+
1425+
[Theory]
1426+
// prerendering (SSR) is tested in NoInteractivityTest
1427+
[InlineData("ServerNonPrerendered")]
1428+
[InlineData("WebAssemblyNonPrerendered")]
1429+
public void LinkNavigationToNotExistingPathReExecutesTo404(string renderMode)
1430+
{
1431+
Navigate($"{ServerPathBase}/reexecution/redirection-not-found?renderMode={renderMode}");
1432+
Browser.Click(By.Id("link-to-not-existing-page"));
1433+
Assert404ReExecuted();
1434+
}
1435+
1436+
[Theory]
1437+
// prerendering (SSR) is tested in NoInteractivityTest
1438+
[InlineData("ServerNonPrerendered")]
1439+
[InlineData("WebAssemblyNonPrerendered")]
1440+
public void BrowserNavigationToNotExistingPathReExecutesTo404(string renderMode)
1441+
{
1442+
// non-existing path has to have re-execution middleware set up
1443+
// so it has to have "reexecution" prefix. Otherwise middleware mapping
1444+
// will not be activated, see configuration in Startup
1445+
Navigate($"{ServerPathBase}/reexecution/not-existing-page?renderMode={renderMode}");
1446+
Assert404ReExecuted();
1447+
}
1448+
1449+
private void Assert404ReExecuted() =>
1450+
Browser.Equal("Welcome On Page Re-executed After Not Found Event", () => Browser.Exists(By.Id("test-info")).Text);
14141451
}

src/Components/test/E2ETest/ServerRenderingTests/NoInteractivityTest.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,43 @@ public void CanRenderNotFoundPageAfterStreamingStarted()
8787
Browser.Equal("Default Not Found Page", () => Browser.Title);
8888
}
8989

90+
[Theory]
91+
[InlineData(true)]
92+
[InlineData(false)]
93+
public void ProgrammaticNavigationToNotExistingPathReExecutesTo404(bool streaming)
94+
{
95+
string streamingPath = streaming ? "-streaming" : "";
96+
Navigate($"{ServerPathBase}/reexecution/redirection-not-found-ssr{streamingPath}?navigate-programmatically=true");
97+
Assert404ReExecuted();
98+
}
99+
100+
[Theory]
101+
[InlineData(true)]
102+
[InlineData(false)]
103+
public void LinkNavigationToNotExistingPathReExecutesTo404(bool streaming)
104+
{
105+
string streamingPath = streaming ? "-streaming" : "";
106+
Navigate($"{ServerPathBase}/reexecution/redirection-not-found-ssr{streamingPath}");
107+
Browser.Click(By.Id("link-to-not-existing-page"));
108+
Assert404ReExecuted();
109+
}
110+
111+
[Theory]
112+
[InlineData(true)]
113+
[InlineData(false)]
114+
public void BrowserNavigationToNotExistingPathReExecutesTo404(bool streaming)
115+
{
116+
// non-existing path has to have re-execution middleware set up
117+
// so it has to have "reexecution" prefix. Otherwise middleware mapping
118+
// will not be activated, see configuration in Startup
119+
string streamingPath = streaming ? "-streaming" : "";
120+
Navigate($"{ServerPathBase}/reexecution/not-existing-page-ssr{streamingPath}");
121+
Assert404ReExecuted();
122+
}
123+
124+
private void Assert404ReExecuted() =>
125+
Browser.Equal("Welcome On Page Re-executed After Not Found Event", () => Browser.Exists(By.Id("test-info")).Text);
126+
90127
[Theory]
91128
[InlineData(true)]
92129
[InlineData(false)]
@@ -99,6 +136,9 @@ public void CanRenderNotFoundPageNoStreaming(bool useCustomNotFoundPage)
99136
{
100137
var infoText = Browser.FindElement(By.Id("test-info")).Text;
101138
Assert.Contains("Welcome On Custom Not Found Page", infoText);
139+
// custom page should have a custom layout
140+
var aboutLink = Browser.FindElement(By.Id("about-link")).Text;
141+
Assert.Contains("About", aboutLink);
102142
}
103143
else
104144
{

src/Components/test/E2ETest/Tests/GlobalInteractivityTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ public void CanRenderNotFoundInteractive(string renderingMode, bool useCustomNot
3939
{
4040
var infoText = Browser.FindElement(By.Id("test-info")).Text;
4141
Assert.Contains("Welcome On Custom Not Found Page", infoText);
42+
// custom page should have a custom layout
43+
var aboutLink = Browser.FindElement(By.Id("about-link")).Text;
44+
Assert.Contains("About", aboutLink);
4245
}
4346
else
4447
{

src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsNoInteractivityStartup.cs

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,42 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
4848

4949
app.Map("/subdir", app =>
5050
{
51-
if (!env.IsDevelopment())
51+
app.Map("/reexecution", reexecutionApp =>
5252
{
53-
app.UseExceptionHandler("/Error", createScopeForErrors: true);
54-
}
53+
if (!env.IsDevelopment())
54+
{
55+
app.UseExceptionHandler("/Error", createScopeForErrors: true);
56+
}
5557

56-
app.UseStaticFiles();
57-
app.UseRouting();
58-
RazorComponentEndpointsStartup<TRootComponent>.UseFakeAuthState(app);
59-
app.UseAntiforgery();
60-
app.UseEndpoints(endpoints =>
61-
{
62-
endpoints.MapRazorComponents<TRootComponent>();
58+
reexecutionApp.UseStatusCodePagesWithReExecute("/not-found-reexecute", createScopeForErrors: true);
59+
reexecutionApp.UseStaticFiles();
60+
reexecutionApp.UseRouting();
61+
RazorComponentEndpointsStartup<TRootComponent>.UseFakeAuthState(reexecutionApp);
62+
reexecutionApp.UseAntiforgery();
63+
reexecutionApp.UseEndpoints(endpoints =>
64+
{
65+
endpoints.MapRazorComponents<TRootComponent>();
66+
});
6367
});
68+
69+
ConfigureSubdirPipeline(app, env);
70+
});
71+
}
72+
73+
private void ConfigureSubdirPipeline(IApplicationBuilder app, IWebHostEnvironment env)
74+
{
75+
if (!env.IsDevelopment())
76+
{
77+
app.UseExceptionHandler("/Error", createScopeForErrors: true);
78+
}
79+
80+
app.UseStaticFiles();
81+
app.UseRouting();
82+
RazorComponentEndpointsStartup<TRootComponent>.UseFakeAuthState(app);
83+
app.UseAntiforgery();
84+
app.UseEndpoints(endpoints =>
85+
{
86+
endpoints.MapRazorComponents<TRootComponent>();
6487
});
6588
}
6689
}

src/Components/test/testassets/Components.TestServer/RazorComponentEndpointsStartup.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,17 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
7676
app.Map("/reexecution", reexecutionApp =>
7777
{
7878
reexecutionApp.UseStatusCodePagesWithReExecute("/not-found-reexecute", createScopeForErrors: true);
79-
8079
reexecutionApp.UseRouting();
80+
8181
reexecutionApp.UseAntiforgery();
82-
reexecutionApp.UseEndpoints(endpoints =>
83-
{
84-
endpoints.MapRazorComponents<TRootComponent>();
85-
});
82+
ConfigureEndpoints(reexecutionApp, env);
8683
});
8784

8885
ConfigureSubdirPipeline(app, env);
8986
});
9087
}
9188

92-
protected virtual void ConfigureSubdirPipeline(IApplicationBuilder app, IWebHostEnvironment env)
89+
private void ConfigureSubdirPipeline(IApplicationBuilder app, IWebHostEnvironment env)
9390
{
9491
WebAssemblyTestHelper.ServeCoopHeadersIfWebAssemblyThreadingEnabled(app);
9592

@@ -106,11 +103,15 @@ protected virtual void ConfigureSubdirPipeline(IApplicationBuilder app, IWebHost
106103
{
107104
if (ctx.Request.Query.ContainsKey("add-csp"))
108105
{
109-
ctx.Response.Headers.Add("Content-Security-Policy", "script-src 'self' 'unsafe-inline'");
106+
ctx.Response.Headers.Add("Content-Security-Policy", "script-src 'self' 'unsafe-inline'");
110107
}
111108
return nxt();
112109
});
110+
ConfigureEndpoints(app, env);
111+
}
113112

113+
private void ConfigureEndpoints(IApplicationBuilder app, IWebHostEnvironment env)
114+
{
114115
_ = app.UseEndpoints(endpoints =>
115116
{
116117
var contentRootStaticAssetsPath = Path.Combine(env.ContentRootPath, "Components.TestServer.staticwebassets.endpoints.json");

0 commit comments

Comments
 (0)