From patchwork Tue Jan 9 07:39:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 7228 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp3612681jaa; Mon, 8 Jan 2018 23:39:32 -0800 (PST) X-Google-Smtp-Source: ACJfBou7l1tg+v3bQEvGwYfo+YEwKZaXBos/XCCI/c0NXrI1zJqoowEi25nEaLCMbxH+USXUVTe/ X-Received: by 10.28.71.214 with SMTP id m83mr10642064wmi.67.1515483572018; Mon, 08 Jan 2018 23:39:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515483571; cv=none; d=google.com; s=arc-20160816; b=ByVzdDq7VIkdoBxxIsdgd6huLhllsPKjxw2hz7GdjtKGLS19Xy5gDvkpo0eLpx1avN q9TIKMUEsrdF1tFE3Td3kOO0viJYGgvqtw2AV4FUFPl6mT0H1Do4xVPmVcfRNG151r3f sKBfIeWAB4ddozcEiIUcutEzpemmvKNrBetTfMpwdG2iZAl9jhn+IuFhrxuw8NfjY1yg gPukBPu3sL0WsO+RljeXn8/9X9yLyRuqbhhLN6RpBLG8idglLsKnNWje6ppbV2evvxAt xAslfulCmeXVTf1/LeY6Z65/IYvs/nCsF7rXGf+3h7ysLkehXttZ4KjnWNscknZiLBEb z/hQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:feedback-id:message-id:date:to:from :delivered-to:arc-authentication-results; bh=7VO8G2WzDRAj7NsSMPs4SeQBk+htMgC4QGXv2hqrO8g=; b=dAN5BVqb+TdLfXP5th/2oR3jw4fWzPKU3nRDGHTHA0TkWXUU3jYSzvXtvRuqFKgZpR iucLFy5qI/+jrcoW5jhswXylr5n7gJCVQa9jFAnfObZtAsX4sROO2lwbhljrI8Il0nUa zKREBxahmqzw+GcQH7EJ2+sMUaqKkB5rrDbTgW/m3BuyH+j7QKvl/v7JViUcTrA/7jr1 bLVqztBr2cqWAsDxcOvNIrIQvmFfg4YF6sk3Vqnhg7Cv20UkR9V8V3a7ke9+SKE95hpI uTUli8p2P4vtJDO/cu7Dnixp3LZsWW0J048MtTPdPr0STQN8I3kEJCbMg/+D8NEgge6w P77w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id p188si9258740wmd.176.2018.01.08.23.39.31; Mon, 08 Jan 2018 23:39:31 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 74DEA689F51; Tue, 9 Jan 2018 09:39:29 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpproxy19.qq.com (smtpproxy19.qq.com [184.105.206.84]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F379C689DA2 for ; Tue, 9 Jan 2018 09:39:21 +0200 (EET) X-QQ-mid: bizesmtp4t1515483557tgkbxap1w Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Tue, 09 Jan 2018 15:39:17 +0800 (CST) X-QQ-SSF: 01100000004000F0FKF0000A0000000 X-QQ-FEAT: uPKj8ga2w7F5aoVfzN8G9mRm9rSnfgIZxpqEQFpE0TDlH4t0H6sBNE87e+/5J V10sJOI/JKFIEsLLcr3r0w1baPhLNSIOL+OVS72CiL9gSFJ5JC2xbYSa57itrBGgTWycL+7 aGt5GiZWKySFVy/zwzq83qd8Fs/Px0AGK6PfzWP+aFlGnOnPJ6teRmAta2sN3j2Txd7/y51 liBQLxzPoxlgOxjS2S4xjuZbkj/DBcQZtuKQTgrAFxBUGvd9RMWPI2rKEWA7H4oC+6UE18A Z4cpWSp6felt1b2/7PeSwG2K6ATphrCwwNqw== X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Tue, 9 Jan 2018 15:39:12 +0800 Message-Id: <20180109073912.26199-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:chinaffmpeg.org:qybgforeign:qybgforeign1 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH 2/2] avformat/hls: store referer message in HLS http request X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Steven Liu --- 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;