1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-17 03:04:47 +00:00
ympd/src/http_server.c

50 lines
1.4 KiB
C
Raw Normal View History

/* myMPD
(c) 2018 Juergen Mang <mail@jcgames.de>
This project's homepage is: https://github.com/jcorporation/ympd
myMPD ist fork of:
ympd
(c) 2013-2014 Andrew Karpow <andy@ndyk.de>
2014-01-17 18:41:41 +00:00
This project's homepage is: http://www.ympd.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
2014-01-17 18:41:41 +00:00
*/
#include <string.h>
2013-11-04 17:18:38 +00:00
#include "http_server.h"
2014-02-16 18:46:53 +00:00
int callback_http(struct mg_connection *c)
2013-11-04 17:18:38 +00:00
{
2014-02-16 18:46:53 +00:00
const struct embedded_file *req_file;
if(!strcmp(c->uri, "/"))
req_file = find_embedded_file("/index.html");
else
req_file = find_embedded_file(c->uri);
if(req_file)
{
mg_send_header(c, "Content-Type", req_file->mimetype);
mg_send_data(c, req_file->data, req_file->size);
return MG_TRUE;
2013-11-09 01:07:03 +00:00
}
2013-11-04 17:18:38 +00:00
2014-02-16 18:46:53 +00:00
mg_send_status(c, 404);
mg_printf_data(c, "Not Found");
return MG_TRUE;
2013-11-04 17:18:38 +00:00
}