Commit Graph

66 Commits

Author SHA1 Message Date
ejurgensen
687f349927 Let configure check libevent version and include according to version 2014-03-13 23:33:35 +01:00
ejurgensen
7ed6cc98c3 Add support for Spotify (squashed commit), and:
- Try to not return items which a client can't play
    - Remove inotify subscription to IN_MODIFY and IN_CREATE
    - Fix crash on unknown codec type in transcode.c
    - Probably added some new bugs...
2014-03-11 23:20:29 +01:00
ejurgensen
3c941ca0e1 iTunes will drop the connection if user seeks during playback, but
no reason to log that on default log level
2014-02-03 23:12:19 +01:00
ejurgensen
3064509f62 HTTP Range header may be in the form 'bytes=12345-' (no end offset) 2014-02-03 22:02:20 +01:00
Julien BLACHE
49a9ff64dc Use st->size instead of sb.st_size which is only valid for raw files 2011-04-24 19:03:47 +02:00
Julien BLACHE
69fe64c277 Honour IPv6 config option for HTTP services 2011-03-20 12:19:39 +01:00
Julien BLACHE
0cb62fdabf Bind IPv4 server first, to avoid v4compat 2010-09-10 18:47:43 +02:00
Julien BLACHE
e9b8fd8bd7 Check for both ip6-localhost and localhost 2010-09-10 18:47:42 +02:00
Julien BLACHE
053b8df4ba Factor out common code to increase playcount while streaming 2010-09-10 18:47:42 +02:00
Julien BLACHE
b0a8e879e4 Remove useless check 2010-09-10 18:47:42 +02:00
Julien BLACHE
71bf8390b0 Constify http_reply_401 2010-09-10 18:47:42 +02:00
Julien BLACHE
81d09ed234 Account for new evhttp behaviour on failed incoming connections
The evcon associated with a request is freed by evhttp when the connection
fails. Protect against a NULL evcon when handling the connection failure.
2010-07-23 18:28:29 +02:00
Julien BLACHE
588b328b45 IPv4 binding failure is fatal in all cases
IPv4 and IPv6 are bound separately; IPv6 may fail if unsupported, IPv4
must always succeed.
2010-05-14 17:36:58 +02:00
Julien BLACHE
13c9de3ed1 Introduce httpd_send_reply() with gzip capability 2010-05-03 19:11:55 +02:00
Julien BLACHE
8427707afc Create evbase_httpd before protocol handlers init
DACP needs the httpd event base at init time.
2010-05-02 11:44:43 +02:00
Julien BLACHE
9fb7ec8e5c Make the WAV header optional 2010-05-02 11:21:08 +02:00
Julien BLACHE
b7ec65963d Constify data tables where possible 2010-03-25 21:40:17 +01:00
Julien BLACHE
19b6780a3c Remove provisions for multi-library support
It is now clear that multi-library support will not happen, so remove whatever
provisions were in the code for that.

It comes with a small change to the configuration file, too.

With this, DB schema version went to 9.
2010-03-19 19:09:18 +01:00
Julien BLACHE
affbae1c47 Make evbase_httpd non-static
Make the httpd event base available to httpd protocol handlers.
2010-03-06 10:27:39 +01:00
Julien BLACHE
18abda3a97 Use evhttp_connection's closecb instead of our fail_cb extension
The closecb callback of evhttp_connection does what we need, so no need
to use that extension anymore.
2010-02-14 09:34:29 +01:00
Julien BLACHE
a5a46b8a53 Fix lseek() return value handling
lseek() returns an off_t and not an int, using an int to store and
test the return value means we'll error out when the position in the file
gets past INT_MAX.
2010-02-10 18:19:32 +01:00
Julien BLACHE
cb4320791b Use eventfd instead of pipes if available
eventfd has less overhead than a pipe, works as a counter and uses a
single fd. Use it on Linux if available (that should be pretty much
always given the glibc and kernel requirements).
2010-02-04 18:52:13 +01:00
Julien BLACHE
274dccf66c Reduce STREAM_CHUNK_SIZE to a more manageable 64k
512k might be a bit too much, as it can take time to read 512k from the
filesystem (and we're using a blocking read) or from the decoder. Going
down to 64k will make this more manageable and improve the response time
when streaming to multiple clients at the same time.
2010-02-02 21:09:56 +01:00
Julien BLACHE
848dd41993 serve_file() is broken due to evbuffer_read()
If we ever need to serve files for a web interface or otherwise, serve_file()
will need to be fixed to not use evbuffer_read().
2010-02-02 21:09:56 +01:00
Julien BLACHE
6e5f49bdf9 Use transcode variable to check for transcoding status 2010-02-02 21:09:56 +01:00
Julien BLACHE
825569dc88 Rework failure path in httpd_stream_file()
Kill code duplication, make it all clearer.
2010-02-02 21:09:56 +01:00
Julien BLACHE
f0239951e1 Replace evbuffer_read(); should not be applied to files
evbuffer_read() is really meant to read from sockets and not regular
files. It also looks like evbuffer_read() was causing issues with large
files, locking up a little below 2 GB for an unknown reason (couldn't
reproduce).
2010-02-02 21:09:56 +01:00
Julien BLACHE
58faeaceca Integer types cleanup
Try to be a bit more strict about integer types, use off_t or int64_t for
file size and file offsets.

Replace safe_ato*() by safe_atoi32() and safe_atoi64(), fix integer types
at call sites to match.
2010-02-02 21:09:56 +01:00
Julien BLACHE
1df7ec1b7c Use posix_fadvise() to hint the OS when streaming raw file
Hinting the OS about our behaviour shouldn't make a big difference in
performance but it will help the OS manage its disk cache and can reduce
memory pressure on small systems.
2010-02-02 21:09:55 +01:00
Julien BLACHE
8ac5f48fe6 Wire up DACP support 2010-01-30 17:30:22 +01:00
Julien BLACHE
2c6ceac486 Rework code flow in httpd_gen_cb() 2010-01-30 17:30:21 +01:00
Julien BLACHE
eae5370c08 Log HTTP (non-DAAP, non-RSP) requests 2010-01-26 18:15:08 +01:00
Julien BLACHE
8d7c566d95 Use m_realpath(path) instead of realpath(path, NULL) 2010-01-09 13:44:10 +01:00
Julien BLACHE
99df67b53c Include sys/param.h for PATH_MAX 2010-01-09 13:42:23 +01:00
Julien BLACHE
6c38cd2ef5 Add missing sys/types.h & sys/stat.h for stat & friends 2010-01-09 13:41:51 +01:00
Julien BLACHE
6033e29348 Use standard pipe() syscall on non-Linux platforms 2010-01-09 13:41:14 +01:00
Julien BLACHE
974a74a833 Update copyright notices for 2010 2010-01-05 19:34:00 +01:00
Julien BLACHE
8feeecd895 Send a Content-Length header when plainly streaming a whole file
That is, don't send a Content-Length if we're decoding a whole file,
as we do not know the exact size in this case.

Based on a patch by Ace Jones.
2009-12-31 16:50:19 +01:00
Ace Jones
040e760789 Add support for Remote, the iPhone remote control for iTunes
Remote needs the same DAAP query quirk as iTunes and supports the
same codecs.
2009-12-30 18:49:52 +01:00
Julien BLACHE
7cb0eec5d5 Don't increase play count if not streaming at least half of the file
When streaming AAC/MP4 files that aren't stream-optimized (metadata at the
end of the file), clients will seek through the file to grab the metadata
prior to playing the file, causing the play count to increase by 2 or 3.

To counter that, do not increase play count if not streaming at least half
of the file.
2009-12-26 09:57:37 +01:00
Julien BLACHE
72b1237500 Send a Content-Length header when streaming
Patch by Ace Jones <ace.jones1@yahoo.com>.
2009-12-08 21:46:47 +01:00
Julien BLACHE
ff89ce0183 Add support for end offset in Range header
Honor end offset provided in the Range header and do not stream more than
what the client asked for.

Based on a patch by Ace Jones <ace.jones1@yahoo.com>.
2009-12-08 21:42:48 +01:00
Julien BLACHE
b9e7df5be3 Return a proper Content-Type when streaming videos
Clients like Front Row expect video/<type> for video streaming, whereas iTunes
likes application/x-dmap-tagged when streaming audio.

Based on a patch by Ace Jones <ace.jones1@yahoo.com>.
2009-12-08 21:04:30 +01:00
Julien BLACHE
38c502cb7e Properly close the raw file that was streamed when cleaning up after streaming
Report & fix by Ace Jones <ace.jones1@yahoo.com>
2009-12-08 19:54:48 +01:00
Julien BLACHE
ab760903b1 Use stream_end() to do the cleanup in stream_fail_cb()
Introduce a new 'failed' parameter to stream_end() as some actions shouldn't
be done when cleaning up after a connection failure.
2009-12-08 19:52:51 +01:00
Julien BLACHE
1bd3b3a076 Fix paths and rename the project 2009-06-12 13:00:34 +02:00
Julien BLACHE
a200703393 Switch to the new database code 2009-06-10 19:04:18 +02:00
Julien BLACHE
d384f3c395 Rename E_INF to E_INFO 2009-05-09 17:14:07 +02:00
Julien BLACHE
11fd038d16 Use new logger facility 2009-05-09 17:14:06 +02:00
Julien BLACHE
10bb9dec57 Remove useless daapd.h 2009-05-05 16:22:11 +02:00