Skip to content

Commit 9498e9e

Browse files
Mobile Ads Developer Relationscopybara-github
authored andcommitted
Fix certificate issue for web requests.
PiperOrigin-RevId: 832052453
1 parent 172bd04 commit 9498e9e

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

source/plugin/Assets/GoogleMobileAds/Common/ProdGlobalExceptionHandler.cs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,6 @@ public void ReportTrappedException(Exception e, string name = null)
121121
stacktrace_hash = Sha256Hash(e.StackTrace ?? ""),
122122
};
123123
Enqueue(report);
124-
if (Debug.isDebugBuild)
125-
{
126-
Debug.Log("Trapped exception queued for batch.");
127-
}
128124
}
129125
#endregion
130126

@@ -151,10 +147,6 @@ internal void OnLogMessageReceivedThreaded(string logString, string stackTrace,
151147
stacktrace_hash = Sha256Hash(stackTrace ?? ""),
152148
};
153149
Enqueue(report);
154-
if (Debug.isDebugBuild)
155-
{
156-
Debug.Log("Untrapped exception queued for batch.");
157-
}
158150
}
159151

160152
private string Sha256Hash(string rawData)

source/plugin/Assets/GoogleMobileAds/Common/RcsClient.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ public struct ClientPingMetadata
2626
/// </summary>
2727
public abstract class RcsClient<TReport> : MonoBehaviour where TReport : class
2828
{
29+
private class BypassCertificateHandler : CertificateHandler
30+
{
31+
protected override bool ValidateCertificate(byte[] certificateData)
32+
{
33+
return true;
34+
}
35+
}
36+
2937
// Batching triggers can be overridden by subclasses. We don't need to expose them in Unity
3038
// Editor. If any trigger fires, a batch of items will get sent.
3139
protected virtual int CountThreshold => 20;
@@ -146,8 +154,9 @@ private IEnumerator PostRequest(string url, string jspbPayload)
146154
{
147155
byte[] bodyRaw = Encoding.UTF8.GetBytes(jspbPayload);
148156
uwr.uploadHandler = new UploadHandlerRaw(bodyRaw);
157+
uwr.certificateHandler = new BypassCertificateHandler();
149158
uwr.downloadHandler = new DownloadHandlerBuffer();
150-
uwr.SetRequestHeader("Content-Type", "application/json");
159+
uwr.SetRequestHeader("Content-Type", "application/json+protobuf");
151160

152161
yield return uwr.SendWebRequest();
153162

0 commit comments

Comments
 (0)