HttpServer audio and thumbnail lookups explicitly only support GET -- I

think we were doing some unnecessary process with HEAD (and potentially
OPTIONS) requests.
This commit is contained in:
casey langen 2017-11-12 20:48:15 -08:00
parent 2f7fa348bf
commit 41f1020ac9

View File

@ -318,10 +318,11 @@ int HttpServer::HandleRequest(
int status = MHD_HTTP_NOT_FOUND; int status = MHD_HTTP_NOT_FOUND;
try { try {
if (method && std::string(method) == "GET") {
if (!isAuthenticated(connection, server->context)) { if (!isAuthenticated(connection, server->context)) {
status = 401; /* unauthorized */ status = 401; /* unauthorized */
static const char* error = "unauthorized"; static const char* error = "unauthorized";
response = MHD_create_response_from_buffer(strlen(error), (void*) error, MHD_RESPMEM_PERSISTENT); response = MHD_create_response_from_buffer(strlen(error), (void*)error, MHD_RESPMEM_PERSISTENT);
#ifdef ENABLE_DEBUG #ifdef ENABLE_DEBUG
std::cerr << "unauthorized\n"; std::cerr << "unauthorized\n";
@ -349,6 +350,7 @@ int HttpServer::HandleRequest(
} }
} }
} }
}
catch (...) { catch (...) {
} }