From d4d8252725281bf90d19622da61bd92dec237b31 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期二, 22 九月 2026 19:11:55 +0800
Subject: [PATCH] merge3

---
 Assets/Launch/HttpRequest/HttpBehaviour.cs |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/Assets/Launch/HttpRequest/HttpBehaviour.cs b/Assets/Launch/HttpRequest/HttpBehaviour.cs
index 94b579b..a378b4a 100644
--- a/Assets/Launch/HttpRequest/HttpBehaviour.cs
+++ b/Assets/Launch/HttpRequest/HttpBehaviour.cs
@@ -3,11 +3,13 @@
 using UnityEngine;
 using UnityEngine.Networking;
 using System;
+#if !UNITY_WEBGL
 using System.Net;
-using System.Text;
-using System.IO;
 using System.Net.Security;
 using System.Security.Cryptography.X509Certificates;
+#endif
+using System.Text;
+using System.IO;
 using Cysharp.Threading.Tasks;
 
 
@@ -24,15 +26,19 @@
 
         bool getResult = false;
         float timeOut = 0f;
+#if !UNITY_WEBGL
         CookieContainer cookie;
         HttpWebRequest request;
+#endif
         bool ok = false;
         string message = string.Empty;
         public static int ConnectAllTimes = 0;
+#if !UNITY_WEBGL
         static HttpBehaviour()
         {
             ServicePointManager.ServerCertificateValidationCallback += RemoteCertificateValidationCallback;
         }
+#endif
 
         public static void Create(string _url, string _method, string _content, string _contentType, int _retry = 3, Action<bool, string> _result = null)
         {
@@ -105,6 +111,7 @@
             return (ok, message);
         }
 
+#if !UNITY_WEBGL
         void Begin(string _url, string _method, string _content, string _contentType, int _retry = 3, Action<bool, string> _result = null)
         {
             this.url = _url;
@@ -113,7 +120,7 @@
             this.contentType = _contentType;
             this.totalRetryTimes = _retry;
             this.callBack = _result;
-            this.timeOut = Time.time + 5f;
+            this.timeOut = Time.time + 20f;
 
             try
             {
@@ -123,8 +130,8 @@
                 request.Method = _method;
                 request.ContentType = _contentType;
                 request.CookieContainer = cookie;
-                request.Timeout = 2000;
-                request.ReadWriteTimeout = 2000;
+                request.Timeout = 20000;
+                request.ReadWriteTimeout = 20000;
                 request.Proxy = null;
                 request.KeepAlive = true;  //璁剧疆涓簍rue锛岄儴鍒嗚姹傝妭鐐瑰ぇ鏂囦欢浼氭湁闂锛屽湪璇锋眰瀹屾垚鍚庢墜鍔ˋbort閲婃斁
             }
@@ -223,15 +230,18 @@
 
             return acceptCertificate;
         }
+#endif
 
         void Update()
         {
             if (Time.time > timeOut && !getResult)
             {
+#if !UNITY_WEBGL
                 if (request != null)
                 {
                     request.Abort();
                 }
+#endif
                 ok = false;
                 message = "TimeOut";
                 getResult = true;
@@ -263,13 +273,16 @@
                 finally
                 {
                     callBack = null;
+#if !UNITY_WEBGL
                     request?.Abort();
+#endif
                     Destroy(this.gameObject);
                 }
 
             }
         }
 
+#if !UNITY_WEBGL
         private void GetRequestStreamCallback(IAsyncResult ar)
         {
             Stream postStream;
@@ -330,6 +343,7 @@
                 getResult = true;
             }
         }
+#endif
 
 
     }
\ No newline at end of file

--
Gitblit v1.8.0