Skip to content

Commit 21fff5f

Browse files
Fixes SVO Server regression.
Fixes SVO Server regression. The server broke with UserAgent check, fix it.
1 parent 881c357 commit 21fff5f

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

SpecializedServers/SVO/OTGSecureServerLite.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,18 @@ private static async Task DefaultRoute(HttpContextBase ctx)
8282

8383
try
8484
{
85-
string? UserAgent = ctx.Request.Useragent.ToLower();
85+
string? UserAgent = null;
86+
87+
if (!string.IsNullOrEmpty(ctx.Request.Useragent))
88+
UserAgent = ctx.Request.Useragent.ToLower();
89+
8690
if (!string.IsNullOrEmpty(UserAgent) && (UserAgent.Contains("firefox") || UserAgent.Contains("chrome") || UserAgent.Contains("trident") || UserAgent.Contains("bytespider"))) // Get Away TikTok.
8791
{
8892
LoggerAccessor.LogInfo($"[OTG_HTTPS] - Client - {clientip}:{clientport} Requested the OTG_HTTPS Server while not being allowed!");
8993

9094
ctx.Response.StatusCode = (int)statusCode; // Send the other status.
9195
ctx.Response.ContentType = "text/plain";
92-
sent = await ctx.Response.SendFinalChunk(Array.Empty<byte>());
96+
sent = await ctx.Response.Send();
9397

9498
return;
9599
}

SpecializedServers/SVO/SVOServer.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,11 @@ private async Task ProcessContext(HttpListenerContext? ctx)
166166
LoggerAccessor.LogError($"[SECURITY] - Client - {clientip} Requested the SVO server while being banned!");
167167
else
168168
{
169-
string? UserAgent = ctx.Request.UserAgent.ToLower();
169+
string? UserAgent = null;
170+
171+
if (!string.IsNullOrEmpty(ctx.Request.UserAgent))
172+
UserAgent = ctx.Request.UserAgent.ToLower();
173+
170174
if (!string.IsNullOrEmpty(UserAgent) && (UserAgent.Contains("firefox") || UserAgent.Contains("chrome") || UserAgent.Contains("trident") || UserAgent.Contains("bytespider"))) // Get Away TikTok.
171175
{
172176
ctx.Response.StatusCode = (int)HttpStatusCode.Forbidden;

0 commit comments

Comments
 (0)