Commit Graph

370 Commits

Author SHA1 Message Date
Michael Niedermayer 63974bd494 avformat/http: print error that causes reconnection
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-06 20:43:38 +02:00
Michael Niedermayer 7990beedee avformat/http: require seekability only when seeking to position != 0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-06 20:43:38 +02:00
Stephan Holljes 280d140cb0 lavf/http: Remove superfluous parenthesis.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Reviewed-by: Ganesh Ajjanagadde <gajjanag@mit.edu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 20:11:29 +02:00
Stephan Holljes dd7b486e8e lavf/http: Fix incorrectly placed parenthesis.
The assignment had incorrectly placed parentheses which resulted in ret
always being > 0.

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 18:55:49 +02:00
Stephan Holljes 4f860848ab lavf/http: Fix parsing http request data to not read over '\0'.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-08-25 19:51:13 +02:00
Stephan Holljes 3240e69de6 lavf/http: Implement server side network code.
add http_accept,
add http_handshake and move handshake logic there,
handle connection closing.

Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-08-01 00:58:31 +02:00
Michael Niedermayer 8e67599505 Merge commit '5ae178539b91d25710b7bb322d156c31aea9f8bf'
* commit '5ae178539b91d25710b7bb322d156c31aea9f8bf':
  http: Add the trailing endlines if they are missing

Merged-by: Michael Niedermayer <michael@niedermayer.cc>
2015-07-30 16:24:03 +02:00
Luca Barbato 5ae178539b http: Add the trailing endlines if they are missing
Makes slightly easier the life of those want to use the option
from the command line
2015-07-30 11:21:26 +02:00
Stephan Holljes de3a7ef204 lavf/http: Correctly terminate session with HTTP POST client.
Send a footer to correctly close client sockets.
This fixes network errors in client applications.

Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-10 18:17:28 +02:00
Stephan Holljes 44d1921200 lavf/http: Add simple autodetection for client HTTP method, based on AVIO_FLAG_READ.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-06-06 09:24:50 +02:00
Stephan Holljes 290b237556 lavf/http: Indent else-clause.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-06-06 09:24:50 +02:00
Stephan Holljes a7e7c68b0e lavf/http: Properly process HTTP header on listen.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-06-06 09:24:50 +02:00
Stephan Holljes 8cfaa76a5e lavf/http: Rudimentary error handling for HTTP requests received from clients.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-06-06 09:24:43 +02:00
Stephan Holljes bbcee92b6d lavf/http: Process HTTP header before sending response.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-06-06 09:13:42 +02:00
Stephan Holljes aa74401af8 lavf/http: Document method option.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
2015-06-06 09:13:41 +02:00
Michael Niedermayer a649f36f75 avformat/http: Mark lower_proto as const in http_listen()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-10 15:01:36 +02:00
Rodger Combs 71b69df622 lavf/http: support HTTPS when listening
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-02 12:03:48 +02:00
Michael Niedermayer 40d552dae6 Merge commit '1a3eb042c704dea190c644def5b32c9cee8832b8'
* commit '1a3eb042c704dea190c644def5b32c9cee8832b8':
  Replace av_dlog with normal av_log at trace level

Conflicts:
	ffplay.c
	libavdevice/fbdev_dec.c
	libavfilter/avfilter.c
	libavfilter/internal.h
	libavfilter/setpts.c
	libavfilter/src_movie.c
	libavfilter/vf_crop.c
	libavfilter/vf_drawtext.c
	libavfilter/vf_fieldorder.c
	libavformat/assdec.c
	libavformat/avidec.c
	libavformat/flvdec.c
	libavformat/http.c
	libavformat/ipmovie.c
	libavformat/isom.c
	libavformat/mov.c
	libavformat/mpegenc.c
	libavformat/mpegts.c
	libavformat/mpegtsenc.c
	libavformat/mux.c
	libavformat/mxfdec.c
	libavformat/nsvdec.c
	libavformat/oggdec.c
	libavformat/r3d.c
	libavformat/rtspdec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-20 03:19:47 +02:00
Michael Niedermayer 22c0585a00 avformat/http: Fix 2 typos
Found-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-19 14:26:40 +02:00
Vittorio Giovara 1a3eb042c7 Replace av_dlog with normal av_log at trace level
This applies to every library where performance is not critical.
2015-04-19 12:41:59 +01:00
Michael Niedermayer 3668701f96 avformat/http: Return an error in case of prematurely ending data
Fixes Ticket 4039

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-19 13:01:48 +02:00
Rodger Combs a4d58c97d0 lavf/http: handle case where the server returns a redirect during a seek
txoffer (e.g. http://tori.aoi-chan.com/ ) redirects to the same URI on your
first request, and serves the actual file on the second. It's stupid, but AFAIK
technically compliant. We'd previously see the server not handing back a Range
header and return an error; now, instead, we see that there's a redirect and
keep track of the offset we want while trying again at the new URL.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-13 11:18:50 +02:00
Stephan Holljes b51027fd18 libavformat/http.c: Make http-listen work as an input stream.
With this patch http can be used to listen for POST data to be used as an input stream.

Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-11 23:10:44 +02:00
Stephan Holljes 6d8c27f951 libavformat/http.c: Fix missing parenthesis in http_listen()
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-06 22:17:58 +02:00
Stephan Holljes 4a58d757de lavf/http: add proof-of-concept http server.
Signed-off-by: Stephan Holljes <klaxa1337@googlemail.com>
Reviewed-By: Nicolas George <george@nsup.org>
2015-04-05 10:17:47 +02:00
Himangi Saraogi 919d13d238 avformat/http: Fix null check on allocated value
probably fixes CID 1292299

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-31 12:38:02 +02:00
Micah Galizia c59654d67d avformat/http: replace cookies with updated values instead of appending forever
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-18 19:53:26 +01:00
Zhang Rui 3f375950f3 avformat/http: support auto reconnect
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-13 19:07:28 +01:00
Michael Niedermayer a0fe1a25fa Merge commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e'
* commit 'daf8cf358a098a903d59adb6c0d0cc3262a8c93e':
  avformat: Don't anonymously typedef structs

Conflicts:
	libavformat/adtsenc.c
	libavformat/aiffenc.c
	libavformat/avidec.c
	libavformat/gif.c
	libavformat/iff.c
	libavformat/img2dec.c
	libavformat/jvdec.c
	libavformat/matroskadec.c
	libavformat/udp.c
	libavformat/wtvdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-14 21:07:40 +01:00
Diego Biurrun daf8cf358a avformat: Don't anonymously typedef structs 2015-02-14 10:13:47 -08:00
Michael Niedermayer bcd4447173 avformat/http: Use av_freep() avoid leaving stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-20 16:53:37 +01:00
Michael Niedermayer deccb4d827 avformat/http: simplify chained_options copying
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 14:30:32 +01:00
Brandon Lees ffaf2074eb Fix the timeout option not working when connecting to a HTTP url that requires authentication.
In http_open_cnx, the patch restores the AVDictionary if connection needs to be re-tried
because of a authentication/redirect status code.

Previously, if a 401/407/30x status code was encountered, http_open_cnx would restart at the redo label, but any options
used by the underlying protocol would be missing because they were removed by the first attempt.

Signed-off-by: Brandon Lees <brandon@n-hega.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-15 14:30:32 +01:00
Andrey Utkin 70c9d40008 avformat/http: pass return code from http_open_cnx_internal() on its failure
Previously, AVERROR(EIO) was returned on failure of
http_open_cnx_internal(). Now the value is passed to upper level, thus
it is possible to distinguish ECONNREFUSED, ETIMEDOUT, ENETUNREACH etc.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-23 20:58:21 +02:00
Andrey Utkin 81ce3f8e80 avformat/http: Use ff_http_averror()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-20 04:31:59 +02:00
Andrey Utkin 9d86ce783b avformat/http: Introduce ff_http_averror()
int ff_http_averror(int status_code, int default_averror)

This helper function returns AVERROR_ value from 3-digit HTTP status
code.

Second argument, default_averror, is used if no specific AVERROR_ is
available. It is introduced because in different places of code
different return codes are used - -1, AVERROR(EIO), AVERROR_INVALIDDATA.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-20 04:31:46 +02:00
Nicolas George 4bebce0617 lavf/http: remove special case for cookies attributes.
With the previous change, unknown attributes are all ignored,
as specified by the RFC.
2014-08-17 20:07:27 +02:00
Nicolas George 481cbc5ad5 lavf/http: fix cookie parsing.
The current code would use any unknown attribute-value pair
as the cookie value.
RFC 6265 states that the first key-value pair is the actual
cookie, and the attribute-value pairs only start after.

With the current code:
Set-Cookie: test=good_value; path=/; dummy=42
gives this:
Cookie: dummy=42
instead of this with the new code:
Cookie: test=good_value
2014-08-17 20:07:27 +02:00
Michael Niedermayer 60dbed6067 Merge commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867'
* commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867':
  cosmetics: Write NULL pointer inequality checks more compactly

Conflicts:
	libavcodec/dvdsubdec.c
	libavcodec/h263dec.c
	libavcodec/libxvid.c
	libavcodec/rv10.c
	libavcodec/utils.c
	libavformat/format.c
	libavformat/matroskadec.c
	libavformat/segment.c
	libavutil/opt.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 21:26:12 +02:00
Gabriel Dume 4b1f5e5090 cosmetics: Write NULL pointer inequality checks more compactly
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-15 05:34:13 -07:00
Michael Niedermayer 1e81b185ae Merge commit '7ccb847f0f1f28199fa254847b91b6e50fb92832'
* commit '7ccb847f0f1f28199fa254847b91b6e50fb92832':
  http: Reduce scope of a variable in parse_content_encoding()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-15 12:12:35 +02:00
Diego Biurrun 7ccb847f0f http: Reduce scope of a variable in parse_content_encoding()
Also fixes an unused variable warning with zlib disabled.
2014-08-15 09:37:38 +02:00
Michael Niedermayer e260c8180e Merge commit '4e629ef80e62a54636cb46033998177dd08cf3ad'
* commit '4e629ef80e62a54636cb46033998177dd08cf3ad':
  http: Fix authentication, broken since 6a463e7fb

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-14 00:12:56 +02:00
Michael Niedermayer 313d75cd43 Merge commit '7e38903b5c86a759549e70647ae42bb22d353b14'
* commit '7e38903b5c86a759549e70647ae42bb22d353b14':
  http: enable icy metadata by default.

Conflicts:
	Changelog
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-13 22:54:31 +02:00
Michael Niedermayer 69a5cd9fea Merge commit '7601f9412a2d3387617a45966b65b452a632c27a'
* commit '7601f9412a2d3387617a45966b65b452a632c27a':
  http: export icecast metadata as an option with name "metadata".

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-13 22:52:53 +02:00
Martin Storsjö 4e629ef80e http: Fix authentication, broken since 6a463e7fb
The cur_*auth_type variables were set before the http_connect call
prior to 6a463e7fb - their sole purpose is to record the
authentication type used to do the latest request, since parsing
the http response sets the new type in the auth state.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-08-13 20:22:28 +03:00
Michael Niedermayer 9f7a2ecb29 Merge commit '8bf3bf69ad7333bf0c45f4d2797fc2c61bc8922f'
* commit '8bf3bf69ad7333bf0c45f4d2797fc2c61bc8922f':
  http: Stop reading after receiving the whole file for non-chunked transfers

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-13 18:26:40 +02:00
Andrew Stone 7e38903b5c http: enable icy metadata by default.
It won't hurt servers that don't care about the header,
and those that do will include it by default.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-13 16:10:15 +00:00
Andrew Stone 7601f9412a http: export icecast metadata as an option with name "metadata".
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-13 16:09:05 +00:00
Martin Storsjö 8bf3bf69ad http: Stop reading after receiving the whole file for non-chunked transfers
Previously this logic was only used if the server didn't
respond with Connection: close, but use it even for that case,
if the server response is non-chunked.

Originally the http code has relied on Connection: close to close
the socket when the file/stream is received - the http protocol
code just kept reading from the socket until the socket was closed.
In f240ed18 we added a check for the file size, because some
http servers didn't respond with Connection: close (and wouldn't
close the socket) even though we requested it, which meant that the
http protocol blocked for a long time at the end of files, waiting
for a socket level timeout.

When reading over tls, trying to read at the end of the connection,
when the peer has closed the connection, can produce spurious (but
harmless) warnings. Therefore always voluntarily stop reading when
the specified file size has been received, if not using a chunked
transfer encoding. (For chunked transfers, we already return 0
as soon as we get the chunk header indicating end of stream.)

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-08-13 14:34:25 +03:00
Michael Niedermayer b4d4f8f826 Merge commit '6a463e7fb4f028c52d2e2d054f9483f4fff492bc'
* commit '6a463e7fb4f028c52d2e2d054f9483f4fff492bc':
  http: Refactor http_open_cnx

See: c2a170ac0d
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 03:44:11 +02:00
Rodger Combs c2a170ac0d avformat/http: fix tls/tcp protocol after a 302 move in https
Fixes ticket 3824

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 03:33:40 +02:00
Luca Barbato 6a463e7fb4 http: Refactor http_open_cnx
Split return value handling from the actual opening.

Incidentally fixes the https -> http redirect issue reported by
Compn on behalf of rcombs.

CC: libav-stable@libav.org
2014-08-03 23:13:27 +02:00
Michael Niedermayer 8b59ab1af0 Merge commit 'ce2e858f5b3416c2d54f7f8c14e901f75c48b785'
* commit 'ce2e858f5b3416c2d54f7f8c14e901f75c48b785':
  http: K&R formatting cosmetics

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-24 02:08:14 +02:00
Diego Biurrun ce2e858f5b http: K&R formatting cosmetics
Also comment some #endifs and reshuffle headers into canonical order.
2014-07-23 13:57:24 -07:00
Michael Niedermayer 016cca4504 Merge commit '7bdd2ff6825951f7a6a6008303acfce7c2a63532'
* commit '7bdd2ff6825951f7a6a6008303acfce7c2a63532':
  http: Use a constant for the supported header size

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 22:02:48 +02:00
Luca Barbato 7bdd2ff682 http: Use a constant for the supported header size 2014-07-22 16:38:26 +02:00
Michael Niedermayer ab7c67905d Merge commit '389380c27915b0505fed538cd54c035c891fabd9'
* commit '389380c27915b0505fed538cd54c035c891fabd9':
  http: Do move the class instantiation in the conditional block

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 03:00:06 +02:00
Michael Niedermayer e621e6cac6 Merge commit '28df1d24112c6ad0763985df2faeeb198cfbad69'
* commit '28df1d24112c6ad0763985df2faeeb198cfbad69':
  http: Provide an option to override the HTTP method

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-22 02:51:35 +02:00
Luca Barbato 389380c279 http: Do move the class instantiation in the conditional block
Remove a warning if https support is disabled.
2014-07-21 22:18:35 +02:00
Luca Barbato 28df1d2411 http: Provide an option to override the HTTP method
Certain servers accept only PUT as valid method.
2014-07-21 22:18:35 +02:00
Michael Niedermayer 56193d33be avformat/http: remove never twice executable loop
Fixes CID1197069

Reviewed-by: Tomas Härdin <tomas.hardin@codemill.se>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-14 20:44:15 +02:00
wm4 686e662676 http: restructure http_connect error handling path
The authstr memory allocations make it annoying to error in the middle
of the header setup code, so apply the usual C error handling idiom to
make it easier to error at any point.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-23 05:56:35 +01:00
wm4 76c8fbc5f2 http: never send 'Cookie: (null)' to the server
If a domain has some cookies set, but matching the cookie fails due to
the port being different, get_cookies() succeeds, but sets cookies to
NULL. The caller of get_cookies() didn't check for the NULL value.

This also avoids passing NULL to libc string functions, which is
undefined behavior

Fixes Ticket2180

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-21 20:32:09 +01:00
Michael Niedermayer 11ed7ec092 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  http: Properly initialize icy headers string

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 23:24:19 +01:00
Michael Niedermayer 7e6c6c45ec Merge commit 'e77a2ea9505863e50bf013706f66bf8b7325e524'
* commit 'e77a2ea9505863e50bf013706f66bf8b7325e524':
  http: Declare more parameters as const where possible

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 20:50:29 +01:00
Alessandro Ghedini 6998a9f4c4 http: Properly initialize icy headers string
The icy_metadata_headers string never gets initialized, so,
during the first call to av_strlcatf() in parse_icy(),
strlen() will be called on a pointer to uninitialized memory.
At best this causes some garbage data to be left at the
start of the string.

By initializing icy_metadata_headers to the empty string, the
first call to strlen() will always return 0, so that data is
appended from the start of the string.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-12 20:13:36 +01:00
Martin Storsjö e77a2ea950 http: Declare more parameters as const where possible
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-12 13:24:58 +02:00
Michael Niedermayer cd25412f59 Merge remote-tracking branch 'qatar/master'
* qatar/master:
  http: Allow setting a Content-Type for POST requests

Conflicts:
	libavformat/http.c

See: c01d1d4ddf
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 04:53:54 +01:00
Michael Niedermayer 1cc9468289 Merge commit 'ab76d9f628ad46e1d3bbf26c5bf1f87083f239ab'
* commit 'ab76d9f628ad46e1d3bbf26c5bf1f87083f239ab':
  http: Always allow no-op seek

Conflicts:
	libavformat/http.c

See: 857841c1b6
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 04:29:54 +01:00
Michael Niedermayer 76a939d0e5 Merge commit '2ec33d27127251bbc45e1f88e60691ad59cf2319'
* commit '2ec33d27127251bbc45e1f88e60691ad59cf2319':
  http: Add support for selecting a request range

Conflicts:
	doc/protocols.texi
	libavformat/http.c

See: d52882faef
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 04:12:30 +01:00
Michael Niedermayer f36da16ede Merge commit 'ddfc98906373d1f17f6205cedd14c68d7a75995f'
* commit 'ddfc98906373d1f17f6205cedd14c68d7a75995f':
  http: Support setting custom User-Agent

Conflicts:
	doc/protocols.texi
	libavformat/http.c

See: 2bb1c713cc
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 03:45:16 +01:00
Michael Niedermayer c03af3ac1c Merge commit 'e58c85b0686892960042232e51c77168b264838a'
* commit 'e58c85b0686892960042232e51c77168b264838a':
  http: Export Content-Type information

Conflicts:
	doc/protocols.texi
	libavformat/http.c

See: 76d851b656
See: 20899c54f0
See: 255ec768da
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 03:33:14 +01:00
Michael Niedermayer ca2369cdee Merge commit '8075c3d8bb1f6aade0cc7c5c40db9bc1bcd84cab'
* commit '8075c3d8bb1f6aade0cc7c5c40db9bc1bcd84cab':
  http: Add support reading ICY metadata

Conflicts:
	doc/protocols.texi
	libavformat/http.c

See: a92fbe16f2
See: 636273d3d4
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 03:18:12 +01:00
Michael Niedermayer 21d4c571fa Merge commit '4ff99ab3d7d5576e99e6b8a411b4a44500ed88fa'
* commit '4ff99ab3d7d5576e99e6b8a411b4a44500ed88fa':
  http: Refactor process_line

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 02:52:17 +01:00
Michael Niedermayer df41cbee85 Merge commit '7a2fddb4480121712df560cf619c1c3566cae3ff'
* commit '7a2fddb4480121712df560cf619c1c3566cae3ff':
  http: K&R formatting cosmetics

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 02:45:34 +01:00
Michael Niedermayer b752d02f42 Merge commit '78b21c1d7177e1d61ad3c9225f67699da089aa7c'
* commit '78b21c1d7177e1d61ad3c9225f67699da089aa7c':
  http: Drop doxy comments

Conflicts:
	libavformat/http.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 02:39:46 +01:00
Michael Niedermayer 03fd80dcb1 Merge commit '55a215ba63d9fa79cd7ee265ee2e777ee86b200c'
* commit '55a215ba63d9fa79cd7ee265ee2e777ee86b200c':
  http: Return meaningful error codes

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-12 02:34:02 +01:00
Clément Bœsch 2572d07c1f http: Allow setting a Content-Type for POST requests
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Anssi Hannula ab76d9f628 http: Always allow no-op seek
This also allows checking stream position as per ffurl_seek() doxy.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Anssi Hannula 2ec33d2712 http: Add support for selecting a request range
Comment from Reimar Döffinger included as pro memoria.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Clément Bœsch ddfc989063 http: Support setting custom User-Agent
Contextually make the default User-Agent use the common
"Name/Version" pattern.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Michael Niedermayer e58c85b068 http: Export Content-Type information
Bug-Id: https://bugs.debian.org/740421

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Luca Barbato 8075c3d8bb http: Add support reading ICY metadata
Export the metadata as a icy_metadata_packet avoption.
Based on the work of wm4 and Alessandro Ghedini.

Bug-Id: https://bugs.debian.org/739936

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Alessandro Ghedini fe568b3d27 http: Improve options descriptions
Add documentation where missing.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-11 22:08:57 +01:00
Luca Barbato 4ff99ab3d7 http: Refactor process_line 2014-03-11 22:08:56 +01:00
Luca Barbato 7a2fddb448 http: K&R formatting cosmetics 2014-03-11 22:08:56 +01:00
Luca Barbato 78b21c1d71 http: Drop doxy comments 2014-03-11 22:08:56 +01:00
Luca Barbato 55a215ba63 http: Return meaningful error codes 2014-03-11 22:08:56 +01:00
Michael Niedermayer c832bf0c38 Merge remote-tracking branch 'lukaszmluki/master'
* lukaszmluki/master:
  lavd/avdevice: always free detected devices on error
  lavf/http: return error from seek on invalid whence
  lavf/http: return error on seeking to negative postion
  lavf/avio: fix ffurl_alloc error checks

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-06 02:04:18 +01:00
Lukasz Marek 1aa262f460 lavf/http: return error from seek on invalid whence
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
2014-03-06 00:32:24 +01:00
Lukasz Marek 4ba6a534dc lavf/http: return error on seeking to negative postion
Signed-off-by: Lukasz Marek <lukasz.m.luki@gmail.com>
2014-03-06 00:32:20 +01:00
wm4 636273d3d4 http: handle ICY in presence of chunked transfer encoding
Some http servers send an ICY stream in combination with chunked
transfer encoding. This case was handled incorrectly by the ICY code:
instead of handling chunked encoding before anything ICY related, both
were mixed.

Fix this by separating the ICY code from normal http reading. Move the
normal http reading to a new function http_read_stream(), while
http_read() handles ICY on top of http_read_stream().

The server identified itself as: cloudflare-nginx

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-05 22:49:36 +01:00
Eli Kara da25a6573f avformat/http: Properly handle cookies that specify sub-domain where the URL.
Fixes ticket #3336

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-23 14:39:36 +01:00
Anssi Hannula 857841c1b6 avformat/http: always allow no-op seek
This also allows checking stream position as per ffurl_seek() doxy.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2014-01-03 15:05:48 +02:00
Anssi Hannula d52882faef avformat/http: allow the caller to select a request range
Add AVOptions for setting the initial offset and the ending offset, so
they can be used for setting an appropriate Range header.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
2013-12-31 03:18:53 +02:00
Michael Niedermayer 15b2ec57cc Merge commit 'be4edda6731a341d3fdeaa0e57753dc396790362'
* commit 'be4edda6731a341d3fdeaa0e57753dc396790362':
  http: Expose the content location via an AVOption

Conflicts:
	libavformat/http.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 17:48:45 +01:00
Michael Niedermayer 1d19f1b196 Merge commit '393d80cc278e2b2f5c9e7805db176e6f28335a33'
* commit '393d80cc278e2b2f5c9e7805db176e6f28335a33':
  http: Support relative URL redirection

Conflicts:
	libavformat/http.c

See: 4a4c93cb3f
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 17:41:45 +01:00
Michael Niedermayer 6d648dcfc9 Merge commit '76267ecc82e3018e1913a2483d5fc47d0949cbd8'
* commit '76267ecc82e3018e1913a2483d5fc47d0949cbd8':
  http: Remove an unrelated and mistakenly set AVOption unit name

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-22 17:18:52 +01:00
Martin Storsjö be4edda673 http: Expose the content location via an AVOption
Signed-off-by: Martin Storsjö <martin@martin.st>
2013-11-22 14:27:07 +02:00