Missing headers for API response of "...does not exist in your authority level"

Version 1.514

Bugfix
Finished

Recent changes to the internal header code caused the scenario where you've run a wrong command which normally gives you this error: error=1&text=You cannot execute that command&details=The request you've made cannot be executed because it does not exist in your authority level to not generate HTTP response headers first, and also causing DA to continue to try and send a blank request, so you'd end up with 404 headers *after* the above code was sent. This bug would cause confusion in cases where a command is entered incorrectly, or the commands.allow/commands.deny isn't allowing it, since parsers cannot find the end of the headers, since the first output isn't "HTTP/1.1", but instead gave "error=1" which isn't valid to start a response. So browsers or API scripts would just give blank output, even though the above output was given, just without headers (plus a junk 404 at the end) It's possible there were other cases where no headers were generated first, but this fix simply confirms that they were, rather than assuming they were.

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