D dazwin788 Member Licensed User May 19, 2023 #1 Hi all, (Apologies if I'm posting this in the wrong place- I don't post very often!) I updated the OkHttpUtils2 internal library in B4A to v3.02 yesterday and immediately noticed some of the POSTs / PUTs in my code are timing out with a socket exception where it was fine with v3.01. As as example of code I am using: B4X: Copy Dim j As HttpJob j.Initialize("", Me) j.Username = "XXXXX" j.Password = "XXXXX" j.PostString(ServerUrl, Json.ToString) Wait For (j) JobDone(j As HttpJob) Dim Success As Boolean = ProcessServerResponse(j) j.Release GETs / downloads are fine. Switching back to v3.01 resolves the problem instantly. After a bit of investigation, it would seem that I can circumvent the problem by explicitly setting the content-type header (probably good practice anyway): B4X: Copy j.GetRequest.SetContentType("application/json") This isn't the end of the world, but it does break some of my legacy code where the content-type isn't set. Also I am concerned there may also be other issues with this version if this is just a symptom of another problem. Has anyone else noticed this issue, or am I doing something wrong? As I say, v3.01 works flawlessly. Thanks in advance!
Hi all, (Apologies if I'm posting this in the wrong place- I don't post very often!) I updated the OkHttpUtils2 internal library in B4A to v3.02 yesterday and immediately noticed some of the POSTs / PUTs in my code are timing out with a socket exception where it was fine with v3.01. As as example of code I am using: B4X: Copy Dim j As HttpJob j.Initialize("", Me) j.Username = "XXXXX" j.Password = "XXXXX" j.PostString(ServerUrl, Json.ToString) Wait For (j) JobDone(j As HttpJob) Dim Success As Boolean = ProcessServerResponse(j) j.Release GETs / downloads are fine. Switching back to v3.01 resolves the problem instantly. After a bit of investigation, it would seem that I can circumvent the problem by explicitly setting the content-type header (probably good practice anyway): B4X: Copy j.GetRequest.SetContentType("application/json") This isn't the end of the world, but it does break some of my legacy code where the content-type isn't set. Also I am concerned there may also be other issues with this version if this is just a symptom of another problem. Has anyone else noticed this issue, or am I doing something wrong? As I say, v3.01 works flawlessly. Thanks in advance!
Erel B4X founder Staff member Licensed User Longtime User May 21, 2023 #2 I'm not convinced that it is related to v3.02 changes. The changes have nothing to do with the behavior you are describing. Anyway, it is indeed a good practice to explicitly set the content type. Upvote 0
I'm not convinced that it is related to v3.02 changes. The changes have nothing to do with the behavior you are describing. Anyway, it is indeed a good practice to explicitly set the content type.
D dazwin788 Member Licensed User May 21, 2023 #3 Just strange that swapping back to v3.01 (without any changes to the code at all) addresses the issue. I may be able to provide some test code/app and a server script to demonstrate but I would be reluctant to post our server URL etc on a public forum. If content-type is required to avoid a timeout then really it should be a param in the put and post subs? Upvote 0
Just strange that swapping back to v3.01 (without any changes to the code at all) addresses the issue. I may be able to provide some test code/app and a server script to demonstrate but I would be reluctant to post our server URL etc on a public forum. If content-type is required to avoid a timeout then really it should be a param in the put and post subs?
Erel B4X founder Staff member Licensed User Longtime User May 21, 2023 #4 dazwin788 said: If content-type is required to avoid a timeout then really it should be a param in the put and post subs? Click to expand... There is also no relation between the content type and any timeout you encountered. Upvote 0
dazwin788 said: If content-type is required to avoid a timeout then really it should be a param in the put and post subs? Click to expand... There is also no relation between the content type and any timeout you encountered.