diff options
author | Javier Sánchez Parra <jsanchez@soleta.eu> | 2019-07-09 13:26:20 +0200 |
---|---|---|
committer | OpenGnSys Support Team <soporte-og@soleta.eu> | 2019-07-15 09:51:53 +0200 |
commit | 66001f0a6c59079de0e43d3118dbe36140b21fcf (patch) | |
tree | e1a8be4c11de13a6bf8bac5a69a5a0266c6b6634 /sources | |
parent | 9c7954b4ccf6799f50bffd2dea41c4c9476921f4 (diff) |
#915 returns 401 when incorrect authentication happens
ogAdmServer REST API now meets the starndar RFC 7235 when incorrect auth
happens.
og_client_not_authorized() now sends "401 Unauthorized" and
"WWW-Authenticate" instead of 404.
Diffstat (limited to 'sources')
-rw-r--r-- | sources/ogAdmServer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/sources/ogAdmServer.cpp b/sources/ogAdmServer.cpp index 1a55554..91765af 100644 --- a/sources/ogAdmServer.cpp +++ b/sources/ogAdmServer.cpp @@ -3929,7 +3929,9 @@ static int og_client_not_found(struct og_client *cli) static int og_client_not_authorized(struct og_client *cli) { - char buf[] = "HTTP/1.1 404 Unauthorized\r\nContent-Length: 0\r\n\r\n"; + char buf[] = "HTTP/1.1 401 Unauthorized\r\n" + "WWW-Authenticate: Basic\r\n" + "Content-Length: 0\r\n\r\n"; send(og_client_socket(cli), buf, strlen(buf), 0); |