Skip to content
This repository was archived by the owner on Jul 9, 2023. It is now read-only.

Commit f700630

Browse files
committed
Fixing response status line parsing, so that status line is parsed correctly even if Reason-Phrase is missing
1 parent 042a3a0 commit f700630

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Titanium.Web.Proxy/Http/Response.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ internal static void ParseResponseLine(string httpStatus, out Version version, o
145145
out string statusDescription)
146146
{
147147
var httpResult = httpStatus.Split(ProxyConstants.SpaceSplit, 3);
148-
if (httpResult.Length != 3)
148+
if (httpResult.Length <= 1)
149149
{
150150
throw new Exception("Invalid HTTP status line: " + httpStatus);
151151
}
@@ -159,7 +159,7 @@ internal static void ParseResponseLine(string httpStatus, out Version version, o
159159
}
160160

161161
statusCode = int.Parse(httpResult[1]);
162-
statusDescription = httpResult[2];
162+
statusDescription = httpResult.Length > 2 ? httpResult[2] : string.Empty;
163163
}
164164
}
165165
}

0 commit comments

Comments
 (0)