Skip to content

Commit 3defbb0

Browse files
author
John Cannon
committed
Relaxes HTTP STATUS Header validation
Checks if the response status contains "200 OK" where the previous code only checked for "HTTP/1.1 200 OK". Newer browsers sometimes use HTTP/2.0 resulting in a STATUS of "HTTP/2.0 200 OK".
1 parent 7cc2369 commit 3defbb0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

source/Plugins/GoogleAnalyticsV3/GoogleAnalyticsMPV3.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,13 +152,13 @@ public IEnumerator HandleWWW(WWW request)
152152
{
153153
yield return request;
154154
if (request.responseHeaders.ContainsKey("STATUS")) {
155-
if (request.responseHeaders["STATUS"] == "HTTP/1.1 200 OK") {
155+
if (request.responseHeaders["STATUS"].Contains("200 OK")) {
156156
if (GoogleAnalyticsV3.belowThreshold(logLevel, GoogleAnalyticsV3.DebugMode.INFO)) {
157157
Debug.Log("Successfully sent Google Analytics hit.");
158158
}
159159
} else {
160160
if (GoogleAnalyticsV3.belowThreshold(logLevel, GoogleAnalyticsV3.DebugMode.WARNING)) {
161-
Debug.LogWarning("Google Analytics hit request rejected with" +
161+
Debug.LogWarning("Google Analytics hit request rejected with " +
162162
"status code " + request.responseHeaders["STATUS"]);
163163
}
164164
}

0 commit comments

Comments
 (0)