Skip to content

Commit 79e3f19

Browse files
committed
Merge remote-tracking branch 'origin/master-MC1.7.10' into master-MC1.12
2 parents 9833087 + 1c163dd commit 79e3f19

File tree

5 files changed

+31
-96
lines changed

5 files changed

+31
-96
lines changed

changelog.md

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,9 @@
11
## New Features/Support
22

3-
* Added: Experimental Lua 5.4 support (Lua 5.4.4).
4-
* For now, this is hidden behind a configuration option.
5-
* Added: Forestry circuit boards' internal layout is now available to Lua scripts.
6-
* Added: Major upgrade of Lua libraries.
7-
* Updated LuaJ to 3.0.2 with many third-party patches applied.
8-
* JNLua is now compiled with proper optimizations - ~2x better performance!
9-
* Lua 5.2 has been updated with gamax92's backported bugfixes.
10-
* Lua 5.3 has been updated from 5.3.2 to 5.3.6.
11-
* 64-bit integers in calls should now be handled properly.
12-
* Added: New robot names.
13-
* Added: Official support for AArch64 on Linux and macOS.
14-
* Added: Source tank parameter for Transposer transferFluid(). (repo-alt)
15-
* Added: Subtle indentations to Redstone I/O texture.
16-
* The amount of darkened dots on each side marks the ordinal number of the side it responds to.
17-
* Added: Support for non-BMP Unicode codepoints!
18-
* To clarify, Unicode characters >= 0x10000 should now be fully supported - as long as they're provided in the font.
19-
* Added: Support for partial font overrides in resource packs.
20-
* If a resource pack's font.hex file only contains some glyphs, missing glyphs present in parent resource packs won't disappear.
21-
* Added: Support for the "PATCH" HTTP method. (hohserg1)
22-
* Added: New config option: "transposerFluidTransferRate". (repo-alt)
23-
* Changed: New limitFlightHeight configuration definition.
24-
* This allows values above 256 to be used, which may be useful for Cubic Chunks users.
25-
* Changed: Replaced the forceNativeLibWithName config option with two new ones: forceNativeLibPlatform and forceNativeLibPathFirst. (TheCodex6824)
26-
* forceNativeLibPlatform allows overriding the normally auto-detected platform string to a custom value, in case the user is on an unsupported platform.
27-
* forceNativeLibPathFirst allows choosing a directory to check for natives in, instead of always searching in the jar for one. This allows custom natives to be used without packing them into the mod jar first, which should be much easier for end users.
28-
* Changed: The game now crashes instead of reloading defaults if a config file is present but invalid.
29-
* Fixed: [#3588] Renaming over other files does not properly free space.
30-
* Fixed: [#3591] Memory leak with wrapped worlds from other mods.
31-
* Fixed: [#3596] Freeze when connecting a ComputerCraft peripheral via an Adapter (Kosmos-Prime)
32-
* Fixed: [#3603] computer.getDeviceInfo doesn't pause the computer immediately (AR2000AR)
33-
* Fixed: [#3609] Swapped arguments in a graphics card "bitblt()" edge case. (Kosmos-Prime)
34-
* Removed: Native Lua library support for x86 (32-bit) macOS.
35-
* (1.7.10) Fixed: [#3239] Inconsistencies in Robot block clicking.
36-
373
## OpenOS fixes/improvements
384

39-
* Fixed: [#3558] Invalid file modification timestamps in /bin/ls.
5+
* Fixed OpenOS version number.
406

417
## List of contributors
428

43-
AR2000AR, asie, hohserg1, Kosmos-Prime, payonel, repo-alt, Smok1e, TheCodex6824
9+
asie

src/main/resources/application.conf

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -961,14 +961,6 @@ opencomputers {
961961
# Whether to allow adding custom headers to HTTP requests.
962962
enableHttpHeaders: true
963963

964-
# This is a list of allowed HTTP methods. If empty, any HTTP method
965-
# can be used.
966-
enableHttpMethods: []
967-
968-
# This is a number describing how many HTTP redirects are allowed
969-
# while processing an HTTP request call. If 0, no redirects are allowed.
970-
enableHttpRedirects: 50
971-
972964
# Whether to allow TCP connections via internet cards. When enabled,
973965
# the `connect` method on internet card components becomes available.
974966
enableTcp: true

src/main/resources/assets/opencomputers/loot/openos/lib/core/boot.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-- called from /init.lua
22
local raw_loadfile = ...
33

4-
_G._OSVERSION = "OpenOS 1.8.0-snapshot"
4+
_G._OSVERSION = "OpenOS 1.8.1"
55

66
-- luacheck: globals component computer unicode _OSVERSION
77
local component = component

src/main/scala/li/cil/oc/Settings.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,6 @@ class Settings(val config: Config) {
302302
// internet
303303
val httpEnabled = config.getBoolean("internet.enableHttp")
304304
val httpHeadersEnabled = config.getBoolean("internet.enableHttpHeaders")
305-
val httpMethodsEnabled = config.getStringList("internet.enableHttpMethods")
306-
val httpRedirectsEnabled = config.getInt("internet.enableHttpRedirects") max -1
307305
val tcpEnabled = config.getBoolean("internet.enableTcp")
308306
val httpHostBlacklist = Array(config.getStringList("internet.blacklist").map(new Settings.AddressValidator(_)): _*)
309307
val httpHostWhitelist = Array(config.getStringList("internet.whitelist").map(new Settings.AddressValidator(_)): _*)

src/main/scala/li/cil/oc/server/component/InternetCard.scala

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ import java.nio.channels.SelectionKey
1111
import java.nio.channels.Selector
1212
import java.nio.channels.SocketChannel
1313
import java.util
14-
import java.util.{Locale, UUID}
14+
import java.util.UUID
1515
import java.util.concurrent._
16+
1617
import li.cil.oc.Constants
1718
import li.cil.oc.OpenComputers
1819
import li.cil.oc.Settings
@@ -31,12 +32,6 @@ import li.cil.oc.api.prefab.AbstractManagedEnvironment
3132
import li.cil.oc.api.prefab.AbstractValue
3233
import li.cil.oc.util.ThreadPoolFactory
3334
import net.minecraft.server.MinecraftServer
34-
import net.minecraftforge.fml.common.FMLCommonHandler
35-
import org.apache.http.HttpHost
36-
import org.apache.http.client.config.RequestConfig
37-
import org.apache.http.client.methods.RequestBuilder
38-
import org.apache.http.entity.StringEntity
39-
import org.apache.http.impl.client.HttpClients
4035

4136
import scala.collection.convert.WrapAsJava._
4237
import scala.collection.convert.WrapAsScala._
@@ -478,50 +473,34 @@ object InternetCard {
478473
private class RequestSender(val url: URL, val post: Option[String], val headers: Map[String, String], val method: Option[String]) extends Callable[InputStream] {
479474
override def call() = try {
480475
checkLists(InetAddress.getByName(url.getHost), url.getHost)
481-
val proxy = FMLCommonHandler.instance.getMinecraftServerInstance.getServerProxy
482-
483-
val methodStr = if (method.isDefined) method.get.toUpperCase(Locale.ROOT) else if (post.isDefined) "POST" else "GET"
484-
if (Settings.get.httpMethodsEnabled.nonEmpty && !Settings.get.httpMethodsEnabled.contains(methodStr)) {
485-
throw new IOException("method not allowed: " + methodStr)
486-
}
487-
488-
val requestBuilder = RequestBuilder.create(methodStr)
489-
headers.foreach(Function.tupled(requestBuilder.addHeader))
490-
requestBuilder.setUri(url.toURI)
491-
492-
val httpRequestConfig = RequestConfig.custom()
493-
.setConnectTimeout(Settings.get.httpTimeout)
494-
.setConnectionRequestTimeout(Settings.get.httpTimeout)
495-
.setSocketTimeout(Settings.get.httpTimeout)
496-
497-
val maxRedirects = Settings.get.httpRedirectsEnabled
498-
if (maxRedirects > 0) {
499-
httpRequestConfig.setMaxRedirects(maxRedirects)
500-
} else if (maxRedirects == 0) {
501-
httpRequestConfig
502-
.setRedirectsEnabled(false)
503-
.setRelativeRedirectsAllowed(false)
504-
}
505-
506-
if (proxy != null && proxy != Proxy.NO_PROXY) proxy.address() match {
507-
case inetProxyAddress: InetSocketAddress => httpRequestConfig.setProxy(new HttpHost(inetProxyAddress.getAddress, inetProxyAddress.getPort))
508-
}
509-
510-
val clientBuilder = HttpClients.custom()
511-
clientBuilder.setDefaultRequestConfig(httpRequestConfig.build())
512-
513-
if (post.isDefined) {
514-
requestBuilder.setEntity(new StringEntity(post.get))
515-
}
516-
517-
val r = clientBuilder.build().execute(requestBuilder.build())
476+
val proxy = Option(FMLCommonHandler.instance.getMinecraftServerInstance.getServerProxy).getOrElse(java.net.Proxy.NO_PROXY)
477+
url.openConnection(proxy) match {
478+
case http: HttpURLConnection => try {
479+
http.setDoInput(true)
480+
http.setDoOutput(post.isDefined)
481+
http.setRequestMethod(if (method.isDefined) method.get else if (post.isDefined) "POST" else "GET")
482+
headers.foreach(Function.tupled(http.setRequestProperty))
483+
if (post.isDefined) {
484+
http.setReadTimeout(Settings.get.httpTimeout)
485+
486+
val out = new BufferedWriter(new OutputStreamWriter(http.getOutputStream))
487+
out.write(post.get)
488+
out.close()
489+
}
518490

519-
val input = r.getEntity.getContent
520-
HTTPRequest.this.synchronized {
521-
import collection.JavaConverters._
522-
response = Some((r.getStatusLine.getStatusCode, r.getStatusLine.getReasonPhrase, r.getAllHeaders.groupBy(h => h.getName).map(i => i._1 -> i._2.toList.asJava).asJava))
491+
val input = http.getInputStream
492+
HTTPRequest.this.synchronized {
493+
response = Some((http.getResponseCode, http.getResponseMessage, http.getHeaderFields))
494+
}
495+
input
496+
}
497+
catch {
498+
case t: Throwable =>
499+
http.disconnect()
500+
throw t
501+
}
502+
case other => throw new IOException("unexpected connection type")
523503
}
524-
input
525504
}
526505
catch {
527506
case e: UnknownHostException =>

0 commit comments

Comments
 (0)