--- a/src/Pure/General/http.scala Thu Dec 21 17:28:39 2017 +0100
+++ b/src/Pure/General/http.scala Thu Dec 21 21:44:09 2017 +0100
@@ -7,7 +7,7 @@
package isabelle
-import java.net.{InetAddress, InetSocketAddress, URI, URLDecoder}
+import java.net.{InetAddress, InetSocketAddress, URI}
import com.sun.net.httpserver.{HttpExchange, HttpHandler, HttpServer}
import scala.collection.immutable.SortedMap
@@ -74,9 +74,7 @@
def decode_properties: Properties.T =
space_explode('&', request.text).map(s =>
space_explode('=', s) match {
- case List(a, b) =>
- URLDecoder.decode(a, UTF8.charset_name) ->
- URLDecoder.decode(b, UTF8.charset_name)
+ case List(a, b) => Url.decode(a) -> Url.decode(b)
case _ => error("Malformed key-value pair in HTTP/POST: " + quote(s))
})
}
--- a/src/Pure/General/url.scala Thu Dec 21 17:28:39 2017 +0100
+++ b/src/Pure/General/url.scala Thu Dec 21 21:44:09 2017 +0100
@@ -9,8 +9,7 @@
import java.io.{File => JFile}
import java.nio.file.{Paths, FileSystemNotFoundException}
-import java.net.{URI, URISyntaxException}
-import java.net.{URL, MalformedURLException}
+import java.net.{URI, URISyntaxException, URL, MalformedURLException, URLDecoder, URLEncoder}
import java.util.zip.GZIPInputStream
@@ -34,6 +33,12 @@
catch { case ERROR(_) => false }
+ /* strings */
+
+ def decode(s: String): String = URLDecoder.decode(s, UTF8.charset_name)
+ def encode(s: String): String = URLEncoder.encode(s, UTF8.charset_name)
+
+
/* read */
private def read(url: URL, gzip: Boolean): String =