summaryrefslogtreecommitdiff
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-03-03 16:41:20 -0500
committerGravatar Adam Chlipala <adam@chlipala.net>2012-03-03 16:41:20 -0500
commit2a42899039b15444e8445300c8562e8934e8876a (patch)
treee4a0eb42be56f403faac02622cde27ac61e323c5 /lib/js/urweb.js
parent53e8eba14aba951cef1e1a1428612a31d88ec0a7 (diff)
Avoid URL size limit in RPCs with large arguments
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r--lib/js/urweb.js15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index a5ab90c5..e6c2124f 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1137,10 +1137,17 @@ function unload() {
}
}
-function requestUri(xhr, uri, needsSig) {
+function requestUri(xhr, uri, needsSig, isRpc) {
if (unloading)
return;
+ var extraData = null;
+
+ if (isRpc && uri.length > 2000) {
+ extraData = uri.substring(2000);
+ uri = uri.substring(0, 2000);
+ }
+
xhr.open("POST", uri, true);
xhr.setRequestHeader("Content-type", "text/plain");
try {
@@ -1161,7 +1168,7 @@ function requestUri(xhr, uri, needsSig) {
}
inFlight = cons(xhr, inFlight);
- xhr.send(null);
+ xhr.send(extraData);
}
function xhrFinished(xhr) {
@@ -1211,7 +1218,7 @@ function rc(prefix, uri, parse, k, needsSig) {
}
};
- requestUri(xhr, uri, needsSig);
+ requestUri(xhr, uri, needsSig, true);
}
function path_join(s1, s2) {
@@ -1260,7 +1267,7 @@ function listener() {
var connect = function () {
xhr.onreadystatechange = orsc;
tid = window.setTimeout(onTimeout, timeout * 500);
- requestUri(xhr, uri, false);
+ requestUri(xhr, uri, false, false);
}
orsc = function() {