mirror of
https://github.com/emikulic/darkhttpd.git
synced 2023-08-10 21:13:08 +03:00
Don't send extra blank line when --auth is disabled.
This commit is contained in:
parent
598a47fe9d
commit
e9c474dfac
@ -1495,8 +1495,8 @@ static void default_reply(struct connection *conn,
|
|||||||
errcode, errname, errname, reason, generated_on(date));
|
errcode, errname, errname, reason, generated_on(date));
|
||||||
free(reason);
|
free(reason);
|
||||||
|
|
||||||
const char *auth_header =
|
const char auth_header[] =
|
||||||
"WWW-Authenticate: Basic realm=\"User Visible Realm\"";
|
"WWW-Authenticate: Basic realm=\"User Visible Realm\"\r\n";
|
||||||
|
|
||||||
conn->header_length = xasprintf(&(conn->header),
|
conn->header_length = xasprintf(&(conn->header),
|
||||||
"HTTP/1.1 %d %s\r\n"
|
"HTTP/1.1 %d %s\r\n"
|
||||||
@ -1506,7 +1506,7 @@ static void default_reply(struct connection *conn,
|
|||||||
"%s" /* keep-alive */
|
"%s" /* keep-alive */
|
||||||
"Content-Length: %llu\r\n"
|
"Content-Length: %llu\r\n"
|
||||||
"Content-Type: text/html; charset=UTF-8\r\n"
|
"Content-Type: text/html; charset=UTF-8\r\n"
|
||||||
"%s\r\n"
|
"%s"
|
||||||
"\r\n",
|
"\r\n",
|
||||||
errcode, errname, date, server_hdr, keep_alive(conn),
|
errcode, errname, date, server_hdr, keep_alive(conn),
|
||||||
llu(conn->reply_length),
|
llu(conn->reply_length),
|
||||||
@ -2149,7 +2149,7 @@ static void process_request(struct connection *conn) {
|
|||||||
default_reply(conn, 400, "Bad Request",
|
default_reply(conn, 400, "Bad Request",
|
||||||
"You sent a request that the server couldn't understand.");
|
"You sent a request that the server couldn't understand.");
|
||||||
}
|
}
|
||||||
// fail if: (auth_enabled) AND (client supplied invalid credentials)
|
/* fail if: (auth_enabled) AND (client supplied invalid credentials) */
|
||||||
if (auth_key != NULL &&
|
if (auth_key != NULL &&
|
||||||
(conn->authorization == NULL ||
|
(conn->authorization == NULL ||
|
||||||
strcmp(conn->authorization, auth_key)))
|
strcmp(conn->authorization, auth_key)))
|
||||||
|
Loading…
Reference in New Issue
Block a user