aboutsummaryrefslogtreecommitdiffstats
path: root/src/inputStream_http.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2007-11-28Re-enable seeking in http streams.Qball Cow1-1/+1
Fixing stopping mpd from block when trying to stop a ogg stream that is buffering. git-svn-id: https://svn.musicpd.org/mpd/trunk@7053 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-11-28Don't try to forever to get data when the sockets winds up in "temporaryQball Cow1-8/+21
unavailable" when streaming music. But give up after 100 times. This is atm better then waiting until the connection gets back, because mpd blocks on this. git-svn-id: https://svn.musicpd.org/mpd/trunk@7052 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-11-18Disable seeking on streams, because of bug 1611. When playing ogg, the ↵Qball Cow1-1/+1
decoder seeks through the file then starts to play. This does not mix well with streams from websites. Stopping playback of an oggstream that is trying to stream will result in mpd hanging. git-svn-id: https://svn.musicpd.org/mpd/trunk@7039 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-09-08inputStream_http: signal the server to close after all requestsEric Wong1-1/+1
We want the partial content goodies of HTTP/1.1 without requiring persistent connections. Persistent connections across multiple HTTP requests don't really help in the case of MPD, either, because our content is usually big and heavy. Note: this puts MPD at the hands of the server to correctly close() the TCP connection we're using. If we connect to a rogue server that keeps the connection alive even when request not to, we'll spin :( However, encountering such a server is very unlikely... git-svn-id: https://svn.musicpd.org/mpd/trunk@6867 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-08-27adding \n to a bunch of error message stringsJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@6826 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-09Use string concatenation instead of snprintf for the User-Agent HTTPJ. Alexander Treuman1-2/+1
header. git-svn-id: https://svn.musicpd.org/mpd/trunk@6520 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-09Tidying up some code.J. Alexander Treuman1-12/+14
git-svn-id: https://svn.musicpd.org/mpd/trunk@6519 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-04Use strncasecmp instead of strncmp when comparing HTTP headers. It seemsJ. Alexander Treuman1-6/+6
some versions of shoutcast send "content-type" in all lowercase, and I don't trust other servers to get the case right for the rest of the headers we look for. git-svn-id: https://svn.musicpd.org/mpd/trunk@6482 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-03Removing that space that was recently added to the "Icy-Metadata: 1" HTTPJ. Alexander Treuman1-1/+1
header. While this is odd for an HTTP header, it's actually quite common for streaming clients to send it without a space. Some clients do send with a space as well, but without one has always worked fine and may in fact be more compatible. git-svn-id: https://svn.musicpd.org/mpd/trunk@6472 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-02Removing some commented code that wrote HTTP streams to stdout.J. Alexander Treuman1-4/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@6461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-06-02Someone forgot a space in the "Icy-Metadata: 1" HTTP header.J. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@6452 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman1-16/+8
call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-19inputStream_http: cleanup GET request code (finishHTTPInit)Eric Wong1-29/+29
Avoid unnecessary memset to zero, snprintf always puts a trailing '\0'. We also have no need to subtract one from the buffer we're snprintf-ing it to. We also check the return value of snprintf to ensure it's not too long. I have a feeling we might as well avoid snprintf altogether so we don't have to worry about buffer sizing/stack overflow and just do a bunch of write(2)s, letting Nagle sort it out... Also, centralize some of the exit error handling in with goto. This makes the code a bit more consistent and maintainable as well as reducing code and binary size. git-svn-id: https://svn.musicpd.org/mpd/trunk@5395 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-19inputStream_http: fix HTTP seekingEric Wong1-1/+1
We need to identify ourselves as HTTP/1.1 so Range: works; and so the server can return HTTP/1.1 instead of HTTP/1.0. Tested against lighttpd 1.4.13 git-svn-id: https://svn.musicpd.org/mpd/trunk@5394 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-06Fix a bug where mpd would complain about a proxy password being specifiedJ. Alexander Treuman1-7/+7
and not a proxy user even when both are specified. git-svn-id: https://svn.musicpd.org/mpd/trunk@5324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14Don't initialize globals to zero (or NULL)Eric Wong1-4/+4
Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-01-14inputStream_http: stop mixing declarations with codeEric Wong1-1/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@5242 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-12-23Adding support for seeking HTTP streams.J. Alexander Treuman1-17/+24
git-svn-id: https://svn.musicpd.org/mpd/trunk@5159 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-20/+20
I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30remove clumsy strncpy useEric Wong1-5/+5
strncpy isn't really safe because it doesn't guarantee null termination, and we have had to work around it in several places. strlcpy (from OpenBSD) isn't great, either because it often leaves errors going unchecked (by truncating strings). So we'll add the pathcpy_trunc() function with is basically strlcpy with a hardcoded MAXPATHLEN as the limit, and we'll acknowledge truncation since we only work on paths and MAXPATHLEN should be set correctly by the system headers[1]. file-specific notes: inputStream_http: eyeballing the changes here, it seems to look alright but I haven't actually tested it myself. ls: don't even bother printing a file if the filename is too long (and when is it ever?) since we won't be able to read it anyways. metadataChunk: it's only metadata, and it's only for showin the user, so truncating it here souldn't be a big issue. memset to zero in init is unecessary, so lets not waste cycles [1] - If the system headers are screwed up, then we're majorly screwed regardless of what we do :x git-svn-id: https://svn.musicpd.org/mpd/trunk@4491 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20Add mpd-indent.shAvuton Olrich1-3/+3
Add a few new options for indent to try to make things a bit cleaner git-svn-id: https://svn.musicpd.org/mpd/trunk@4411 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-20Add mpd-indent.shAvuton Olrich1-559/+589
Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-17sparse: ANSI-fy function declarationsEric Wong1-2/+2
These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-21inputStream_http: avoid printf, use our handy macros in log.hEric Wong1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4210 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-05-14Applied a modified patch for bug 344, needs testing with ipv6Qball Cow1-83/+69
git-svn-id: https://svn.musicpd.org/mpd/trunk@4171 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-16merge with mpd/trunk up to r3925Eric Wong1-0/+14
git-svn-id: https://svn.musicpd.org/mpd/trunk@3926 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-15inputStream_http.c: speling fikcsesEric Wong1-4/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@3921 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-04-17fix some parsing of http_prebuffer_sizeWarren Dukes1-3/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@3216 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-01-23change the http identification string to package_name/package_versionWarren Dukes1-1/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@2896 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-20fix oss_openDevice() to match the new openDevice callback protocol (w/o a ↵Warren Dukes1-1/+2
audioFormat argument) git-svn-id: https://svn.musicpd.org/mpd/trunk@2715 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-05not too smart shank, forgetting to set default buffer sizes in inputStream_httpWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@2513 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-02make http buffer and prebuffer size configurableWarren Dukes1-10/+51
git-svn-id: https://svn.musicpd.org/mpd/trunk@2479 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-28merge shank-rewrite-config changesWarren Dukes1-48/+60
git-svn-id: https://svn.musicpd.org/mpd/trunk@2375 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-26fix segfault when reconnecting to icecast server, this was due to error ↵Warren Dukes1-1/+0
sending metadata and not checking afterward if connection is open still git-svn-id: https://svn.musicpd.org/mpd/trunk@2349 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-25stream name maybe icy-name or ice-name in the http headersWarren Dukes1-1/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@2339 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-18fix bug #325Warren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@2270 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-18fix a bug in username and password parsing in http url'sWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1877 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-17added http authentication: http://user:passwd@host/musicWarren Dukes1-7/+54
git-svn-id: https://svn.musicpd.org/mpd/trunk@1872 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-21don't use fucking sprintfWarren Dukes1-3/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@1596 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-21maybe this matters ?Warren Dukes1-1/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1595 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-21maybe this fixes something ?Warren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1594 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-20http proxy authentication, can someone test?Warren Dukes1-11/+79
git-svn-id: https://svn.musicpd.org/mpd/trunk@1590 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-20http proxy mostly working, need to implement http authenticationWarren Dukes1-9/+42
git-svn-id: https://svn.musicpd.org/mpd/trunk@1588 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-20fix qball's bug, crossfading playing with funny samplerateWarren Dukes1-0/+50
git-svn-id: https://svn.musicpd.org/mpd/trunk@1585 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-17include sys/time.hWarren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@1522 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-09fix bug where inputStream_httpRead was returning 0 when cnnection closed,Warren Dukes1-3/+4
but data is still left in the buffer git-svn-id: https://svn.musicpd.org/mpd/trunk@1425 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-09debug code for stream name/titleWarren Dukes1-0/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@1415 09075e82-0dd4-0310-85a5-a0d7c8717e4f