Change default Accept to */* to conform to RFC 9112

This commit is contained in:
2024-01-25 22:54:20 -06:00
parent dce50642a0
commit 47f09c3ce2

View File

@@ -342,7 +342,7 @@ static int sendCertainResponse(Connection *conn, Sitefile *site, int index) {
int sendResponse(Connection *conn, Sitefile *site) { int sendResponse(Connection *conn, Sitefile *site) {
char *host = NULL; char *host = NULL;
char *accept = NULL; char *accept = "*/*";
int i; int i;
for (i = 0; i < conn->fieldCount; i++) { for (i = 0; i < conn->fieldCount; i++) {
if (strcmp(conn->fields[i].field, "Host") == 0) if (strcmp(conn->fields[i].field, "Host") == 0)
@@ -350,7 +350,7 @@ int sendResponse(Connection *conn, Sitefile *site) {
else if (strcmp(conn->fields[i].field, "Accept") == 0) else if (strcmp(conn->fields[i].field, "Accept") == 0)
accept = conn->fields[i].value; accept = conn->fields[i].value;
} }
if (host == NULL || accept == NULL) { if (host == NULL) {
sendErrorResponse(conn->stream, ERROR_400); sendErrorResponse(conn->stream, ERROR_400);
return 1; return 1;
} }