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 | f06fcf6fc08d5b8d1f01d63ba2a034376f829038 (patch) | |
tree | 33c6726bb2f0bc2975f544619dd2fc1599a153c5 | |
parent | 4f39a9995655d67b7e39d02af9758ee15b39c256 (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.
-rw-r--r-- | admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp b/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp index 1a555545..91765af4 100644 --- a/admin/Sources/Services/ogAdmServer/sources/ogAdmServer.cpp +++ b/admin/Sources/Services/ogAdmServer/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); |