|
|
|
@ -50,6 +50,7 @@ static bool send_hget_and_http_resp(struct http_request* req, const char* id, bo
|
|
|
|
|
error = "404: album not found";
|
|
|
|
|
}
|
|
|
|
|
std::string error_page = build_error_page(error);
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 404, error_page.c_str(), error_page.length());
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
@ -91,6 +92,7 @@ static int album_or_image_start(struct http_request* req) {
|
|
|
|
|
http_state_cleanup(req);
|
|
|
|
|
kore_log(LOG_ERR, "failed to initialize curl client");
|
|
|
|
|
std::string error_page = build_error_page("Failed to initialize curl client");
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 500, error_page.c_str(), error_page.length());
|
|
|
|
|
return HTTP_STATE_COMPLETE;
|
|
|
|
|
}
|
|
|
|
@ -139,6 +141,7 @@ static int album_or_image_end(struct http_request* req) {
|
|
|
|
|
kore_curl_cleanup(client);
|
|
|
|
|
http_state_cleanup(req);
|
|
|
|
|
std::string error_page = build_error_page(error.c_str());
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 500, error_page.c_str(), error_page.length());
|
|
|
|
|
return HTTP_STATE_COMPLETE;
|
|
|
|
|
}
|
|
|
|
@ -153,6 +156,7 @@ static int album_or_image_end(struct http_request* req) {
|
|
|
|
|
kore_curl_cleanup(client);
|
|
|
|
|
http_state_cleanup(req);
|
|
|
|
|
std::string error_page = build_error_page(error.c_str());
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 500, error_page.c_str(), error_page.length());
|
|
|
|
|
return HTTP_STATE_COMPLETE;
|
|
|
|
|
}
|
|
|
|
@ -174,6 +178,7 @@ static int album_or_image_end(struct http_request* req) {
|
|
|
|
|
send_hset(id, is_album, "");
|
|
|
|
|
}
|
|
|
|
|
std::string error_page = build_error_page(error.c_str());
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 404, error_page.c_str(), error_page.length());
|
|
|
|
|
return HTTP_STATE_COMPLETE;
|
|
|
|
|
}
|
|
|
|
@ -208,6 +213,7 @@ static int album_or_image_end(struct http_request* req) {
|
|
|
|
|
kore_curl_cleanup(client);
|
|
|
|
|
http_state_cleanup(req);
|
|
|
|
|
std::string error_page = build_error_page(error.c_str(), true);
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 500, error_page.c_str(), error_page.length());
|
|
|
|
|
return HTTP_STATE_COMPLETE;
|
|
|
|
|
}
|
|
|
|
@ -219,6 +225,7 @@ static int album_or_image_end(struct http_request* req) {
|
|
|
|
|
if (error) {
|
|
|
|
|
kore_log(LOG_ERR, "%s", (*error).c_str());
|
|
|
|
|
std::string error_page = build_error_page((*error).c_str());
|
|
|
|
|
http_response_header(req, "Content-Type", "text/html");
|
|
|
|
|
http_response(req, 500, error_page.c_str(), error_page.length());
|
|
|
|
|
return HTTP_STATE_COMPLETE;
|
|
|
|
|
}
|
|
|
|
|