forked from I2P_Developers/i2p.i2p
i2ptunnel, eepget: Better error message on invalid URLs (ticket #2130)
This commit is contained in:
@ -501,8 +501,16 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
|
|||||||
if(_log.shouldLog(Log.WARN)) {
|
if(_log.shouldLog(Log.WARN)) {
|
||||||
_log.warn(getPrefix(requestId) + "Bad request [" + request + "]", use);
|
_log.warn(getPrefix(requestId) + "Bad request [" + request + "]", use);
|
||||||
}
|
}
|
||||||
|
// TODO fixup []| not escaped by browsers
|
||||||
try {
|
try {
|
||||||
out.write(getErrorPage("baduri", ERR_BAD_URI).getBytes("UTF-8"));
|
out.write(getErrorPage("baduri", ERR_BAD_URI).getBytes("UTF-8"));
|
||||||
|
String msg = use.getLocalizedMessage();
|
||||||
|
if (msg != null) {
|
||||||
|
out.write(DataHelper.getASCII("<p>\n"));
|
||||||
|
out.write(DataHelper.getUTF8(DataHelper.escapeHTML(msg)));
|
||||||
|
out.write(DataHelper.getASCII("</p>\n"));
|
||||||
|
}
|
||||||
|
out.write(DataHelper.getASCII("</div>\n"));
|
||||||
writeFooter(out);
|
writeFooter(out);
|
||||||
reader.drain();
|
reader.drain();
|
||||||
} catch (IOException ioe) {
|
} catch (IOException ioe) {
|
||||||
|
@ -327,6 +327,9 @@ public class EepGet {
|
|||||||
try {
|
try {
|
||||||
nameURL = new URI(url);
|
nameURL = new URI(url);
|
||||||
} catch (URISyntaxException e) {
|
} catch (URISyntaxException e) {
|
||||||
|
String msg = e.getLocalizedMessage();
|
||||||
|
if (msg != null)
|
||||||
|
System.err.println(msg);
|
||||||
System.err.println("Please enter a properly formed URL.");
|
System.err.println("Please enter a properly formed URL.");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
@ -21,4 +21,3 @@ Proxy-Connection: close
|
|||||||
_("The request URI is invalid, and probably contains illegal characters.")
|
_("The request URI is invalid, and probably contains illegal characters.")
|
||||||
_("If you clicked a link, check the end of the URI for any characters the browser has mistakenly added on.")
|
_("If you clicked a link, check the end of the URI for any characters the browser has mistakenly added on.")
|
||||||
</p>
|
</p>
|
||||||
</div>
|
|
||||||
|
Reference in New Issue
Block a user