changing the acceptable url format for the http modem to drop the double slashes after the 'http' or somethingas the they get replaced into single one on command.js but not on the user program, producing discrepancy

This commit is contained in:
minjaesong
2022-09-22 18:19:53 +09:00
parent e905b3ace8
commit 2dc6f581cc
2 changed files with 7 additions and 1 deletions

View File

@@ -1,4 +1,4 @@
let url="http://localhost/testnet/test.txt"
let url="http:localhost/testnet/test.txt"
let file = files.open("B:\\"+url)

View File

@@ -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")