diff --git a/README b/README index 2c0c3a2ef..7bd2b7a10 100644 --- a/README +++ b/README @@ -26,6 +26,8 @@ To start it, go to http://localhost:7657/configwebapps and start the and click "Save WebApp Configuration". You MUST change itoopie's "I2P Node port" to 7657 to connect to the jsonrpc webapp. itoopie will automatically use http for port 7657. +If the console is on another port, it is assumed to be HTTPS, and you +must add "server.target=jsonrpc/" to the config file ~/.itoopie/itoopie.conf Version 1 API specification: diff --git a/src/net/i2p/itoopie/i2pcontrol/JSONRPC2Interface.java b/src/net/i2p/itoopie/i2pcontrol/JSONRPC2Interface.java index a5a7b4530..4571b9377 100644 --- a/src/net/i2p/itoopie/i2pcontrol/JSONRPC2Interface.java +++ b/src/net/i2p/itoopie/i2pcontrol/JSONRPC2Interface.java @@ -47,8 +47,18 @@ public class JSONRPC2Interface { String srvHost = _conf.getConf("server.hostname", "localhost"); int srvPort = _conf.getConf("server.port", 7650); String srvTarget = _conf.getConf("server.target", "jsonrpc"); - // Use HTTP for the xmlrpc webapp in the HTTP router console - String method = srvPort == 7657 ? "http" : "https"; + String method; + if (srvPort == 7657) { + // Use HTTP for the xmlrpc webapp in the HTTP router console + method = "http"; + // target MUST contain a /, or else console will redirect + // jsonrpc to jsonrpc/ which will be fetched as a GET + // and will return the HTML password form. + if (!srvTarget.contains("/")) + srvTarget += "/"; + } else { + method = "https"; + } try { srvURL = new URL(method + "://" + srvHost + ":" + srvPort + "/" + srvTarget);