From patchwork Mon Apr 15 16:27:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48070 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp1953203pzb; Mon, 15 Apr 2024 09:28:22 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWqHP2LU0d0P65egNOhdSp5s1muMVjDGVCFInOiBED1G92MZS4AxWZaxRpOeUX0SaSfIM5nqrzZ+xx6bT9+4nnn9bUZ+LpZku9qpg== X-Google-Smtp-Source: AGHT+IEnawmQ4nTyOyzqExKeYjfZ98LpoPheOjN2Lm1j3i1/MRoOIm7+6JH/SFYapJA36TvV8koX X-Received: by 2002:a50:d7d3:0:b0:56e:418:5559 with SMTP id m19-20020a50d7d3000000b0056e04185559mr7322196edj.3.1713198501879; Mon, 15 Apr 2024 09:28:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713198501; cv=none; d=google.com; s=arc-20160816; b=Mk9g/v9tGbBT3vAsM+3QpBJIPeu7bjfbazmCf/ewalookO9SLSJfPJjAI/mt4ZfYzq Mcsr+1uIsS4CfAIACV9fRp2ENZYnQP1OjYGyRIUpF9OvR5J7ZOmpSCsmcWEDLTWMiu7n cogbHUtppyMF+h/iHIi+ovEnMvmkYv3eRIM8VqpRHf6lHu+iatxAWVjtaJcfdJeMUuVQ mSunSjbhw9PeOua0OTsC+f56UI/Ssu/37Yzi9XzwtNbxG+6hEMLdwgcWLnrkuTyX6Kui 2Ur9bLKMem6oRl9MEpLNY0Ja8BJlrFr5pjpIzw8/5dYfET0YWUBxZuZg7w0kLDgpv7u+ RLGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=jY2WdkrZRf/+eKfGp6l0BX8Rky/PS9KM7BDvviP9SSI=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=baF0a7MG6aD945BYl4aiH2aQ0NnOiAIj2jVEuyQXykQ6HmOPifWW5Fg3EPzBroqcCo SIg/hGfPxzjYJqi1ga2fca3/kp8OCkjZuKEuVIehgYOAJ4nxQHJXIqwzc34CGTgHyhkH pAmr6/sFOWZlfodzmuO2ygqoc4T+8gGsnziB5Z7clONWYe98AhQH7xcfcTkDnv/S8P85 uIiUFf3VuLbdedBtGOgxZ1a1/l1louuyLfJQz+5wxrmKX74rh855Otkutm4hesJ3p51X HZOhD6F0vZzifrnFgObb3hImGb9nB/27VlmognXr9Ss9yLvuKkiZAgPfHa6euCqcLNoU fxeA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=R4GA8yFr; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z15-20020a056402274f00b0056fdeca8abesi4879716edd.317.2024.04.15.09.28.21; Mon, 15 Apr 2024 09:28:21 -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 header.s=20230601 header.b=R4GA8yFr; 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=QUARANTINE 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 BE59868CC5A; Mon, 15 Apr 2024 19:28:07 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 179CE68C72F for ; Mon, 15 Apr 2024 19:28:00 +0300 (EEST) Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-518c9ff3e29so1813551e87.0 for ; Mon, 15 Apr 2024 09:28:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198478; x=1713803278; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Sd4f9QVFSmk9O+pbsZYndSVexvyUjZEu6n+GY9V3HKg=; b=R4GA8yFrkTgwXEOPJdvW6EqE5Xiw/KRCFkqMfLwurS6tlj0hX7PmB4jKL1boEyRS4d 2NbL2D55z7CbbgeusSwSUQ+r4HqmR1FI1neSwv5VwIZmw+KYiugxlj/TkzhWh+/U+sB/ /znPZZUJLT2jh4O3hjqpRNiTl5agdAoc5ZoowDxppaWXS6LCSHGsOwRjG6m9eAfzp2Pb jvcFSnpO4rPhhTTDUfNEeP/i8C8BEWOJwZBNI0EoLBQZBNs0PBxKzaEFP6QWq3vMiDwN xm1IRe0R4xD5Fg3SNa1NJ1rWwrwclYeX8jQ6ByjOYbgLjxGpu2zVGtMBK6ZHmMVXJlv1 35FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198478; x=1713803278; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sd4f9QVFSmk9O+pbsZYndSVexvyUjZEu6n+GY9V3HKg=; b=qROMkjMH7rX/ukUZlFhMbn/oUCq3Jgfj5XOvjZBuMRkc2crXQTkjOUQmnZdjqYvO6N bvz2JfAYEfDLrlN9tpF7Ib+mJN5QTmBVXILjbWtFT7hjwijJuYGvo2Wa1tcAYV9hFL+i 3bIYgYadLMYclo2geJ9y6kvaGgoHsVnVPjT4GFUDKALaO77KuL9oPXZ/BgpezoJ/JL67 /c9dBtNR8dKLw4MZACn03eyJrWrdVPoGv7zAZVrSpUglaQlBlE8MShpwcEij2VrpBXai hEqZLXeWAc4Caz+1PoBv8OZdWmnkFEh+h59em2QGLeS0IjwppAgy8/1Q2E7dUhAJSxjz U9mA== X-Gm-Message-State: AOJu0YysW1fWSg7+7lZDE14ipB0iL6oCDYMqhPV2v1MkKMskDn2dHV9f pOFUgthHaCMfzMsbD9RARIHlgYhxfy0KrVrojooqQdzEIqSIhzGviZBJsA== X-Received: by 2002:ac2:4906:0:b0:518:f2f8:edc6 with SMTP id n6-20020ac24906000000b00518f2f8edc6mr1556211lfi.63.1713198478285; Mon, 15 Apr 2024 09:27:58 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4348000000b00347c187a3a0sm3899969wrr.24.2024.04.15.09.27.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:27:57 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 17:27:36 +0100 Message-ID: <20240415162741.110374-2-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/6] avutil/error: Add HTTP 429 Too Many Requests AVERROR code X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: k8tOVgIl0BSz This is a common error code from e.g. CDNs or cloud storage, and it is useful to be able to handle it differently to a generic 4XX code. Its source is RFC6585. Signed-off-by: Derek Buitenhuis --- libavutil/error.h | 1 + libavutil/version.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libavutil/error.h b/libavutil/error.h index 0d3269aa6d..1efa86c4c1 100644 --- a/libavutil/error.h +++ b/libavutil/error.h @@ -79,6 +79,7 @@ #define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1') #define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3') #define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4') +#define AVERROR_HTTP_TOO_MANY_REQUESTS FFERRTAG(0xF8,'4','2','9') #define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X') #define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X') diff --git a/libavutil/version.h b/libavutil/version.h index 1f2bddc022..5de2d92146 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -80,7 +80,7 @@ #define LIBAVUTIL_VERSION_MAJOR 59 #define LIBAVUTIL_VERSION_MINOR 15 -#define LIBAVUTIL_VERSION_MICRO 100 +#define LIBAVUTIL_VERSION_MICRO 101 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ From patchwork Mon Apr 15 16:27:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48071 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp1953263pzb; Mon, 15 Apr 2024 09:28:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVnQ+VXihaN+/h5KuMD6p5QRgBMU6httv9kpTDWa03/SLFl/Bye3k6uhfUW7/HaAupZzCU/i9OFeqTEnZTrI19Iq65OCCKwnbKQYA== X-Google-Smtp-Source: AGHT+IGfoO5E1imz5iE9SLAKyxeT3cGFDtIiG6DjcNA8a7vRBgElRLxDOtjHavwS562QA57DKDpw X-Received: by 2002:a50:bb44:0:b0:56d:f3f3:f61f with SMTP id y62-20020a50bb44000000b0056df3f3f61fmr8271040ede.9.1713198510481; Mon, 15 Apr 2024 09:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713198510; cv=none; d=google.com; s=arc-20160816; b=dia9aZeBj7yIF2s5bhu83rfl+WVMFNmJUuUrjgSvAAI8YdVp1cCKmZ0Y0DpqdnkMmn M+YNOqdwhEtuAyXjdN5yhJnVTAW1/OuukdFmmy1ZiAxbeDlDB3FmrVBA52eO/vZ1T25j dB51PrTr2VBKyU88Gu3QaDVXDH0tLG7z6GgxMYfk1KUslgQD/ObRIOWSIIMKBnIH4ida bih/CnwhScEpSpgPlQy5rb1l4/aIpLsF0zpTWHOlDPvDApj2rQ0oJoBl/tV/8bhtxAma REuaiGnQu6/hMCZ2yTmdIstCvBbFgKhWor14u1p4sUb5l8Fc1xhhyb9j9hPPN/GPEQhU si5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=c4S75ZxaFKcUjkwK3bPgSZE2T5/eG+0S06KXda/d9ww=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=tXdIR1DKBJe3ued9ZRb0N3f7ysYO2QqDEyfKHA3nlsoYmDYXp/XmrJAByYWHfB6gzg A8h5zRUJgmYen0aJEsF8AsN15Zw04vjRYxDqcnEbQOBE+FfRtnHg0285yzn+pytA/vtM 5lrTxBdrVvvUAiSuf1dP7YGSk5nz0liA1BrDgw4ONjsvch1bS/3itQOsAUBV7FhktrvH mAHNXnM21PF0aO0xLApiQaVtKlhll/16ke/y5UD2D0dYb2xtIR+C7gzJUUGTCfuihiZn 88BXtbjEp+9qzJ86m/gtQYThBJEzkH8eNvg051hQhhqKXvwiodoW/DbZScFJgPq1Hg4X A6YQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=d8B9DwRR; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id o18-20020a170906289200b00a5213ee7f47si4852889ejd.317.2024.04.15.09.28.30; Mon, 15 Apr 2024 09:28:30 -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 header.s=20230601 header.b=d8B9DwRR; 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=QUARANTINE 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 D1D1168CDD4; Mon, 15 Apr 2024 19:28:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AA89A68CC2A for ; Mon, 15 Apr 2024 19:28:01 +0300 (EEST) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-34782453ffdso1633803f8f.1 for ; Mon, 15 Apr 2024 09:28:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198480; x=1713803280; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=gFrgk3ObHzsqxaH/8KFZF69wL3qeH2ofBtTk2QJ/G0k=; b=d8B9DwRRqf6aGqUDRI+hHs6S5RwcjgLWNVDtWb6R1/Ggx1KUG/pc3ifwsGQ7mTfaB4 wO5Ul5LnRqWs23yTSUp7VQ59vSlcRETfF1BzX/F23Na7ydAmj2JYtMHkgYCI25hu/zAd HaJ1WzlghIS+PNLluCNDDpEkt6hwwVqH32YmqY20DWuhPOdLMLxSAzUGHuhiVKnSEAb7 PRuKQYiO5N4QWiSCeAiUSXKb32/eVALrVzEbDDqVMlMYwo8I8CyujFDoJMkIORxuIp/W Q39aS54dnf3gzhF648Mu8SqN5LLl/7UIV0bVXvNySJOUBg/gN10G7K6Jc+8HM/zOkxN3 bF0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198480; x=1713803280; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFrgk3ObHzsqxaH/8KFZF69wL3qeH2ofBtTk2QJ/G0k=; b=sdLmEIMCydBgT6sPP8yxvR+zI5cfNLjVw/DPCjeXEi9+E1Zpj+YNbY57WMe4ZK3wXc 8JzJ5ScjmY1uxhbJMzs/icBbvcl8kNIbSg5s+o/yVtw4FsY93tBZ/becgQ8HQFcJtQaD MzcS6IM6cVQbgqTMLEJXWMpbyewLmHK0iw0ToE2/7fqAjPDuxH+fEhRzrezAaR2VJTqa 2HqkC4Bd2w6+32xude7tJv+GfQYVJ/jd1KjQberg9kXihvMUNvolTnCBHQgPopxbU09H 4CdrGzNtxxxizbXlrsagEfl6n+d2aXJ0KG8OX/Sz+RLtn/rbk1locagrPsdlHz0q0Uvq EFuw== X-Gm-Message-State: AOJu0YzkuZSXzT/6UUBi7yPlIFaU2Id2NZCbEC0v6/TlR3i6pP8zv07T DjD/ePOgaDq1WXAagdmughsHT7RRmJrWipcZEwEnZCq5On7H0l60LQQSSA== X-Received: by 2002:adf:f352:0:b0:343:81ea:c539 with SMTP id e18-20020adff352000000b0034381eac539mr7985616wrp.28.1713198479860; Mon, 15 Apr 2024 09:27:59 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4348000000b00347c187a3a0sm3899969wrr.24.2024.04.15.09.27.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:27:58 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 17:27:37 +0100 Message-ID: <20240415162741.110374-3-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/6] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ZLZkOKyjsO4R Added in thep previous commit. Signed-off-by: Derek Buitenhuis --- libavformat/http.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libavformat/http.c b/libavformat/http.c index ed20359552..bbace2694f 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -286,6 +286,7 @@ static int http_should_reconnect(HTTPContext *s, int err) case AVERROR_HTTP_UNAUTHORIZED: case AVERROR_HTTP_FORBIDDEN: case AVERROR_HTTP_NOT_FOUND: + case AVERROR_HTTP_TOO_MANY_REQUESTS: case AVERROR_HTTP_OTHER_4XX: status_group = "4xx"; break; @@ -522,6 +523,7 @@ int ff_http_averror(int status_code, int default_averror) case 401: return AVERROR_HTTP_UNAUTHORIZED; case 403: return AVERROR_HTTP_FORBIDDEN; case 404: return AVERROR_HTTP_NOT_FOUND; + case 429: return AVERROR_HTTP_TOO_MANY_REQUESTS; default: break; } if (status_code >= 400 && status_code <= 499) @@ -558,6 +560,10 @@ static int http_write_reply(URLContext* h, int status_code) reply_code = 404; reply_text = "Not Found"; break; + case 429: + reply_code = 429; + reply_text = "Too Many Requests"; + break; case 200: reply_code = 200; reply_text = "OK"; From patchwork Mon Apr 15 16:27:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48072 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp1953341pzb; Mon, 15 Apr 2024 09:28:40 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUGgUc1bdEOFdiYi6wXJgka2EMPmX+IEPVp9Nq8kIUMSF939Frg0JT4LMkWDGp3F8UFGci1uW4A455zaR780FZlRvaKMPjehlxexQ== X-Google-Smtp-Source: AGHT+IHZDLfdlv+QsWny5MOwHn8eMJ354MLv7vGLKbCdNG+KXQlJ2tljhArPrShuiOP3d0XHbFLY X-Received: by 2002:a50:baae:0:b0:570:33b0:ac32 with SMTP id x43-20020a50baae000000b0057033b0ac32mr1366743ede.0.1713198519734; Mon, 15 Apr 2024 09:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713198519; cv=none; d=google.com; s=arc-20160816; b=tHYbf/V7JT1FHPWzzdyA9CTN1YuxvjZxFWd6Hn/93ip3Qfn7+Gkb3ETMqfjTX8oGsy qAovvwtSy9mh0o8iKNRJGYbo1o5Qw922B0WUssue6ECLGw39li9Na2+3lJWnqRhFey6t Z17XdC6hWu61T38SR3AlJdpzwbzM3g0fLL8LwSmaPrn30mHIOBJKWzGFy0f+6ch+3aUo bYlnfHkxq5e72RGAvQg8DpPAl9+HqupTURTjZovfpFmXvjiVAdn9wqpqmlSrXD5ionXx 7+TnKj+MW7twv0P9Lq8hio/lMh2oln9KDPEwnvOryLeUxr09DXINaGHvaHEVZE/oniEe GJZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=cH0d4FLWmY6AMH6e3Eh7cIMBr7c3yrWi72+uVeb9x1c=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=N/vqaiz/sW7VZbOi6aQOuXlkY60Yy57cyqXud5ywaPF8H3r78FUZpKmDFd1eNfk2Y+ hYLx4mwkrklTzgIr80YeJJro9b6F2x7OWBI84oEd2f4bBa8/uREVAzPKcAFlOtRWsWgp 4wHzQBnrag9Aec+3e43AC60CwY7mp3/v+GKVtyL0xAHlUDktIeCRe+shrFdYyu1SBck7 9EFtWm0wHGz84tjJ+XkI0TDndXkc0BgbKC62F5tjF7AyaLBx66wDkpH787BqecGxF+W6 yeMSZ3qBFuBbxKwR9TQHo4C6D9zjkVMih+tAJuNxFPiFDAOlZWXCiXLq2WO3eIj1fws4 kmsQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="l/2eShQO"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id h12-20020a05640250cc00b0056e6601fc9asi4590168edb.469.2024.04.15.09.28.39; Mon, 15 Apr 2024 09:28:39 -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 header.s=20230601 header.b="l/2eShQO"; 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=QUARANTINE 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 0E00C68CECF; Mon, 15 Apr 2024 19:28:10 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 282E068CB86 for ; Mon, 15 Apr 2024 19:28:02 +0300 (EEST) Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-345b857d7adso2569654f8f.1 for ; Mon, 15 Apr 2024 09:28:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198481; x=1713803281; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=14hfzgm4/+7TNbrCrIPJlFtaOe+A7suYHw2xrSypk2I=; b=l/2eShQO4YshKpXpJit9sSZjDje4ooANUGA9bq6e1I8+uwF4iSaPKLyXFFUrpam3wu EdLRjGSBCIuBkfopnoGJfj/cXHu8MU6MWuUD/UneqPRVECsBbOLXCkIfzjeQ5M3Cp71T QURnDkJjbn28+j2v491QG9e7HgHcNQXpdt6VCdZoEbRUOyYC1EqBJEB5R2suP7wtb4sN ZJV8JKEt08Nlt0MEtYq6pJwqia7WYhTr+MnsFN3URwb+2EaRQa0poRMcUW554xiNlJ7N TYjIDLMRETTQo1KOm+OszJWqI5+WKNZvrkut/l7DCCZ64/tF0dleHGc//NPqZ0PLmxsh NNsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198481; x=1713803281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=14hfzgm4/+7TNbrCrIPJlFtaOe+A7suYHw2xrSypk2I=; b=p76oc8aK6/U1SZW2cf8jtQeFLFV9yx1g3VizoXIYreJ4vxjbxZpkdc4EV9/inZJma/ ZDE3HNNYuD8iSlT8lzNUtW3csXULP1c45n81Vps6ACU18j4+7RquPfe2TrNG0XOZv1Vj OneM7QrLXxT184OV9TBR53S+E5cSBiuqq0s9JG7Sih0RO2Zy+h9is5oa9MIoWijTlcTX XY0MBIZ+BQgkjisp+eGFYpYZumfYU+tk0WtVCshJGK3s3cS5m0LNv55tdXa5MCsD5kwr dJaslbnRPcSy4wa6n4RjFOhUmmfzJWbLaWEQ+g5v/BmI5LwZy1T4b5TUjos251t05ut/ /Tzw== X-Gm-Message-State: AOJu0YzKrC8u9PY0GwpUD5Y/7epH7tCcAj9A3icVVsjPFOhVbJUSu44N Ual8iLNCzhdcAp2gWJbvRKkdMJA98WDJyBhXqqMN7wkXAfBk8ta9cTZ0GQ== X-Received: by 2002:adf:e349:0:b0:346:9301:fef1 with SMTP id n9-20020adfe349000000b003469301fef1mr6887415wrj.18.1713198480721; Mon, 15 Apr 2024 09:28:00 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4348000000b00347c187a3a0sm3899969wrr.24.2024.04.15.09.27.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:28:00 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 17:27:38 +0100 Message-ID: <20240415162741.110374-4-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] avformat/http: Don't bail on parsing headers on "bad" HTTP codes X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: KqWyScbQfsv0 Many "bad" HTTP codes like 429 and 503 may include important info in their headers. Also, in general, there is no purpose in bailing here. Signed-off-by: Derek Buitenhuis --- libavformat/http.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index bbace2694f..e7603037f4 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -1086,7 +1086,7 @@ static void parse_cache_control(HTTPContext *s, const char *p) } } -static int process_line(URLContext *h, char *line, int line_count) +static int process_line(URLContext *h, char *line, int line_count, int *parsed_http_code) { HTTPContext *s = h->priv_data; const char *auto_method = h->flags & AVIO_FLAG_READ ? "POST" : "GET"; @@ -1166,6 +1166,8 @@ static int process_line(URLContext *h, char *line, int line_count) av_log(h, AV_LOG_TRACE, "http_code=%d\n", s->http_code); + *parsed_http_code = 1; + if ((ret = check_http_code(h, s->http_code, end)) < 0) return ret; } @@ -1338,7 +1340,7 @@ static int http_read_header(URLContext *h) { HTTPContext *s = h->priv_data; char line[MAX_URL_SIZE]; - int err = 0; + int err = 0, http_err = 0; av_freep(&s->new_location); s->expires = 0; @@ -1346,18 +1348,31 @@ static int http_read_header(URLContext *h) s->filesize_from_content_range = UINT64_MAX; for (;;) { + int parsed_http_code = 0; + if ((err = http_get_line(s, line, sizeof(line))) < 0) return err; av_log(h, AV_LOG_TRACE, "header='%s'\n", line); - err = process_line(h, line, s->line_count); - if (err < 0) - return err; + err = process_line(h, line, s->line_count, &parsed_http_code); + if (err < 0) { + if (parsed_http_code) { + http_err = err; + } else { + /* Prefer to return HTTP code error if we've already seen one. */ + if (http_err) + return http_err; + else + return err; + } + } if (err == 0) break; s->line_count++; } + if (http_err) + return http_err; // filesize from Content-Range can always be used, even if using chunked Transfer-Encoding if (s->filesize_from_content_range != UINT64_MAX) From patchwork Mon Apr 15 16:27:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48073 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp1953431pzb; Mon, 15 Apr 2024 09:28:49 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVIxLkwHQaofRrtzvWNKTkaW510HynFdVlMwkqoZaIApo4Zu9mgqBMu9mbf3+dlggabo5ONCe9HRp7TUShTmANnjPml6uFjTroQEg== X-Google-Smtp-Source: AGHT+IGwprJoTekzBQXBmYSzeptHgQQMWfqRTTle1EuifUuoTYu69dRQ3ab6gV1g9MhtrcKNPKp7 X-Received: by 2002:a50:d486:0:b0:56b:d158:c5de with SMTP id s6-20020a50d486000000b0056bd158c5demr6816815edi.16.1713198529197; Mon, 15 Apr 2024 09:28:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713198529; cv=none; d=google.com; s=arc-20160816; b=e1s3nO5E6ZnlIwWD52NhKrbj/G5AUAeMsKPd0dKnb7PBk0Tji8Wcz0xOjNXM49Qkrw +1QYyTJ8hHPGEfPIUv5y84uEH+Ug4pmQw7SPQ0DfZwmgXdRU2Ze/oLjlBG2UEuFPeHr3 dyBgYCl3wcSQjvMvH/X6FDPN8jOw39fiIBrfPLl8m7LZlVCSDItkEV6l4Zzj2s8thelO JGs0eWx8XOchRcSS16asICV8NQVG7fMPgK3hFK7zMh0pwXJzpWtT0FMIOHFm6ZzeSDMp oBxvgnl/xTzf9ADoE9hCZOkkUVB1c0Ub6q335hNwG7Mwv+ehV39SLUupbtBct4n1T9Je J+Yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=tEmj8i/CUQUAEjbRscKcu4lgM7N6uQkynZzxFXPyoWs=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=grTPOrq/OJ3yZ7iIld34xUvBeokBRa0frk9Ut3PAYjvLRrxafuWsaDiJ7osX1X/UQ0 rhTKL02Uu5AjHw++WFy8hcr1EG+LmlXMG8yvDdSyykA+rFSEIKAvMJgni+rXI7LBeWFg YGEcsjsFQNwveLLCtSSj7g3LPmXi7jPNkPS0WxNifUp7abiWIyKnYy/z5bMbpyn32Zfu +wa2MpSz9rl4y9TqCXEEtd/1LYeDnNnvAGwEhiLML2Mzfu3iP858gacPt/YW5yBSL0LF TM6VRGSzzTvnicahj3bXFQ8P3mGEohzo5UZdvQTT1kgHe1ycUE4htvhu8QBRg2tmB07k Tjtg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=cXWQ5R0D; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id z22-20020a05640235d600b0057022d5f466si1525474edc.498.2024.04.15.09.28.48; Mon, 15 Apr 2024 09:28:49 -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 header.s=20230601 header.b=cXWQ5R0D; 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=QUARANTINE 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 2A0C768CE03; Mon, 15 Apr 2024 19:28:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 174EC68CCBC for ; Mon, 15 Apr 2024 19:28:04 +0300 (EEST) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-343c2f5b50fso2574556f8f.2 for ; Mon, 15 Apr 2024 09:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198482; x=1713803282; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=EXJsIPBlk9FSxjEka/F0Of9+8Jtj4GrRpSmFn8sVkig=; b=cXWQ5R0Dx/y0K/jvY5KV83dQrvZjE3yWI6iOt+Bi4jbsV8sN0VDkIqH0qhYoKAitjz MYFg7HEjaL6e3XFNO716P9oajJU3pDKXPNpx2pyroAnBkUljTU890lrWKTCkbri7FRPy wbgz0XzG8XL7kBYk5GPUkIE1Yjmg0ix2J9a97fybklulfVMxp2TM7aWSqFayw8GVrngQ 7Eyd/2Du6KsE9QxT30MFOh7hKKDlV0lTAL1JWQt93xN2sNbiIeZL8D0soNYcXaWymE2L RrxVVRyEBZrVnZptBq2zJIuapGa/oYDyxvZxMSR/Jrn8NwMlyNiGJ1wZkJXTC54ljFSx d8aQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198482; x=1713803282; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EXJsIPBlk9FSxjEka/F0Of9+8Jtj4GrRpSmFn8sVkig=; b=DepxZDtNYx0TfyyruPtNerhlv3qd9TEqjApfzOOollLcW0k+TtXf55AxrsOce14RyH mdb9Pl2+aTnC5dKzBy7CeyeYxAQ2UpPy2hIh2G0CHpeVT/HqrtIKzTDgHlEC1s+vPfm2 5Qo2m+s6uj+nlmYj7HTGP+URkRqP8ZMzuxMUpEGMe/oUNTzQnRNJvZGalC9Kjiw5mMBQ 8CwMZffPbksXhUOaOHz6AVSJsZV363wgxJFHZ+wI5P4CKDVzsBCdoB0mhz/DYgd3MIJV LlIoT3o+VYOoE8D0LKkmJYkWPRC2FlfW231v+n3kYoE3k1bnMS2kdGWiP7+uH4GPF64o 7HPA== X-Gm-Message-State: AOJu0YzpZ3tRd1LT0+31xrk2+5ymIoGJFdIUo/o43TuL4KpDTLgJszfk h2+0dtwVHAa6o26EzGelogbZ7TOISpkrNajYk+yheLG1/c8i+3ZmfWD9eQ== X-Received: by 2002:a05:6000:1849:b0:346:ba70:7d8f with SMTP id c9-20020a056000184900b00346ba707d8fmr8770086wri.45.1713198482345; Mon, 15 Apr 2024 09:28:02 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4348000000b00347c187a3a0sm3899969wrr.24.2024.04.15.09.28.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:28:01 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 17:27:39 +0100 Message-ID: <20240415162741.110374-5-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 4/6] avformat/http: Add support for Retry-After header X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: rj5dLKwimqWB 429 and 503 codes can, and often do (e.g. all Google Cloud Storage URLs can), return a Retry-After header with the error, indicating how long to wait, in seconds, before retrying again. If it is not respected by, for example, using our default backoff stratetgy instead, chances of success are very unlikely. This adds an AVOption to respect that header. Signed-off-by: Derek Buitenhuis --- libavformat/http.c | 12 ++++++++++++ libavformat/version.h | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/libavformat/http.c b/libavformat/http.c index e7603037f4..8f092f108d 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -138,6 +138,8 @@ typedef struct HTTPContext { char *new_location; AVDictionary *redirect_cache; uint64_t filesize_from_content_range; + int respect_retry_after; + int retry_after; } HTTPContext; #define OFFSET(x) offsetof(HTTPContext, x) @@ -176,6 +178,7 @@ static const AVOption options[] = { { "reconnect_on_http_error", "list of http status codes to reconnect on", OFFSET(reconnect_on_http_error), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D }, { "reconnect_streamed", "auto reconnect streamed / non seekable streams", OFFSET(reconnect_streamed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, D }, { "reconnect_delay_max", "max reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_max), AV_OPT_TYPE_INT, { .i64 = 120 }, 0, UINT_MAX/1000/1000, D }, + { "respect_retry_after", "respect the Retry-After header when retrying connections", OFFSET(respect_retry_after), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, D }, { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, { "reply_code", "The http status code to return to a client", OFFSET(reply_code), AV_OPT_TYPE_INT, { .i64 = 200}, INT_MIN, 599, E}, @@ -386,6 +389,13 @@ redo: reconnect_delay > s->reconnect_delay_max) goto fail; + if (s->respect_retry_after && s->retry_after > 0) { + reconnect_delay = s->retry_after; + if (reconnect_delay > s->reconnect_delay_max) + goto fail; + s->retry_after = 0; + } + av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRIu64" in %d second(s).\n", off, reconnect_delay); ret = ff_network_sleep_interruptible(1000U * 1000 * reconnect_delay, &h->interrupt_callback); if (ret != AVERROR(ETIMEDOUT)) @@ -1231,6 +1241,8 @@ static int process_line(URLContext *h, char *line, int line_count, int *parsed_h parse_expires(s, p); } else if (!av_strcasecmp(tag, "Cache-Control")) { parse_cache_control(s, p); + } else if (!av_strcasecmp(tag, "Retry-After")) { + s->retry_after = strtoull(p, NULL, 10); } } return 1; diff --git a/libavformat/version.h b/libavformat/version.h index 7ff1483912..ee91990360 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFORMAT_VERSION_MINOR 3 -#define LIBAVFORMAT_VERSION_MICRO 100 +#define LIBAVFORMAT_VERSION_MICRO 101 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ From patchwork Mon Apr 15 16:27:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48074 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp1953504pzb; Mon, 15 Apr 2024 09:28:59 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUjLNTPmoAs+wd0gYyOgV+YJL+c9sVwDYmjPWJYsMWhVCwIY9B3eYT/ADI9D1c/KVSPI1jUqwbgUDBvP+q8CVD2EhyKCOQ37hiiHQ== X-Google-Smtp-Source: AGHT+IFk69A3TLN0/xEJDRFK6mnCghqimmKnZQ+vYMjHZbwwMm2z3zbnMCH/hdw4O5RYWSwqAYvS X-Received: by 2002:a17:907:94d0:b0:a52:28f:5e61 with SMTP id dn16-20020a17090794d000b00a52028f5e61mr8981956ejc.27.1713198538708; Mon, 15 Apr 2024 09:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713198538; cv=none; d=google.com; s=arc-20160816; b=pORt44L9Tgy2BL0l6hZDN6CK2SB9gNwxmGHeoVvtx1a68naXAQCnfgy2zCfS2b/b5g UUfrSNhWrvrVWo2mFTaoz7aBj/KiYrdyJbW1bkW+3iPZlxm9e+6VDTE7LhUKVxvxtQ1+ iCEr+Kval+vgXT6nzve99p35qp66wZ7lEui5zS8tUBCmlGscaBD4KjXensUT8fEIEQ5M cpaDCM+xHzxhzu1WMTpu8wiN0SA+8PjMOZZeOasMkDubOsPiaCLFNIwPneooAZeCBtHX SOHJCA8GNduvhNdRvE0BFwWzFWvEBrboRNXYYF3eEFksPmVYAeYOkBGm19dvSgn+bq3f UTHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=gp+W5HGern95Kms76MKrSQ+TnHb9/ajmiRQu4UcoU3k=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=gC4W9eyHXXaNfuXzHx9QOMB5OyzpEQyBesqyKye3kuYqZjq3TYIGYo2YH2l7186ST0 dA+0wudgrW4ZoOlPSBs0nB33J7SGrF59SC4dlbIz+s4ZefmhVAN8Ik101YgpAHFBKDhF b1YBCbfcOCjXAUUY9JlPCwdpviW8tZxM9xzYkHyhGUFjJjdY6hvoRGxs0HH0okJec3nP +byYCKNdCOI6rt0Cz/d2pJKp8hes0l1hPM9EmoT2sY+ygg8ESOOVx0ClFVh4digZLQ6D SRViy4HK4b6RxQ0n63pi/1kTFRC8le8V1pAt5Tc2psRU4/Tcm2FraS2HQAU3YmH7suSP /gaQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=SPvjDs+w; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qw40-20020a1709066a2800b00a518fdd3dc1si4920081ejc.110.2024.04.15.09.28.57; Mon, 15 Apr 2024 09:28:58 -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 header.s=20230601 header.b=SPvjDs+w; 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=QUARANTINE 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 500ED68CFC8; Mon, 15 Apr 2024 19:28:13 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 86FE268CD49 for ; Mon, 15 Apr 2024 19:28:04 +0300 (EEST) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4182353a15cso12115415e9.1 for ; Mon, 15 Apr 2024 09:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198483; x=1713803283; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=FhwQ9WqRnnPsqwZ/jKhnCQBxcORgCmjmOPvABXYH89w=; b=SPvjDs+wddSHu+L+ZUGg4dJanxl1qZNY3azyzm8BS4sEZRyISV0G/q+Qt6cek3CRdA ygvhZZCYghA9YGf67+zI+RA9FB8CxZdhZBsXlH7QFlYk/Id46wNqD9Gj478rgCHTHd4R FWeypFN1fV+GOPkdAQ1QM/3Ss0vaViP0uiJXMZl85Zc27PQvOq7ZpOWGvzP4+ButkRPS oQz7nhl7pBA912JMDfsaSCjN74M+TsN6juVYYPHK4k7F+oeVt9Tr2iR+VPEEvfVxoXQt I3uiL82K/cBI1L4EQd9D6RwMqSvBm04DOt7HTgJbYuQf7BWJm6wdevofaQnub9wWk2F9 kKvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198483; x=1713803283; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FhwQ9WqRnnPsqwZ/jKhnCQBxcORgCmjmOPvABXYH89w=; b=teUEAKnRrSC5VoaqWkjHpHa//Rqh8GvpjHKu1O2ue8DV24RQ3RyoMcMT7HPK15BfBI dfR+OCLABpt2E85nQuCBlWCjSAXmVhfd436vxmQsJ1o+Az4Ct1Jtr++uUPX0GdF+CCzU sAN+z3Kkk4sWxnRLKZ99QFp2B8tCigoNj4PY2GcAYzyfpyXUM6vgdAZKBD8ZZ3flhSdr +PPdai+eGOq4QtulpJMGku0zMWyBpJ5hTau3+VCAcfyKxX4tiVrFu9wh66AlX5uaCfro l6bIFbiSTykcyIw0JPc6Q0AD2L6D8FMNPSdbgzDYrCx/OkTsaP7PLfgTC/lrTmLcQHQZ Nwfg== X-Gm-Message-State: AOJu0YzuZ/YII5TDRcpalBJYYLpXu8sAWWjyXLsKVUTadk4vBosYmLfD l2ehBzAY488H6FUhJVQ5Ru3uMmi05nXdOnp1+DBR7rvPcFEQsO/vcctsXA== X-Received: by 2002:a05:6000:4c:b0:33d:d7be:3bec with SMTP id k12-20020a056000004c00b0033dd7be3becmr8114318wrx.58.1713198483181; Mon, 15 Apr 2024 09:28:03 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4348000000b00347c187a3a0sm3899969wrr.24.2024.04.15.09.28.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:28:02 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 17:27:40 +0100 Message-ID: <20240415162741.110374-6-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 5/6] avformat/http: Rename attempts to auth_attempts X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 4gFmbhIN6B1m This accurately reflects what it does, as per e75bbcf493aeb549d04c56f49406aeee3950d93b. Signed-off-by: Derek Buitenhuis --- libavformat/http.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 8f092f108d..ce1af5f976 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -359,7 +359,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) { HTTPAuthType cur_auth_type, cur_proxy_auth_type; HTTPContext *s = h->priv_data; - int ret, attempts = 0, redirects = 0; + int ret, auth_attempts = 0, redirects = 0; int reconnect_delay = 0; uint64_t off; char *cached; @@ -409,10 +409,10 @@ redo: goto redo; } - attempts++; + auth_attempts++; if (s->http_code == 401) { if ((cur_auth_type == HTTP_AUTH_NONE || s->auth_state.stale) && - s->auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { + s->auth_state.auth_type != HTTP_AUTH_NONE && auth_attempts < 4) { ffurl_closep(&s->hd); goto redo; } else @@ -420,7 +420,7 @@ redo: } if (s->http_code == 407) { if ((cur_proxy_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && - s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 4) { + s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && auth_attempts < 4) { ffurl_closep(&s->hd); goto redo; } else @@ -449,7 +449,7 @@ redo: /* Restart the authentication process with the new target, which * might use a different auth mechanism. */ memset(&s->auth_state, 0, sizeof(s->auth_state)); - attempts = 0; + auth_attempts = 0; goto redo; } return 0; @@ -2082,7 +2082,7 @@ static int http_proxy_open(URLContext *h, const char *uri, int flags) char hostname[1024], hoststr[1024]; char auth[1024], pathbuf[1024], *path; char lower_url[100]; - int port, ret = 0, attempts = 0; + int port, ret = 0, auth_attempts = 0; HTTPAuthType cur_auth_type; char *authstr; @@ -2142,10 +2142,10 @@ redo: if (ret < 0) goto fail; - attempts++; + auth_attempts++; if (s->http_code == 407 && (cur_auth_type == HTTP_AUTH_NONE || s->proxy_auth_state.stale) && - s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && attempts < 2) { + s->proxy_auth_state.auth_type != HTTP_AUTH_NONE && auth_attempts < 2) { ffurl_closep(&s->hd); goto redo; } From patchwork Mon Apr 15 16:27:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48075 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:670b:b0:1a9:af23:56c1 with SMTP id wh11csp1953584pzb; Mon, 15 Apr 2024 09:29:07 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXhp+lJ74TVpdbtIcCPI9lk5et+zFxRLDVSTWL/Ik3KTU5UgXmpJxzMA9NH0ciEYRJld8LOFqoseACvl86yMvvHhkCk8tUpz26SKw== X-Google-Smtp-Source: AGHT+IHyjqhWFoQ0VVNQigL4JtfYdwLRaZT+14BLODXyhM/tar6o5ZV89X4WfYGi3utPQWv69emE X-Received: by 2002:a17:906:33cd:b0:a54:c11b:527c with SMTP id w13-20020a17090633cd00b00a54c11b527cmr1120281eja.4.1713198547268; Mon, 15 Apr 2024 09:29:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713198547; cv=none; d=google.com; s=arc-20160816; b=u1L7gGAE3bTqXgkw0YNC+VkDFHD4Q8M2rYu8cADjN0cFhZ26yze+57dr88vVp/LSAN og9rm7mPm1W+Bz0WCXihq1RKthjcxWmCEtIz8HIKtWu9td1s3UUH/OUBqsHXk8klGMDq cYeMb9U2xX/K67Gp0oNDRg5Pb+RcEUgge0bpiqEVHHyivNaT4gkKsWJBeKW+/kGiEcX1 sUgh1peuuukNoDkB4yx22B3swZPt/Kxd5UEAr0FCqY5y+k5t3Y3ixscYJSQwnj8uDIQ2 ZbNBoSIZz2mgmC4zCV3bWfRDI8aSfEITk7iK5ZnwguNsL60shGOF+P7t7dGFbAGSMDXd KRJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=TZb7uon8sUceOzu0PQ2B5lOBBIxPb1E+MGeehI2jCWk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=y/WRd1iWYirMi3wuaLf2XFaFEBJAWdT5vb6EGiaCxEMSxIfajU8GJQol0Rhuh2o9Ow k2i70C2DvOx9RtYDgGpiQYZuVjXqQWb9RB8NchHSDdqOE4nHT1d2G1j5efRtIZM/oqMo d1AQhzLJ5D0jsZnvGOQZ6mbsRPqSpZaBC7z0AbO1b8tx60ERJG/HwSFk3D7e1Xj59FVl A8aEd3Y4UezO+JMOix8c2qA3/weqZcWdUgTNYsIAmXEr89y/CJYeNE1x1hAV97P8nves FLhXSD6NHEQkkjaxpPjL38t5TnOmGjMxtc0M6y0z6M3wpNJtmK1Lb6HweWV9V5Z+EIwO F4nw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=UyUZQxAq; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id sh40-20020a1709076ea800b00a520030ee61si4836722ejc.589.2024.04.15.09.29.06; Mon, 15 Apr 2024 09:29:07 -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 header.s=20230601 header.b=UyUZQxAq; 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=QUARANTINE 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 A9E6E68CFFC; Mon, 15 Apr 2024 19:28:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BDBAE68CEEB for ; Mon, 15 Apr 2024 19:28:05 +0300 (EEST) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-34388753650so1533193f8f.3 for ; Mon, 15 Apr 2024 09:28:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198484; x=1713803284; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=qsI0AmdQATqQYPSStwzeYmrQTZgiR70lZUOHvEloT/4=; b=UyUZQxAq8Ay1ozETJu5XsiOaJ7yYaSLTt7xgDGduxGNtUFoQrf0eTb7P6iVlne/IRD 6rU06f9z0Kr89VJi5MuKRnyvy3JdH4++clryW5KsdNDYuEyxpXIaYOwDSU4MRdlYQLiK OG7BJDr+IvoYgB2WNMbGtG1TZGtF4QDK0BoRAuQVBgfDzKeNvgtLbbSngOt5n1t50awH WOUBz8Ib04h6jCBER0g1Luz4u85gFV9NqyYg18szQUbjrAKguCzhVmebIQbsNVYbFdeL 6WEWqAj4+ckPyex/TjnreMSNsMqLYLg/25+2TVFrLAMTCsTEL/+FBzgrC3Kd6JOY5gC2 5/Xw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198484; x=1713803284; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qsI0AmdQATqQYPSStwzeYmrQTZgiR70lZUOHvEloT/4=; b=meJ+S9fDiyb568CHRncGlvgTcUnVHcqyCnqe/RC5tlDPzRpNX9bWUqzO5kuDsmEtUR sty2DmkSW8RR2jHDtJEKtxhj3IhRrU1mIMp5WgxNRFNtKl5eMGtMSqaFFCwcH7UmBOct rXVj4By6dVQQv67CuuofxxS6OUul2rIPv86lvTSPdgsJUP2nM+lowwGzeD6pAu7Xvw1y IvAqUXWPS9Mnx3nANbaYYcOk7sS2/jd4nCHtWNohG0PAwFa7A7l5t+cr4TSsGckZQXav IWJkq9IxNkTBafISPprjIWp7n554ehACXIHI+3nz9Pj74D7rhpEqVnRPHPu+h0+43qad c/UA== X-Gm-Message-State: AOJu0YyNW7099PMAvC3E7S0lafRLqf5e4btoHRTlEcxQbRwKNmmThGe2 aean87dI+rKHuqG5bU1rQGpxb51C6q2dsZ6FBX4L8zcqPOW/Hm3ADgDPTA== X-Received: by 2002:adf:e286:0:b0:347:9bec:9ba3 with SMTP id v6-20020adfe286000000b003479bec9ba3mr2847015wri.66.1713198484622; Mon, 15 Apr 2024 09:28:04 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id u8-20020a5d4348000000b00347c187a3a0sm3899969wrr.24.2024.04.15.09.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:28:03 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Apr 2024 17:27:41 +0100 Message-ID: <20240415162741.110374-7-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 6/6] avformat/http: Add options to set the max number of connection retries X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: OuuQCQHhqyar Not every use case benefits from setting retries in terms of the backoff. Signed-off-by: Derek Buitenhuis --- libavformat/http.c | 12 +++++++++--- libavformat/version.h | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index ce1af5f976..009536901a 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -140,6 +140,7 @@ typedef struct HTTPContext { uint64_t filesize_from_content_range; int respect_retry_after; int retry_after; + int reconnect_max_retries; } HTTPContext; #define OFFSET(x) offsetof(HTTPContext, x) @@ -178,6 +179,7 @@ static const AVOption options[] = { { "reconnect_on_http_error", "list of http status codes to reconnect on", OFFSET(reconnect_on_http_error), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, D }, { "reconnect_streamed", "auto reconnect streamed / non seekable streams", OFFSET(reconnect_streamed), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, D }, { "reconnect_delay_max", "max reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_max), AV_OPT_TYPE_INT, { .i64 = 120 }, 0, UINT_MAX/1000/1000, D }, + { "reconnect_max_retries", "the max number of times to retry a connection", OFFSET(reconnect_max_retries), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, INT_MAX, D }, { "respect_retry_after", "respect the Retry-After header when retrying connections", OFFSET(respect_retry_after), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, D }, { "listen", "listen on HTTP", OFFSET(listen), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 2, D | E }, { "resource", "The resource requested by a client", OFFSET(resource), AV_OPT_TYPE_STRING, { .str = NULL }, 0, 0, E }, @@ -359,7 +361,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) { HTTPAuthType cur_auth_type, cur_proxy_auth_type; HTTPContext *s = h->priv_data; - int ret, auth_attempts = 0, redirects = 0; + int ret, conn_attempts = 1, auth_attempts = 0, redirects = 0; int reconnect_delay = 0; uint64_t off; char *cached; @@ -386,7 +388,8 @@ redo: ret = http_open_cnx_internal(h, options); if (ret < 0) { if (!http_should_reconnect(s, ret) || - reconnect_delay > s->reconnect_delay_max) + reconnect_delay > s->reconnect_delay_max || + (s->reconnect_max_retries >= 0 && conn_attempts > s->reconnect_max_retries)) goto fail; if (s->respect_retry_after && s->retry_after > 0) { @@ -401,6 +404,7 @@ redo: if (ret != AVERROR(ETIMEDOUT)) goto fail; reconnect_delay = 1 + 2 * reconnect_delay; + conn_attempts++; /* restore the offset (http_connect resets it) */ s->off = off; @@ -1706,6 +1710,7 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size) int err, read_ret; int64_t seek_ret; int reconnect_delay = 0; + int conn_attempt = 1; if (!s->hd) return AVERROR_EOF; @@ -1734,7 +1739,7 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size) !(s->reconnect_at_eof && read_ret == AVERROR_EOF)) break; - if (reconnect_delay > s->reconnect_delay_max) + if (reconnect_delay > s->reconnect_delay_max || (s->reconnect_max_retries >= 0 && conn_attempt > s->reconnect_max_retries)) return AVERROR(EIO); av_log(h, AV_LOG_WARNING, "Will reconnect at %"PRIu64" in %d second(s), error=%s.\n", s->off, reconnect_delay, av_err2str(read_ret)); @@ -1742,6 +1747,7 @@ static int http_read_stream(URLContext *h, uint8_t *buf, int size) if (err != AVERROR(ETIMEDOUT)) return err; reconnect_delay = 1 + 2*reconnect_delay; + conn_attempt++; seek_ret = http_seek_internal(h, target, SEEK_SET, 1); if (seek_ret >= 0 && seek_ret != target) { av_log(h, AV_LOG_ERROR, "Failed to reconnect at %"PRIu64".\n", target); diff --git a/libavformat/version.h b/libavformat/version.h index ee91990360..41dbd4ad01 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ #include "version_major.h" #define LIBAVFORMAT_VERSION_MINOR 3 -#define LIBAVFORMAT_VERSION_MICRO 101 +#define LIBAVFORMAT_VERSION_MICRO 102 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ From patchwork Tue Apr 16 13:55:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48088 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp376479pzb; Tue, 16 Apr 2024 06:56:18 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCViLzFujB/Ac9KJgMWb4aggV95a0nzNuzrhKIPbr+iPx2vJANQL8NXJvuzQSHnFqol6pSiNDbykhMY3M5sGrlJt9HjfyUxCxkeQSA== X-Google-Smtp-Source: AGHT+IHJgdWsoe9Nf9ikA9w0XxNilvkiCw6q9h0lm6wY52KaM7cKEp5gnTzcfWWghv0BjQb8QHqV X-Received: by 2002:a17:906:3847:b0:a52:1432:b790 with SMTP id w7-20020a170906384700b00a521432b790mr7425943ejc.31.1713275778258; Tue, 16 Apr 2024 06:56:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713275778; cv=none; d=google.com; s=arc-20160816; b=t05F4+hnCDqOr543QrulN83LLdFKJ57Y0+NMnb7T7h7yeMMJRreBuuMX29XzBDO5Zh 2OwEgIsajCyTNgti17wAYk49o8RFsC9ZncqxO8yb4soE9CNMN4ZRstEW5uprsRyz6w+J hDyxYc22E3QQtU6VlXaHO0WhMoXEAvZbgAdYMTgEtm1TZ8iaHQx3/SOm3xB6/XziqPd3 BNV1UPnl+icBOzpzXdriGfaxPZO4/sx9S3WmRAXKA2lXglTP9iKaG/IVGiztdPJZ83Ln w6skocBdqgVJFc6/Ial13Rv6qd7LXraJ6ggKuVjHRldeTEqiV8mRh8+QD/FaRi5LIoxT zkGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=TKhLVkCwvS7iFf2K8ZFxlYHPa9dhzLgfGFwfktMAhQk=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=wDf8HkIkXoIIVw+Y5GyUCGKpv9nZn1TuBQ5J5XN0ziAVJQnaEc7vf9PV1ZokmvVipe 2j2MV1rJtW76luTXzUTrciQhoW50wo9w4Njk/isjtIyDqgShX+bABdrLp3gbhJ32lDB/ JVje1Pko3+mRLhvnL51lU7JW9xbHczWfwDuW5eSsMLAujvZyo+2XrSLhZB9x/PtWcVeU 7Lem6j7MWYm2XekLLq+Z0RUR7zK06MlMsizof01zWkJVRQVd0tpHjoLm/3SACsfMCBVa M4fhJzu1utEpHTtHHnnVsXn78oBiDJ+HmHnetFtGgiPhb0abw6vMU8xA02S4IkPhuA/u nQrw==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b=J6f+9VGx; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id n20-20020a170906089400b00a52043a25casi5760420eje.955.2024.04.16.06.56.17; Tue, 16 Apr 2024 06:56:18 -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 header.s=20230601 header.b=J6f+9VGx; 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=QUARANTINE 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 57CAE68D244; Tue, 16 Apr 2024 16:56:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1DAC868D0B1 for ; Tue, 16 Apr 2024 16:56:08 +0300 (EEST) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4187981999fso10864265e9.1 for ; Tue, 16 Apr 2024 06:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713275766; x=1713880566; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=q05V2PXSnPPzq+j4F3+JmFGWAq49v8LVqzulBOz+VzU=; b=J6f+9VGxegN/SgswL25NINrObnQ3EvngIuHmJHUpbxg8PhwBBUpLj8AC2ZWO09ahN3 A0Jly3h7AOsjmjekZi63xOkhjqyEO9Pct37a0UHt1eO4KH2Eibbu0bA0hIe5rJUIW0wK 4bvSScr5OOfmTm7RaS2YbBJSEX03npaMlhfJkvobXtUjQhYq9/Q6dIRh9gIDff7W5zHC dOsymL/UdgwGHfnkhaJBJ6C6i9sWGPgNMLdMjkQZUl+p6H/9NdCd9MgtpJNPKJjkz+mT e63i46FrquuqqqBx2rQT7hOpb+GCjaemMbgkbugca/4i/80b8MmEw2eTIYwqMh4cReDR 1E5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275766; x=1713880566; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=q05V2PXSnPPzq+j4F3+JmFGWAq49v8LVqzulBOz+VzU=; b=ijEYeeO5AL1+X7skUUZRaXXktr8shr6fXOB+v83HQaGS/D+7dnbLtOTOU3ahJmNtNM kHof9+n/DXw77+ONVy6hey+qKTR8Nd3YU/Jk/B/4644s16v5HarC6meEUZ0MYnW8WMK8 MfRj8ldHccXb8cNUkYWJoojbcKnE06uzC7r51xt1lkxoqz15mQzz/wC2yUjv6OxN8/s9 +T0qNE3jUREZvLrBZEY2rYAVvWNUubDGDU1uvuDM3v4fKouyaV9+EzJtg8qYLVcO9SdT 8emcU+V+s4Hi0f2UpIm9IfIKFb8dg1iH5PcKY0yihldUq1FI89AhoQoxPkk2RPZUT4/s vXdg== X-Gm-Message-State: AOJu0YyWGh52d5Bwq6s8glFEMe6BdXIuQaGxCFjByQcd9a6ua1n+O6m1 K+OjLQxoqTNxwattJG++BiC8ttrPYHmIdA7tvU41buDD14zmuRNZIHFcZA== X-Received: by 2002:a05:600c:1c14:b0:418:95a1:1975 with SMTP id j20-20020a05600c1c1400b0041895a11975mr1374675wms.20.1713275766243; Tue, 16 Apr 2024 06:56:06 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id s14-20020a05600c384e00b0041892857924sm2599677wmr.36.2024.04.16.06.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 06:56:05 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Apr 2024 14:55:54 +0100 Message-ID: <20240416135555.111773-1-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240415162741.110374-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 7/6] doc/protocols: Re-order HTTP options to match http.c order X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: 24VqTAEDXHQd This makes the list easier to maintain. Signed-off-by: Derek Buitenhuis --- doc/protocols.texi | 112 ++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index f54600b846..5ce1ddc8f4 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -442,9 +442,6 @@ value is -1. @item chunked_post If set to 1 use chunked Transfer-Encoding for posts, default is 1. -@item content_type -Set a specific content type for the POST messages or for listen mode. - @item http_proxy set HTTP proxy to tunnel through e.g. http://example.com:1234 @@ -452,35 +449,21 @@ set HTTP proxy to tunnel through e.g. http://example.com:1234 Set custom HTTP headers, can override built in default headers. The value must be a string encoding the headers. -@item multiple_requests -Use persistent connections if set to 1, default is 0. - -@item post_data -Set custom HTTP post data. - -@item referer -Set the Referer header. Include 'Referer: URL' header in HTTP request. +@item content_type +Set a specific content type for the POST messages or for listen mode. @item user_agent Override the User-Agent header. If not specified the protocol will use a string describing the libavformat build. ("Lavf/") -@item reconnect_at_eof -If set then eof is treated like an error and causes reconnection, this is useful -for live / endless streams. - -@item reconnect_streamed -If set then even streamed/non seekable streams will be reconnected on errors. - -@item reconnect_on_network_error -Reconnect automatically in case of TCP/TLS errors during connect. +@item referer +Set the Referer header. Include 'Referer: URL' header in HTTP request. -@item reconnect_on_http_error -A comma separated list of HTTP status codes to reconnect on. The list can -include specific status codes (e.g. '503') or the strings '4xx' / '5xx'. +@item multiple_requests +Use persistent connections if set to 1, default is 0. -@item reconnect_delay_max -Sets the maximum delay in seconds after which to give up reconnecting +@item post_data +Set custom HTTP post data. @item mime_type Export the MIME type. @@ -488,6 +471,11 @@ Export the MIME type. @item http_version Exports the HTTP response version number. Usually "1.0" or "1.1". +@item cookies +Set the cookies to be sent in future requests. The format of each cookie is the +same as the value of a Set-Cookie HTTP response field. Multiple cookies can be +delimited by a newline character. + @item icy If set to 1 request ICY (SHOUTcast) metadata from the server. If the server supports this, the metadata has to be retrieved by the application by reading @@ -504,10 +492,32 @@ contains the last non-empty metadata packet sent by the server. It should be polled in regular intervals by applications interested in mid-stream metadata updates. -@item cookies -Set the cookies to be sent in future requests. The format of each cookie is the -same as the value of a Set-Cookie HTTP response field. Multiple cookies can be -delimited by a newline character. +@item auth_type + +Set HTTP authentication type. No option for Digest, since this method requires +getting nonce parameters from the server first and can't be used straight away like +Basic. + +@table @option +@item none +Choose the HTTP authentication type automatically. This is the default. +@item basic + +Choose the HTTP basic authentication. + +Basic authentication sends a Base64-encoded string that contains a user name and password +for the client. Base64 is not a form of encryption and should be considered the same as +sending the user name and password in clear text (Base64 is a reversible encoding). +If a resource needs to be protected, strongly consider using an authentication scheme +other than basic authentication. HTTPS/TLS should be used with basic authentication. +Without these additional security enhancements, basic authentication should not be used +to protect sensitive or valuable information. +@end table + +@item send_expect_100 +Send an Expect: 100-continue header for POST. If set to 1 it will send, if set +to 0 it won't, if set to -1 it will try to send if it is applicable. Default +value is -1. @item offset Set initial byte offset. @@ -525,6 +535,23 @@ be given a Bad Request response. When unset the HTTP method is not checked for now. This will be replaced by autodetection in the future. +@item reconnect_at_eof +If set then eof is treated like an error and causes reconnection, this is useful +for live / endless streams. + +@item reconnect_on_network_error +Reconnect automatically in case of TCP/TLS errors during connect. + +@item reconnect_on_http_error +A comma separated list of HTTP status codes to reconnect on. The list can +include specific status codes (e.g. '503') or the strings '4xx' / '5xx'. + +@item reconnect_streamed +If set then even streamed/non seekable streams will be reconnected on errors. + +@item reconnect_delay_max +Sets the maximum delay in seconds after which to give up reconnecting + @item listen If set to 1 enables experimental HTTP server. This can be used to send data when used as an output option, or read data from a client with HTTP POST when used as @@ -551,33 +578,6 @@ ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{p wget --post-file=somefile.ogg http://@var{server}:@var{port} @end example -@item send_expect_100 -Send an Expect: 100-continue header for POST. If set to 1 it will send, if set -to 0 it won't, if set to -1 it will try to send if it is applicable. Default -value is -1. - -@item auth_type - -Set HTTP authentication type. No option for Digest, since this method requires -getting nonce parameters from the server first and can't be used straight away like -Basic. - -@table @option -@item none -Choose the HTTP authentication type automatically. This is the default. -@item basic - -Choose the HTTP basic authentication. - -Basic authentication sends a Base64-encoded string that contains a user name and password -for the client. Base64 is not a form of encryption and should be considered the same as -sending the user name and password in clear text (Base64 is a reversible encoding). -If a resource needs to be protected, strongly consider using an authentication scheme -other than basic authentication. HTTPS/TLS should be used with basic authentication. -Without these additional security enhancements, basic authentication should not be used -to protect sensitive or valuable information. -@end table - @end table @subsection HTTP Cookies From patchwork Tue Apr 16 13:55:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48089 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:ce4e:b0:1a9:af23:56c1 with SMTP id id14csp376569pzb; Tue, 16 Apr 2024 06:56:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWZHCTkp+00wXk1uTEiwt4Wl3UaqoUXeApTGno4m1VToYstzNjhDrrHVoqNM9qn7sg6LroNksH3A+rZ0DtstJe7LkIE9rE360KDSg== X-Google-Smtp-Source: AGHT+IHMC3H9LfyhoBbj1GpxJKN0v8cGv32qizkxCjsn+7xWDSs2DIgiDRHrsxuvj1WiTsPAtu6L X-Received: by 2002:a2e:9c93:0:b0:2da:dfd1:8abf with SMTP id x19-20020a2e9c93000000b002dadfd18abfmr1308768lji.48.1713275788814; Tue, 16 Apr 2024 06:56:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713275788; cv=none; d=google.com; s=arc-20160816; b=0vpOqbxgOpyG/AzGNdid6uJVtuUokKT28lItgag7tqarRUoRzRg27Qjtyr4w723cbR /eR5XvwbSXsDPGconN21etsOLHsY0zg2+kUZ+mFJRZ0C6WwaUrv9fy4fXZgYn8tW5kxD qbgRzodbfu4+m100ttS8ONhG8g1YcniswsQMtb1GwlxAPJacgIwCRS1nizQ0wl2f3kyK wCnPRpVirbQQ1QcSamdEKI6JR10QcZp234zyiGKRhUlsRXh1ivvY2wKNmZ3KgvG7nm3+ Oe/DEDdT+F/1AHsE50YzHvhglRaoz5/VSeylnik9JBeiVwsPe+htJuO7S+bMVNofflK/ 5LiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:dkim-signature:delivered-to; bh=XhM4cOzY584CGLeRC19Wwb5g/VmTLvvRsv5SjfQQb3A=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=qZPu3F3fy2C39QquEDLpHae+nfN8JdWfz63LnNEouXQwrKZKipoJWA3U3uAs/9ruph 4syz/YQzc+6bPIp6KZUtPaATMEUqwJ5ExJie4mVi9EZFaPLEJQNC3/Yk7iAVhDn4CrEj h4dx3cULtouyvYAzCtT2BLpthc0h9ORK5yQOsfVmoopJGTTEdzFHw/YrmEV4QRGCFcTt TbMdcopSM2LQRM+MzDgXKZHpQOjkQztaC0QOUOiAUwKfGZwoSgzbXd/Qim/bPXw5/+cG VEVLKSiX2CD6V+ARtOH+ka+5832TejlMFOXmGMZF9tjiLakgkHnC1J/uSwAbCSm3EcCx rFVg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20230601 header.b="J3/jTjKd"; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c22-20020a2e9496000000b002d4aa141d28si3182138ljh.288.2024.04.16.06.56.28; Tue, 16 Apr 2024 06:56:28 -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 header.s=20230601 header.b="J3/jTjKd"; 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=QUARANTINE 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 6795B68D25B; Tue, 16 Apr 2024 16:56:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F92068D0B1 for ; Tue, 16 Apr 2024 16:56:08 +0300 (EEST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-418a776a4a0so1206255e9.1 for ; Tue, 16 Apr 2024 06:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713275767; x=1713880567; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=IRWr4J3ILRiH6Lg+uifDMa1tL1PBTGWy9cxeqL4J93M=; b=J3/jTjKdUd+zHI02nz6xBXrIO3qRpwsati5GocUp2VAtaflokcG/bjpkBoCU82MXFA DinscYtLAectWJTg6sdcb/5FbPNa9TTEyvn0J3dW8fA9IhTg3CVkrtvARJ6EGAnzaCXq c3RigFzYj9bEJ9HtN8bEe6cOKCBR1uMnJ+Lun5U1KDBMcmakkyb21cs0CTJyBucH2Rlj hIigsdMEsSDeIumraf6hzqQWJxAEIVssupVpet+ek8sJC6DQ+S8Th/GO4G6McQKP44Gf 0NMiiEgWivDjqfpyLMsWb14g6imRh+6pw+LNBO7de6PSRp4R/BR8j697DPT8sVf6GkTa pI6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713275767; x=1713880567; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IRWr4J3ILRiH6Lg+uifDMa1tL1PBTGWy9cxeqL4J93M=; b=U7xY4uOW+BHJzDSjpqfV5KTxf7MJZvGwYVsRNRj3u960vo/hZWkApje5h0k3HIG7Cc 1mMmgROifaRPxetqk3t/Z50vosBxylKy+qQRbQU7gFuMgj1cIkJD/pW9USd4Pw+v+/gQ v0uPZaEcUtjxk7K0hXl3V9UTXBYx7xi9hePiBgrmXKO8CHP8HzwXYSHdsyIoy7T0E/4w xgF34pWRCDzCOz3ykvK0PZ/OLgOlyYu9L/TwJhiHKknj3NcQacB32eko5GQGvTgCGjCR IMHLCR86iiEhU8HK/2Ph9EEthSLNgPQ6d9u7w+iE3+H5PO7U7yXkygK8UsxEb+J1CQSc VdCA== X-Gm-Message-State: AOJu0YwzpfVF+ikwqDNjvtSwxRMeQ3XTdvcmUQTUEy7gds4rNFEggR7z qy0+tmTZVUSELNmRYOTK+Qg5oXFTw77MiSyFsCuSZW2ACmO3Qw7NzuWEUg== X-Received: by 2002:a05:600c:5011:b0:418:677d:cded with SMTP id n17-20020a05600c501100b00418677dcdedmr4302414wmr.0.1713275767153; Tue, 16 Apr 2024 06:56:07 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id s14-20020a05600c384e00b0041892857924sm2599677wmr.36.2024.04.16.06.56.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 06:56:06 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Tue, 16 Apr 2024 14:55:55 +0100 Message-ID: <20240416135555.111773-2-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240416135555.111773-1-derek.buitenhuis@gmail.com> References: <20240415162741.110374-1-derek.buitenhuis@gmail.com> <20240416135555.111773-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 8/6] doc/protocols: Fill in missing HTTP options X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: dFSLeSAhIalU Signed-off-by: Derek Buitenhuis --- doc/protocols.texi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/doc/protocols.texi b/doc/protocols.texi index 5ce1ddc8f4..60c6d831dd 100644 --- a/doc/protocols.texi +++ b/doc/protocols.texi @@ -492,6 +492,10 @@ contains the last non-empty metadata packet sent by the server. It should be polled in regular intervals by applications interested in mid-stream metadata updates. +@item metadata +An exported dictionary containing Icecast metadata from the bitstream, if present. +Only useful with the C API. + @item auth_type Set HTTP authentication type. No option for Digest, since this method requires @@ -519,6 +523,10 @@ Send an Expect: 100-continue header for POST. If set to 1 it will send, if set to 0 it won't, if set to -1 it will try to send if it is applicable. Default value is -1. +@item location +An exported dictionary containing the content location. Only useful with the C +API. + @item offset Set initial byte offset. @@ -535,6 +543,9 @@ be given a Bad Request response. When unset the HTTP method is not checked for now. This will be replaced by autodetection in the future. +@item reconnect +Reconnect automatically when disconnected before EOF is hit. + @item reconnect_at_eof If set then eof is treated like an error and causes reconnection, this is useful for live / endless streams. @@ -552,6 +563,14 @@ If set then even streamed/non seekable streams will be reconnected on errors. @item reconnect_delay_max Sets the maximum delay in seconds after which to give up reconnecting +@item reconnect_max_retries +Sets the maximum number of times to retry a connection. Default unset. + +@item respect_retry_after +If enabled, and a Retry-After header is encountered, its requested reconnection +delay will be honored, rather than using exponential backoff. Useful for 429 and +503 errors. Default enabled. + @item listen If set to 1 enables experimental HTTP server. This can be used to send data when used as an output option, or read data from a client with HTTP POST when used as @@ -578,6 +597,17 @@ ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{p wget --post-file=somefile.ogg http://@var{server}:@var{port} @end example +@item resource +The resource requested by a client, when the experimental HTTP server is in use. + +@item reply_code +The HTTP code returned to the client, when the experimental HTTP server is in use. + +@item short_seek_size +The threshold, in bytes, for when a readahead should be prefered over a seek and +new HTTP request. This is useful, for example, to make sure the same connection +is used for reading large video packets with small audio packets in between. + @end table @subsection HTTP Cookies