Commit Graph

342 Commits

Author SHA1 Message Date
Michael Niedermayer a880923170 avformat/http: Fix #ifdef FF_API_HTTP_USER_AGENT
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-09-17 20:14:10 +02:00
Steven Liu 27714b462d lavf/http: deprecate user-agent option 2016-09-17 13:48:34 +02:00
Moritz Barsnick d14993478c libavformat/http: add support for content_type option in listen mode
Instead of silently ignoring the content_type option in listen mode,
apply its value to the provided "Content-Type:" header.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-14 10:44:38 +02:00
Moritz Barsnick e8b355a028 libavformat/http: add support for headers option in listen mode
Instead of silently ignoring the headers option in listen mode, use
the provided headers.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-12 00:20:26 +02:00
Yuri Zats ebda8216dc avformat/http: change seek_ret to int64
Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-06-16 23:55:21 +02:00
Derek Buitenhuis f8e89d8a29 Merge commit 'fab8156b2f30666adabe227b3d7712fd193873b1'
* commit 'fab8156b2f30666adabe227b3d7712fd193873b1':
  avio: Copy URLContext generic options into child URLContexts

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-04-21 15:55:09 +01:00
Martin Storsjö fab8156b2f avio: Copy URLContext generic options into child URLContexts
Since all URLContexts have the same AVOptions, such AVOptions
will be applied on the outermost context only and removed from the
dict, while they probably make sense on all contexts.

This makes sure that rw_timeout gets propagated to the innermost
URLContext (to make sure it gets passed to the tcp protocol, when
opening a http connection for instance).

Alternatively, such matching options would be kept in the dict
and only removed after the ffurl_connect call.

Signed-off-by: Martin Storsjö <martin@martin.st>
2016-03-24 10:34:19 +02:00
Carl Eugen Hoyos 58fa694978 lavf/http: Add httpproxy to the default protocol whitelist. 2016-03-14 16:33:57 +01:00
Carl Eugen Hoyos 144ef773c7 Use correct msvc type specifiers for ptrdiff_t and size_t. 2016-03-09 14:00:22 +01:00
Derek Buitenhuis 93629735d7 avformat: Add a protocol blacklisting API
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-03-04 16:13:42 +00:00
Derek Buitenhuis 9c75148e6e Merge commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d'
This commit also disables the async fate test, because it
used internal APIs in a non-kosher way, which no longer
exists.

* commit '2758cdedfb7ac61f8b5e4861f99218b6fd43491d':
  lavf: reorganize URLProtocols

Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
2016-02-29 16:51:10 +00:00
Anton Khirnov 8c0ceafb0f urlprotocol: receive a list of protocols from the caller
This way, the decisions about which protocols are available for use in
any given situations can be delegated to the caller.
2016-02-22 11:45:31 +01:00
Anton Khirnov 2758cdedfb lavf: reorganize URLProtocols
Instead of a linked list constructed at av_register_all(), store them
in a constant array of pointers.

Since no registration is necessary now, this removes some global state
from lavf. This will also allow the urlprotocol layer caller to limit
the available protocols in a simple and flexible way in the following
commits.
2016-02-22 11:30:58 +01:00
Schenk, Michael 93f4b41208 avformat/http: add crypto to default whitlist to get encrypted HLS working again
I think we missed the crypto in the default_whitelist in case of http. Otherwise encrypted HLS will fail with

[hls,applehttp @ 0x2af39c00] playlist[0] open_input [http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes-audio=65000-video=236000-14.ts], start_seq_no [1], cur_seq_no [14]

[hls,applehttp @ 0x2af39c00]    open_input curseqno [14] startseqno [1]

[hls,applehttp @ 0x2af39c00] HLS request for url 'http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes-audio=65000-video=236000-14.ts', offset 0, playlist 0

[NULL @ 0x2af3a200] KEY_AES_128 seg->key [http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans.key] pls->key_url [http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans.key]

[hls,applehttp @ 0x2af39c00]     open_input [KEY_AES_128]

[hls,applehttp @ 0x2af39c00]      : c->persistence [0]

[hls,applehttp @ 0x2af39c00]      : c->probing     [1]

[hls,applehttp @ 0x2af39c00]      : pls->input     [NULL]

[hls,applehttp @ 0x2af39c00]        using normal http path for URL [crypto+http://playertest.longtailvideo.com/adaptive/oceans_aes/oceans_aes-audio=65000-video=236000-14.ts]

[crypto @ 0x2aff7cc0] Protocol not on whitelist 'http,https,tls,rtp,tcp,udp!

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-03 15:57:43 +01:00
Michael Niedermayer fe3fed0b14 Update demuxers and protocols for protocol whitelist support
Reviewed-by: Andreas Cadhalpun <andreas.cadhalpun@googlemail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-02-02 04:16:50 +01:00
Joel Holdsworth b4eb1f29eb avformat/http: Added http_proxy option
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-12-27 21:44:14 +01:00
Clément Bœsch 43ecec0f03 avformat: use AV_OPT_TYPE_BOOL in a bunch of places 2015-12-04 15:43:33 +01:00
Rodger Combs 362c17e656 lavf/http: fix incorrect warning in range requests 2015-11-25 19:34:01 -06:00
Michael Niedermayer 4d76e89c18 avformat/http: Initialize .str based default for AV_OPT_TYPE_STRING types
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-10-31 22:37:53 +01:00
Michael Niedermayer 7277a4ace9 avformat/http: add reconnect_delay_max option
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-09 02:23:38 +02:00
Michael Niedermayer bdbab4a351 avformat/http: exponentially delay reconnection to avoid flooding the server
Reviewed-by: Zhang Rui <bbcallen@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-07 19:28:46 +02:00
Michael Niedermayer 9bd68dea2b avformat/http: Add reconnect_at_eof and reconnect_streamed options
They allow reconnecting endless live streams which fail with eof

Reviewed-by: Zhang Rui <bbcallen@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-07 19:26:43 +02:00
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