#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.
master
Javier Sánchez Parra 2019-07-09 13:26:20 +02:00 committed by OpenGnSys Support Team
parent 9c7954b4cc
commit 66001f0a6c
1 changed files with 3 additions and 1 deletions

View File

@ -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);