Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fetch TLS client hello message from HTTP.SYS#61494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
wtgodbe merged 24 commits intorelease/8.0frombrecon/bptls
Apr 15, 2025
Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
24 commits
Select commitHold shift + click to select a range
757457a
setup for tls clinet hello exposure
DeagleGrossMar 6, 2025
a376c94
correctly retry access
DeagleGrossMar 7, 2025
9c5fc17
last minute changes
DeagleGrossMar 7, 2025
e8834a2
fix warnings
DeagleGrossMar 7, 2025
c953a21
hook up tls client hello callback
DeagleGrossApr 7, 2025
6c5239d
fix warnings & publish API
DeagleGrossApr 7, 2025
ff9518c
minimal
DeagleGrossApr 7, 2025
de70b16
only go via callback if options has callback set; remove unused
DeagleGrossApr 7, 2025
1441e30
PR review
DeagleGrossApr 7, 2025
56704ef
address PR comments x1
DeagleGrossApr 8, 2025
d43b424
TTL & evict approach
DeagleGrossApr 8, 2025
6275c30
address comments 1
DeagleGrossApr 8, 2025
c58805b
periodic timer
DeagleGrossApr 8, 2025
25d4955
address comments x3
DeagleGrossApr 8, 2025
b12f515
TryAdd
DeagleGrossApr 8, 2025
7a39916
make a static field (just in case)
DeagleGrossApr 8, 2025
4f85d5f
Cache updates
BrennanConroyApr 10, 2025
53721d7
test
BrennanConroyApr 11, 2025
9b012c3
whitespace
BrennanConroyApr 11, 2025
a801563
clear array
BrennanConroyApr 11, 2025
03c0cfb
appcontext
BrennanConroyApr 11, 2025
370d39c
fb
BrennanConroyApr 14, 2025
abd38ff
bp changes
BrennanConroyApr 14, 2025
909128b
Update src/Servers/HttpSys/src/RequestProcessing/RequestContext.cs
BrennanConroyApr 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
PrevPrevious commit
NextNext commit
appcontext
  • Loading branch information
@BrennanConroy
BrennanConroy committedApr 14, 2025
commit03c0cfbd1ceecdd4c36a569682b5d9541fe995fc
21 changes: 18 additions & 3 deletionssrc/Servers/HttpSys/src/RequestProcessing/TlsListener.cs
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -18,15 +18,30 @@ internal sealed partial class TlsListener : IDisposable
private readonly Task _cleanupTask;
private readonly TimeProvider _timeProvider;

privatestaticreadonly TimeSpan ConnectionIdleTime = TimeSpan.FromMinutes(5);
privatestaticreadonly TimeSpan CleanupDelay = TimeSpan.FromSeconds(10);
internalconst int CacheSizeLimit = 1_000_000;
private readonly TimeSpan ConnectionIdleTime = TimeSpan.FromMinutes(5);
private readonly TimeSpan CleanupDelay = TimeSpan.FromSeconds(10);
internalreadonly int CacheSizeLimit = 1_000_000;

// Internal for testing purposes
internal ReadOnlyDictionary<ulong, DateTimeOffset> ConnectionTimeStamps => _connectionTimestamps.AsReadOnly();

internal TlsListener(ILogger logger, Action<IFeatureCollection, ReadOnlySpan<byte>> tlsClientHelloBytesCallback, TimeProvider? timeProvider = null)
{
if (AppContext.GetData("Microsoft.AspNetCore.Server.HttpSys.TlsListener.CacheSizeLimit") is int limit)
{
CacheSizeLimit = limit;
}

if (AppContext.GetData("Microsoft.AspNetCore.Server.HttpSys.TlsListener.ConnectionIdleTime") is int idleTime)
{
ConnectionIdleTime = TimeSpan.FromSeconds(idleTime);
}

if (AppContext.GetData("Microsoft.AspNetCore.Server.HttpSys.TlsListener.CleanupDelay") is int cleanupDelay)
{
CleanupDelay = TimeSpan.FromSeconds(cleanupDelay);
}

_logger = logger;
_tlsClientHelloBytesCallback = tlsClientHelloBytesCallback;

Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -100,14 +100,14 @@ public async Task EvictsOldestConnectionsWhenExceedingCacheSizeLimit()
var features = Mock.Of<IFeatureCollection>();

ulong i = 0;
for (; i <TlsListener.CacheSizeLimit; i++)
for (; i <(ulong)tlsListener.CacheSizeLimit; i++)
{
tlsListener.InvokeTlsClientHelloCallback(i, features, (f, cb) => { cb(f, ReadOnlySpan<byte>.Empty); return true; });
}

timeProvider.Advance(TimeSpan.FromSeconds(5));

for (; i <TlsListener.CacheSizeLimit + 3; i++)
for (; i <(ulong)tlsListener.CacheSizeLimit + 3; i++)
{
tlsListener.InvokeTlsClientHelloCallback(i, features, (f, cb) => { cb(f, ReadOnlySpan<byte>.Empty); return true; });
}
Expand All@@ -122,15 +122,15 @@ public async Task EvictsOldestConnectionsWhenExceedingCacheSizeLimit()
while (timeout > TimeSpan.Zero)
{
// Wait for the cleanup loop to run
if (tlsListener.ConnectionTimeStamps.Count ==TlsListener.CacheSizeLimit)
if (tlsListener.ConnectionTimeStamps.Count ==tlsListener.CacheSizeLimit)
{
break;
}
timeout -= TimeSpan.FromMilliseconds(100);
await Task.Delay(100);
}

Assert.Equal(TlsListener.CacheSizeLimit, tlsListener.ConnectionTimeStamps.Count);
Assert.Equal(tlsListener.CacheSizeLimit, tlsListener.ConnectionTimeStamps.Count);
Assert.Contains(0UL, tlsListener.ConnectionTimeStamps.Keys);
// 3 newest connections should be present
Assert.Contains(i - 1, tlsListener.ConnectionTimeStamps.Keys);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp