From a8ca37c55a7bc5692536f29bab8a5544f0cf4443 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sat, 21 Sep 2024 07:07:20 +0200 Subject: [PATCH 1/2] fix #3735 --- .../li/cil/oc/server/component/InternetCard.scala | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/scala/li/cil/oc/server/component/InternetCard.scala b/src/main/scala/li/cil/oc/server/component/InternetCard.scala index 13bd4c70a..159ddf192 100644 --- a/src/main/scala/li/cil/oc/server/component/InternetCard.scala +++ b/src/main/scala/li/cil/oc/server/component/InternetCard.scala @@ -524,12 +524,18 @@ object InternetCard { out.close() } + // Finish the connection. Call getInputStream a second time below to re-throw any exception. + // This avoids getResponseCode() waiting for the connection to end in the synchronized block. + try { + http.getInputStream + } catch { + case _: Exception => + } + HTTPRequest.this.synchronized { response = Some((http.getResponseCode, http.getResponseMessage, http.getHeaderFields)) } - // Calling getInputStream() can cause an exception to be thrown for unsuccessful HTTP responses, - // so call it only after the response code/message are set to allow retrieving them. // TODO: This should allow accessing getErrorStream() for reading unsuccessful HTTP responses' output, // but this would be a breaking change for existing OC code. http.getInputStream From b0b022a02e9174976f3d3bbd9af41f2604910883 Mon Sep 17 00:00:00 2001 From: Adrian Siekierka Date: Sat, 21 Sep 2024 07:16:47 +0200 Subject: [PATCH 2/2] OpenComputers 1.8.6 --- build.properties | 2 +- changelog.md | 5 +++-- .../assets/opencomputers/loot/openos/lib/core/boot.lua | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/build.properties b/build.properties index d51f5cb47..15558c735 100644 --- a/build.properties +++ b/build.properties @@ -1,7 +1,7 @@ minecraft.version=1.7.10 forge.version=10.13.4.1614-1.7.10 -oc.version=1.8.5-snapshot +oc.version=1.8.6-snapshot ae2.version=rv2-stable-10 bc.version=7.1.24 diff --git a/changelog.md b/changelog.md index d39dc0c9c..0ef527973 100644 --- a/changelog.md +++ b/changelog.md @@ -1,7 +1,8 @@ ## Fixes/improvements -* [#3710] Fix localization regression introduced in 1.8.4. +* [#3731] Fix string.format() omission in OpenOS package.lua. +* [#3735] Fix server hangs on long-lasting HTTP requests. ## List of contributors -asie, Computerdores, ff66theone, Glease, Hawk777, repo-alt, RobertCochran, yut23 +asie, REUSS-dev diff --git a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua index 0bb01a2f1..f60e8155c 100644 --- a/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua +++ b/src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua @@ -1,7 +1,7 @@ -- called from /init.lua local raw_loadfile = ... -_G._OSVERSION = "OpenOS 1.8.5" +_G._OSVERSION = "OpenOS 1.8.6" -- luacheck: globals component computer unicode _OSVERSION local component = component