ejurgensen
2ce1c8d28f
[httpd] Enable OPTIONS for evhttp (if CORS headers are enabled)
2016-10-19 21:22:14 +02:00
ejurgensen
54a09fce63
[httpd] Add requirement for Access-Control-Request-Method for preflight CORS
2016-10-19 17:29:22 +02:00
ejurgensen
57945a592c
[httpd] Reply to CORS preflight requests
2016-10-18 23:04:51 +02:00
ejurgensen
c44f4310b7
[httpd] Replace evhttp_send_error with the httpd_send_error wrapper
2016-10-18 22:45:22 +02:00
ejurgensen
fe7373e442
[httpd] Implement httpd_send_error, a modified evhttp_send_error, which
...
can include CORS headers (credit @bjoernricks and libevent)
2016-10-17 23:08:02 +02:00
ejurgensen
e1cfccbce7
[httpd] Exchange evhttp_send_reply with httpd_send_reply in httpd.c
2016-10-17 22:14:10 +02:00
ejurgensen
0b29b4368d
[httpd] Enable CORS headers by default (Access-Control-Allow-Origin: *)
2016-10-17 22:03:32 +02:00
ejurgensen
7dc2a46261
[cache] Save daap replies gzipped - should improve performance
2016-10-17 19:40:25 +02:00
ejurgensen
249d923af2
[httpd] Allow caller of httpd_send_reply to avoid gzipping
2016-10-17 14:18:13 +02:00
ejurgensen
d8696e72ea
[httpd] Don't gzip small messages
2016-10-17 14:09:16 +02:00
ejurgensen
f7185db035
[httpd] Reduce memcpy when gzipping a response
2016-10-16 23:36:27 +02:00
ejurgensen
d66a130064
[lastfm] Also scrobble after regular daap streaming
...
Ref https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=813940
2016-09-02 21:52:45 +02:00
Björn Ricks
6b6a1e65e1
Allow to add Access-Control-Allow-Origin header to responses
...
Add a new general config setting allow_origin that is included as
Access-Control-Allow-Origin header in http responses. This allows to make http
request against forked-daapd from browsers with enabled CORS
(https://www.w3.org/TR/cors/ ) via JavaScript XMLHttpRequest.
Per default the setting is not defined and no Access-Control-Allow-Origin header
is included in the response.
2016-06-02 13:32:41 +02:00
ejurgensen
9a56044c77
[misc] Explicitly check for pthread_setname_np/pthread_set_name_np
...
Seems there is no pthread_setname_np in OpenWrt
2016-05-05 19:39:15 +02:00
ejurgensen
c4713d8b39
[httpd] Improve log message
2016-03-21 19:26:54 +01:00
ejurgensen
b454a2fd60
[general] Put back support for platforms without pipe2(), see issue #239
2016-03-17 22:20:16 +01:00
chme
98d6db002f
Set thread names to make it easier to identify threads during debugging
2016-03-12 14:01:08 +01:00
ejurgensen
6cabbc4ab7
[httpd] Add fallback to IPv4 if v6 fails
2015-12-21 21:52:21 +01:00
ejurgensen
3e80e5c517
[transcode] Don't pass error to player on eof + some comments and cleaning
2015-10-22 22:09:19 +02:00
ejurgensen
55104015e0
Full removal of libevent 1 legacy code. Also drop pipe() in FreeBSD, since pipe2 is available now.
2015-10-19 21:15:29 +02:00
ejurgensen
2a610812a5
Refactor transcode.c so it can actually transcode + use new capability to support mp3 streaming.
...
Also includes the skeleton for perhaps supporting video in the future. Adds more fine-grained
ffmpeg/libav compability checks. Dependency on libavresample/libswresample exchanged with
dependency on libavfilter, which seems more versatile.
2015-10-09 23:58:27 +02:00
ejurgensen
a183fc3299
Fix #147 where forked-daapd would not listen on IPv6 when enabled
2015-05-07 22:53:37 +02:00
chme
659f9c09bb
Use enum values for data_kind and media_kind
2015-04-23 11:34:44 +02:00
ejurgensen
dbfd034679
Downgrade log severity of "Found query string" in httpd.c
2015-04-13 21:33:00 +02:00
ejurgensen
99cda05dab
Remove player metadata event timer (use the existing instead)
2015-04-11 20:30:31 +02:00
ejurgensen
cf091e8d8b
Adjust daapcache so it serves User-Agent to httpd_daap's reply handlers
2014-08-23 00:02:01 +02:00
ejurgensen
c740e6e3b0
Make compatible with libevent 2.0 by crippling streaming and ICY metadata (see issue #30 )
2014-05-30 23:39:03 +02:00
ejurgensen
5b4ef31758
Migrate all evhttp to non-deprecated libevent2
...
- well except a troublemaker in httpd_daap.c (req->flags &= ~EVHTTP_PROXY_REQUEST)
2014-05-29 23:22:00 +02:00
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
Julien BLACHE
2530c3512b
Rename webface_cb() to httpd_gen_cb()
2009-05-03 12:26:01 +02:00
Julien BLACHE
cd6f87401a
Rename struct stream_chunk to struct stream_ctx
2009-05-03 12:19:04 +02:00
Julien BLACHE
c76c8165ce
Enable httpd on the configured port
2009-05-03 11:16:58 +02:00
Julien BLACHE
a1afb0d390
Use evhttp_send_reply_chunk_with_cb() to stream files
...
This evhttp extension makes it possible to schedule chunks one after
the other when (part of) the previous chunk has been written to the
client.
2009-05-03 11:16:58 +02:00
Julien BLACHE
1d152decf7
Use evhttp_request->fail_cb to stop streaming if the client closes the connection
...
This is an extension to evhttp. Without this, we cannot know that the client
closes the connection, and we keep pushing chunks while the underlying
evhttp_request has been freed, leading to a segfault.
2009-05-03 11:16:57 +02:00
Julien BLACHE
e4fe084619
Use embedded evhttp
2009-05-03 11:16:57 +02:00
Julien BLACHE
c9868175fd
Implement URI encoding quirk for iTunes and Roku
...
iTunes and Roku devices do not encode + as %2B in the query string and
do not encode space as + either in the query string (though at least the
Roku encode space as %20 everywhere). This needs to be worked around or
browse queries fail to parse because + was decoded as space when the query
really needs a + character.
2009-05-03 11:16:57 +02:00
Julien BLACHE
09ef188d90
Add authentication to web interface, RSP and DAAP
2009-05-03 11:16:57 +02:00
Julien BLACHE
dc68de86dd
Add HTTP Basic auth support
2009-05-03 11:16:57 +02:00
Julien BLACHE
7a601d7daa
Enable streaming of transcoded content
2009-05-03 11:16:57 +02:00
Julien BLACHE
0a1c4545dc
Move safe_ato[il]() to misc.[ch]
2009-04-30 14:46:37 +02:00
Julien BLACHE
c071a58c3c
Wire up DAAP support
2009-04-30 13:57:40 +02:00
Julien BLACHE
f332f992aa
Document HTTP client quirks known to mt-daapd
2009-04-28 18:00:27 +02:00
Julien BLACHE
f05a55e7fc
Implement HTTP chunked streaming
...
Transcoding is not supported yet.
In the current state of affairs, we will crash if the client closes the
connection before the tranfser is done. This is a limitation of evhttp,
it is not possible to detect this condition. This will need to be fixed
in evhttp.
2009-04-28 18:00:21 +02:00
Julien BLACHE
5e8275a998
Wire up RSP support
2009-04-25 23:02:21 +02:00
Julien BLACHE
095350e6eb
Introduce new evhttp-based HTTP server
2009-04-25 16:27:47 +02:00