diff mbox

[FFmpeg-devel,2/2] avformat/hls: store referer message in HLS http request

Message ID 20180109073912.26199-1-lq@chinaffmpeg.org
State Accepted
Commit b1af0e23a3b685b3e626158f63e5f958f5f75420
Headers show

Commit Message

Liu Steven Jan. 9, 2018, 7:39 a.m. UTC
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hls.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Steven Liu Feb. 1, 2018, 2:58 a.m. UTC | #1
2018-01-09 15:39 GMT+08:00 Steven Liu <lq@chinaffmpeg.org>:
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>  libavformat/hls.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 950cc4c3bd..9657b83fd9 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -202,6 +202,7 @@ typedef struct HLSContext {
>      int64_t first_timestamp;
>      int64_t cur_timestamp;
>      AVIOInterruptCB *interrupt_callback;
> +    char *referer;                       ///< holds HTTP referer set as an AVOption to the HTTP protocol context
>      char *user_agent;                    ///< holds HTTP user agent set as an AVOption to the HTTP protocol context
>      char *cookies;                       ///< holds HTTP cookie values set in either the initial response or as an AVOption to the HTTP protocol context
>      char *headers;                       ///< holds HTTP headers set as an AVOption to the HTTP protocol context
> @@ -1179,6 +1180,7 @@ static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg,
>
>      // broker prior HTTP options that should be consistent across requests
>      av_dict_set(&opts, "user_agent", c->user_agent, 0);
> +    av_dict_set(&opts, "referer", c->referer, 0);
>      av_dict_set(&opts, "cookies", c->cookies, 0);
>      av_dict_set(&opts, "headers", c->headers, 0);
>      av_dict_set(&opts, "http_proxy", c->http_proxy, 0);
> @@ -1652,7 +1654,7 @@ static int save_avio_options(AVFormatContext *s)
>  {
>      HLSContext *c = s->priv_data;
>      static const char * const opts[] = {
> -        "headers", "http_proxy", "user_agent", "user-agent", "cookies", NULL };
> +        "headers", "http_proxy", "user_agent", "user-agent", "cookies", "referer", NULL };
>      const char * const * opt = opts;
>      uint8_t *buf;
>      int ret = 0;
> --
> 2.14.3 (Apple Git-98)
>
>
>

patchset pushed


Thanks
Steven
diff mbox

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 950cc4c3bd..9657b83fd9 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -202,6 +202,7 @@  typedef struct HLSContext {
     int64_t first_timestamp;
     int64_t cur_timestamp;
     AVIOInterruptCB *interrupt_callback;
+    char *referer;                       ///< holds HTTP referer set as an AVOption to the HTTP protocol context
     char *user_agent;                    ///< holds HTTP user agent set as an AVOption to the HTTP protocol context
     char *cookies;                       ///< holds HTTP cookie values set in either the initial response or as an AVOption to the HTTP protocol context
     char *headers;                       ///< holds HTTP headers set as an AVOption to the HTTP protocol context
@@ -1179,6 +1180,7 @@  static int open_input(HLSContext *c, struct playlist *pls, struct segment *seg,
 
     // broker prior HTTP options that should be consistent across requests
     av_dict_set(&opts, "user_agent", c->user_agent, 0);
+    av_dict_set(&opts, "referer", c->referer, 0);
     av_dict_set(&opts, "cookies", c->cookies, 0);
     av_dict_set(&opts, "headers", c->headers, 0);
     av_dict_set(&opts, "http_proxy", c->http_proxy, 0);
@@ -1652,7 +1654,7 @@  static int save_avio_options(AVFormatContext *s)
 {
     HLSContext *c = s->priv_data;
     static const char * const opts[] = {
-        "headers", "http_proxy", "user_agent", "user-agent", "cookies", NULL };
+        "headers", "http_proxy", "user_agent", "user-agent", "cookies", "referer", NULL };
     const char * const * opt = opts;
     uint8_t *buf;
     int ret = 0;