Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
CypherPotato committed Nov 13, 2024
1 parent 59b8191 commit 7e6c379
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions extensions/Sisk.SslProxy/Sisk.SslProxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
<PackageTags>http-server,http,web framework</PackageTags>
<RepositoryType>git</RepositoryType>

<Version>1.2-alpha5</Version>
<AssemblyVersion>1.2</AssemblyVersion>
<FileVersion>1.2</FileVersion>
<Version>1.3-alpha6</Version>
<AssemblyVersion>1.3</AssemblyVersion>
<FileVersion>1.3</FileVersion>

<NeutralLanguage>en</NeutralLanguage>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
Expand Down
5 changes: 2 additions & 3 deletions src/Http/HttpContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,15 @@ namespace Sisk.Core.Http
/// </summary>
public sealed class HttpContext
{
[ThreadStatic]
internal static HttpContext? _threadShared = null;
internal static AsyncLocal<HttpContext?> _context = new AsyncLocal<HttpContext?>();

/// <summary>
/// Gets the current running <see cref="HttpContext"/>.
/// </summary>
/// <remarks>
/// This property is only accessible during an HTTP session, within the executing HTTP code.
/// </remarks>
public static HttpContext Current { get => _threadShared ?? throw new InvalidOperationException(SR.HttpContext_InvalidThreadStaticAccess); }
public static HttpContext Current { get => _context.Value ?? throw new InvalidOperationException(SR.HttpContext_InvalidThreadStaticAccess); }

/// <summary>
/// Gets or sets an <see cref="HttpHeaderCollection"/> indicating HTTP headers which
Expand Down
2 changes: 1 addition & 1 deletion src/Http/HttpServer__Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ private void ProcessRequest(HttpListenerContext context)
HttpContext? srContext = new HttpContext(this);
bool closeStream = true;

HttpContext._threadShared = srContext;
HttpContext._context.Value = srContext;

bool hasAccessLogging = this.ServerConfiguration.AccessLogsStream is not null;
bool hasErrorLogging = this.ServerConfiguration.ErrorsLogsStream is not null;
Expand Down

0 comments on commit 7e6c379

Please sign in to comment.