From patchwork Sat May 6 00:55:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Micah Galizia X-Patchwork-Id: 3589 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.3.129 with SMTP id 123csp481417vsd; Fri, 5 May 2017 17:55:53 -0700 (PDT) X-Received: by 10.28.175.209 with SMTP id y200mr6540745wme.52.1494032153315; Fri, 05 May 2017 17:55:53 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 66si6531672wmm.122.2017.05.05.17.55.52; Fri, 05 May 2017 17:55:53 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@gmail.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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D10FF689888; Sat, 6 May 2017 03:55:43 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-it0-f67.google.com (mail-it0-f67.google.com [209.85.214.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EC99E688378 for ; Sat, 6 May 2017 03:55:37 +0300 (EEST) Received: by mail-it0-f67.google.com with SMTP id 131so2541355itz.2 for ; Fri, 05 May 2017 17:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=K/Tu1avJL8LhQLURecy9IJsHDEbn4Wzu19rYvnYboYo=; b=I5Tp2f7c3ezW9SQKTFaTnruW0yIBwnFpnLsIvCp0dxwrF+1ZCgZoSirFgw6vq8ofEa O46dehO/2SkQYkqXyRmSwl5/HdI2C8Nmb6m8xjjRFWcCkqEGGALprmAFsLdId9dNXPIh amCqTjQrIntiuY2dQ0TxhYEcCa9xhOJAVgei6i6rWOoJcBDtSCYQGTuHJ+cEFED3c75p bXf+hjzpxJEMoy5Uv4Em/4S0lJFvGoseiQbQg2tjRNDXyAJ9KoBO3+XtLkQ4541hEMY1 TGccTWYbJoNmbTqUVhXC9OIqhkaUJOCWhX73Pxi8PGQ8kzzEW/e6F8qagyCuobXzakWi e/Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=K/Tu1avJL8LhQLURecy9IJsHDEbn4Wzu19rYvnYboYo=; b=COA4cD+AJvXCf5RYZ/Hr4I5d3TuMLRuntYzIU4BaKk3OXPxd8F0l0+sY6kDnKGSxm7 oQyCdtWZPOlX0OIQq3IWjv7ZgLAErEU+22ZaJd+QEpxd3vC5x/DWqprRThuPuL3/OBd/ tL0z5iN+Iobq2XD3JKSRv8VfREWmAUsAVuSL9Kzce9T8fkUn9gyPpNt9Sx8AoXgekKXN T+DizmVdf5TyMcKbDtXpGImqsffZ1DjLSljYWa11CIb/cEpw4qeAUqoHe0NkhWmLlE/u FGum/NCYy+wpRnkfWcm/4Mr37dexfEAqTAzM0PEwKTJZuzhZLYRsvT7wd6rQKjGDKFGV HInw== X-Gm-Message-State: AN3rC/7L/1FPFvBWDOkAERnL5j0pyjBZfGakdUW8RHTdhqCrBeOUNHl1 uFxeRLI6qYTUHw== X-Received: by 10.36.178.88 with SMTP id h24mr12388270iti.31.1494032141939; Fri, 05 May 2017 17:55:41 -0700 (PDT) Received: from localhost.localdomain (24-212-156-108.cable.teksavvy.com. [24.212.156.108]) by smtp.gmail.com with ESMTPSA id j5sm1654771iti.20.2017.05.05.17.55.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 05 May 2017 17:55:41 -0700 (PDT) From: Micah Galizia To: ffmpeg-devel@ffmpeg.org Date: Fri, 5 May 2017 20:55:05 -0400 Message-Id: <20170506005505.3945-2-micahgalizia@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170506005505.3945-1-micahgalizia@gmail.com> References: <20170503030449.3eab6993@debian> <20170506005505.3945-1-micahgalizia@gmail.com> Subject: [FFmpeg-devel] [PATCH] libavformat/hls: Observe Set-Cookie headers 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: Micah Galizia MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Micah Galizia --- libavformat/hls.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/libavformat/hls.c b/libavformat/hls.c index bac53a4350..bda9abecfa 100644 --- a/libavformat/hls.c +++ b/libavformat/hls.c @@ -630,8 +630,16 @@ static int open_url(AVFormatContext *s, AVIOContext **pb, const char *url, ret = s->io_open(s, pb, url, AVIO_FLAG_READ, &tmp); if (ret >= 0) { // update cookies on http response with setcookies. - void *u = (s->flags & AVFMT_FLAG_CUSTOM_IO) ? NULL : s->pb; - update_options(&c->cookies, "cookies", u); + char *new_cookies = NULL; + + if (s->flags ^ AVFMT_FLAG_CUSTOM_IO) + av_opt_get(*pb, "cookies", AV_OPT_SEARCH_CHILDREN, (uint8_t**)&new_cookies); + + if (new_cookies) { + av_free(c->cookies); + c->cookies = new_cookies; + } + av_dict_set(&opts, "cookies", c->cookies, 0); }