Skip to content

Commit 3a5f7ba

Browse files
committed
added handling for http 414 error
1 parent d7248a7 commit 3a5f7ba

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

‎v3/js/opt-frontend-common.js‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,10 +851,28 @@ function genericOptFrontendReady() {
851851
return; // get out early
852852
}
853853

854-
setFronendError(["Server error! Your code might be taking too much time to run or using too much memory.",
855-
"Also, this tool does not work on raw_input(), input() and bytearray() in some cases.",
856-
"Report a bug to philip@pgbovine.net by clicking the 'Generate permanent link' button",
857-
"at the bottom of this page and including a URL in your email."]);
854+
/*
855+
This jqxhr.responseText might be indicative of the URL being too
856+
long, since the error message returned by the server is something
857+
like this in nginx:
858+
859+
<html>
860+
<head><title>414 Request-URI Too Large</title></head>
861+
<body bgcolor="white">
862+
<center><h1>414 Request-URI Too Large</h1></center>
863+
<hr><center>nginx</center>
864+
</body>
865+
</html>
866+
867+
Note that you'll probably need to customize this check for your server. */
868+
if (jqxhr && jqxhr.responseText.indexOf('414') >= 0) {
869+
setFronendError(["Server error! Your code might be too long for this tool. Shorten your code and re-try."]);
870+
} else {
871+
setFronendError(["Server error! Your code might be taking too much time to run or using too much memory.",
872+
"Also, this tool does not work on raw_input(), input() and bytearray() in some cases.",
873+
"Report a bug to philip@pgbovine.net by clicking the 'Generate permanent link' button",
874+
"at the bottom of this page and including a URL in your email."]);
875+
}
858876

859877
doneExecutingCode();
860878
});

0 commit comments

Comments
 (0)