fix so we can properly add binary media

This commit is contained in:
Joris Vink 2013-06-24 18:29:40 +02:00
parent f48fe0a326
commit d2c4fde7fe
5 changed files with 19 additions and 3 deletions

View File

@ -10,7 +10,7 @@ MODULE=example.module
# The directory containing all your media files (HTML, CSS, ...).
# These files will be compiled into the module and symbols will
# be exported for you to use in your code (see static.h after building).
# be exported for you to use in your code.
MEDIA_DIR=media
# The directory containing your module source.
@ -69,3 +69,4 @@ echo "Building completed!"
rm -rf ${SOURCE_DIR}/${MEDIA_DIR}
rm -rf .objs
rm -f tools/inject
rm -f static.h

Binary file not shown.

After

Width:  |  Height:  |  Size: 818 KiB

View File

@ -20,7 +20,7 @@ workers 2
#onload myinit
# Specifies what module to be loaded.
load ./example.module
load modules/example/example.module
# Domain configuration
#
@ -46,6 +46,7 @@ domain 10.211.55.3 {
accesslog /var/log/kore_access.log
static /css/style.css serve_style_css
static / serve_index
static /intro.jpg serve_intro
}
#domain domain.com {

View File

@ -42,6 +42,7 @@
int serve_style_css(struct http_request *);
int serve_index(struct http_request *);
int serve_intro(struct http_request *);
int
serve_style_css(struct http_request *req)
@ -84,3 +85,15 @@ serve_index(struct http_request *req)
return (ret);
}
int
serve_intro(struct http_request *req)
{
int ret;
http_response_header_add(req, "content-type", "image/jpg");
ret = http_response(req, 200, static_jpg_intro,
static_len_jpg_intro);
return (ret);
}

View File

@ -32,7 +32,8 @@ main(int argc, char *argv[])
struct stat st;
ssize_t len;
FILE *hdr;
char *ext, c[1];
char *ext;
unsigned char c[1];
int fd, newline, count;
if (argc != 3)