diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-11 23:57:12 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2016-03-11 23:57:12 -0500 |
commit | a12ec8aa4aa65cc74b2f5945fc76b181cf6fddb8 (patch) | |
tree | cc056591e0262c66c86b0b6398cb042c9e41714d /freenect-server--http.c | |
parent | 4ddf5700fb13cca9ef8fec0bd44d6ef769b37216 (diff) |
more fixing
Diffstat (limited to 'freenect-server--http.c')
-rw-r--r-- | freenect-server--http.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/freenect-server--http.c b/freenect-server--http.c index d966e3b..e1b91f0 100644 --- a/freenect-server--http.c +++ b/freenect-server--http.c @@ -28,6 +28,7 @@ struct reader_thread_args { void *reader_thread(void *args_anon) { struct reader_thread_args *args = args_anon; mpjpeg_reader(args->stream, args->fd, args->boundary); + error(EXIT_FAILURE, 0, "mpjpeg stream ended"); return NULL; } @@ -46,8 +47,12 @@ void file_add(const char *filename) { int fd = open(filename, O_RDONLY); if (fd < 0) error(EXIT_FAILURE, errno, "opening file: %s", filename); - filev = xrealloc(NULL, (++filec)*sizeof(*filev)); - strncpy(filev[filec-1].name, filename, sizeof(filev[filec-1].name)); + filev = xrealloc(filev, (++filec)*sizeof(*filev)); + const char *shortname = strrchr(filename, '/'); + if (shortname == NULL) + shortname = filename; + strncpy(filev[filec-1].name, shortname, sizeof(filev[filec-1].name)); + error(0, 0, "added file #%zd: %s", filec-1, filev[filec-1].name); filev[filec-1].stream = stream; start_mpjpeg_reader(stream, fd, "ffserver" /* FIXME */); } @@ -119,6 +124,7 @@ void connection_handler(int fd) { struct mpjpeg_stream *vidstream = file_get(path); if (vidstream == NULL) { + error(0, 0, "404 %s", path); dprintf(fd, "HTTP/1.1 404 Not Found\r\n" "\r\n"); @@ -126,6 +132,7 @@ void connection_handler(int fd) { } const char *boundary = "boundary" /* FIXME */; + error(0, 0, "200 %s", path); dprintf(fd, "HTTP/1.1 200 OK\r\n" "Content-Type: multipart/x-mixed-replace;boundary=%s\r\n" |