2018-05-24 17:50:05 +00:00
|
|
|
/* myMPD
|
|
|
|
(c) 2018 Juergen Mang <mail@jcgames.de>
|
|
|
|
This project's homepage is: https://github.com/jcorporation/ympd
|
|
|
|
|
|
|
|
myMPD ist fork of:
|
|
|
|
|
|
|
|
ympd
|
2014-02-22 00:57:26 +00:00
|
|
|
(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
|
2014-02-22 00:57:26 +00:00
|
|
|
|
|
|
|
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
|
|
|
*/
|
|
|
|
|
2013-11-05 13:59:12 +00:00
|
|
|
#include <string.h>
|
2013-12-03 20:48:49 +00:00
|
|
|
|
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);
|
|
|
|
|
2014-10-19 17:52:23 +00:00
|
|
|
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");
|
2014-10-19 17:52:23 +00:00
|
|
|
return MG_TRUE;
|
2013-11-04 17:18:38 +00:00
|
|
|
}
|