Skip to content

Commit

Permalink
🐛 更新子模块 适配转发请求头
Browse files Browse the repository at this point in the history
  • Loading branch information
Mossimos committed Jun 29, 2024
1 parent 902919c commit f10df31
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,10 @@ async Task HandleHttpRequestAsync(HttpContext context)
return null;
}

StringValues cookie = context.Request.Headers["cookie-steamTool"];
StringValues cookie = context.Request.Headers["cookie-steamtool"];
if (StringValues.IsNullOrEmpty(cookie))
cookie = context.Request.Headers["Cookie"];
StringValues referer = context.Request.Headers["Referer-steamTool"];

StringValues referer = context.Request.Headers["Referer-steamtool"];
context.Response.Headers.AccessControlAllowOrigin = context.Request.Headers.Origin.Count == 0 ? "*" : context.Request.Headers.Origin;
context.Response.Headers.AccessControlAllowHeaders = "*";
context.Response.Headers.AccessControlAllowMethods = "*";
Expand All @@ -166,6 +165,14 @@ async Task SendAsync()
Method = methodObj,
Content = hasReqContent ? new StreamContent(context.Request.Body) : null,
};
foreach (var item in context.Request.Headers)
{

if (item.Key.ToLower().EndsWith("-steamtool"))
{
req.Headers.TryAddWithoutValidation(item.Key.TrimEnd("-steamtool"), (IEnumerable<string?>)item.Value);
}
}
req.Headers.UserAgent.ParseAdd(context.Request.Headers.UserAgent);
if (!StringValues.IsNullOrEmpty(cookie))
{
Expand Down

0 comments on commit f10df31

Please sign in to comment.