allow header: X-Json=yes

Version 1.55.0


There are cases where DA does not yet have the request parsed yet, but it needs to abort. The usual case would be a timeout, for example, during a very large file upload. In these cases, DA has not yet parsed the GET/POST body data yet, thus has no idea if the script wanted json=yes being set. This optional value lets you get a more reliable output, by allowing the new header: X-Json: yes to be added to the request, as the headers are parsed first. ---- Other cases are currently if the IP is blacklisted and this header is set, it will now return a dynamic style output with error=1. With the header set, the optional template: /usr/local/directadmin/data/templates/blacklisted_ip.html will NOT be used, since the output shouldn't be html. ---- If other scenarios are found that are not generating json when the header is set, let us know and we can include them into the correct output handling. ====== Extra headers: In addition, if a timeout occurs, a header will be added: X-DirectAdmin: timeout or if a segfault occurs: X-DirectAdmin: segfault Sample timeout response from: CMD_FILE_MANAGER?json=yes Connection: close Content-Type: application/json; charset=utf-8 Server: DirectAdmin Daemon v1.54.1 Registered to Set-Cookie: session=gf60qSva6eVnKmEsGfChUcKtEsTa28lQoOUmEwip1KIme40UIdesRBEpLCvLJej72; path=/; expires=Fri, 21 Sep 2018 21:38:56 GMT; HttpOnly X-DirectAdmin: timeout { "error": "Your connection has timed out", "extended": "true", "result": "Consider disabling the <a href=''>Folder Usage Count</a>." }

Interested to try DirectAdmin? Get a 30-day Free Trial!