diff --git a/assets/disk0/nettest.js b/assets/disk0/nettest.js index 0195f77..8f8ea83 100644 --- a/assets/disk0/nettest.js +++ b/assets/disk0/nettest.js @@ -1,4 +1,4 @@ -let url="http://localhost/testnet/test.txt" +let url="http:localhost/testnet/test.txt" let file = files.open("B:\\"+url) diff --git a/tsvm_core/src/net/torvald/tsvm/peripheral/HttpModem.kt b/tsvm_core/src/net/torvald/tsvm/peripheral/HttpModem.kt index 7afc396..8906bef 100644 --- a/tsvm_core/src/net/torvald/tsvm/peripheral/HttpModem.kt +++ b/tsvm_core/src/net/torvald/tsvm/peripheral/HttpModem.kt @@ -11,6 +11,10 @@ import java.net.URL /** + * To get a text from the web address, send message: `GET https:en.wikipedia.org/wiki/Http` + * + * Note that there is no double-slash after the protocol (or scheme) + * * Created by minjaesong on 2022-09-22. */ class HttpModem(private val vm: VM) : BlockTransferInterface(false, true) { @@ -115,6 +119,8 @@ class HttpModem(private val vm: VM) : BlockTransferInterface(false, true) { printdbg("msg: $inputString, lastIndex: ${inputString.lastIndex}") cnxUrl = inputString.substring(4).filter { it in '!'..'~' } + val protocolSep = cnxUrl!!.indexOf(':') + cnxUrl = cnxUrl!!.substring(0, protocolSep) + "://" + cnxUrl!!.substring(protocolSep + 1) printdbg("URL: $cnxUrl")