Skip to content

Commit 9cdc8fc

Browse files
committed
Properly handle situation when WWW response status is missing
1 parent 9700d81 commit 9cdc8fc

File tree

1 file changed

+4
-7
lines changed
  • Assets/PatchKit Patcher/Scripts/AppData/Remote/WebRequestWraps

1 file changed

+4
-7
lines changed

Assets/PatchKit Patcher/Scripts/AppData/Remote/WebRequestWraps/WrapRequest.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ private IEnumerator JobCoroutine(string url)
4545

4646
try
4747
{
48-
// HACK: because WWW is broken and sometimes just does not return STATUS in responseHeaders we are returning status code 200 (we can assume that status code is not an error since www.error is null or empty).
4948
if (!www.responseHeaders.ContainsKey("STATUS"))
5049
{
51-
DebugLogger.LogWarning("Response headers doesn't contain status information. Since WWW marks response as one without errors, status code is set to 200 (OK).");
52-
_statusCode = 200;
50+
// Based on tests, if response doesn't contain status it has probably timed out.
51+
_wasTimeout = true;
5352
}
5453
else
5554
{
@@ -63,10 +62,8 @@ private IEnumerator JobCoroutine(string url)
6362
}
6463
else
6564
{
66-
// HACK: Again, we can't parse the status code (it might be in some different format) - so we simply set it to 200.
67-
DebugLogger.LogWarning(
68-
"Unable to parse status code. Since WWW marks response as one without errors, status code is set to 200 (OK).");
69-
_statusCode = 200;
65+
// Based on tests, if response contains invalid status it has probably timed out.
66+
_wasTimeout = true;
7067
}
7168
}
7269

0 commit comments

Comments
 (0)