From patchwork Mon Apr 22 14:25: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: 48214 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325304pzb; Mon, 22 Apr 2024 07:26:20 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWmVEVRbkgmPEQAEdW/TlV+zT8w4w8noylYVXRSMoI8C/XNzHZP+VRjsBz/78YckzKkpZPLsZO4fqHCqGg65C19zh8BvDZT78EAQA== X-Google-Smtp-Source: AGHT+IERPHVEcXZeoVDulRkSZWMgmoyF0qDHDSq78dTz8B2I/3UE+2l0O0NSp8qlaoLFN8ioXvm5 X-Received: by 2002:a05:651c:200e:b0:2d8:8e1e:e15d with SMTP id s14-20020a05651c200e00b002d88e1ee15dmr6274339ljo.32.1713795980445; Mon, 22 Apr 2024 07:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713795980; cv=none; d=google.com; s=arc-20160816; b=uVlaJ3KTkYzHXhFbyXB6BbVe8J4ftmCEUjM8d8+eVPtx81fA6isJ/XLxAUPOdqSXGr yICBFpdXzkoh7zobU6AsBURwGm9t268EV13j7AbbCgzlICq1qsi7mviS5gNMqeWdVA5A 4YLwdqLner2bXyv79aMkIN/gjMUlXE4kzW1CNlpT7hpshFytJWvCVo5jIlSiKkLZ1o/R KH/U9Qhrsg25iORiOaj7bV+Jpr0/Nvo4Qg01ebyX6S0prwvMuK8Tx69qrktsw8z8gxFK 6167GBUn5Wd8I8zToeGTOGG0RVj14FCx5YbZCBADDRzbjdVZHWOiaQLNn/qFW+TrQV9F f30Q== 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=4JDIbqu9XK1HZyr3FeMOGfmFdR/caV8HtX7nc0C0IvM=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=elmUy9r3sTmRWOQnF/shkyZg7MzfpTKdjQnzr9aPeD+hGUWcXzuzZMGGzd/gHyrSxD uP4cp3dJ99mEvSLkynekKB/VqKwVcN4a71wSfGfZn/xxMUe43IrRmX5qWylqwzhMrRVV USob1SWZNyBuzxerauoDdlLgmGenbGfJ32wlCaWM6gK6N7G2EzqJKwEyqofC4oShR1I2 kxDtSSIFLnc65IqgSmtcjl6mVao2u0lhss+59GjGUZ2wKPn98RbEhk9E2442kq5yB32R WsLq5IxKBA2COdlgijAr5MXK2As7mkZDcjo0Z7GUnY/wSrNDi6sFtXBs8+hSlb1wBAXe vKhw==; 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="G3/aBEDK"; 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 i17-20020a2e8651000000b002da967d4313si2837966ljj.297.2024.04.22.07.26.20; Mon, 22 Apr 2024 07:26:20 -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="G3/aBEDK"; 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 5EA0168D2C1; Mon, 22 Apr 2024 17:26:06 +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 4BAE568CFFF for ; Mon, 22 Apr 2024 17:25:59 +0300 (EEST) Received: by mail-wr1-f50.google.com with SMTP id ffacd0b85a97d-34a32ba1962so3146206f8f.2 for ; Mon, 22 Apr 2024 07:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795958; x=1714400758; 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=cB8fzgGV/3FJeWzJVVfhIte6zThqHL99BezwSNSPkJc=; b=G3/aBEDK21kJhtCQScDc1EbdsSoOkYgZkbCoF1A7phkxL/GvHKCcqz4CTzqz9gxcsj YaOIYVfF0IYzAlfmLSG1gZIUEKd91sBfBoTSzFHmVyFytyS72KqYygNDdgpDsxOwSHrQ YcgQ5sLVPF9ct1RbtKgT2LQ8If17I08aJ4AhrGz3nUg/KYXV31Xnc9GTLUKjwu8rkm7s 4Evn3v+lKTliBY3X0CWfS6pgizvTnfzKgGKsyF8by+g1UyV3O7pxcqfnNxbXa/+QVzAy AIL/wNn2HpD96TkS//fxJapxU0rMXC7KBvGL3LYzIpyrXIJZXjEj3GBxZIXcfc/cVl9E XsgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795958; x=1714400758; 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=cB8fzgGV/3FJeWzJVVfhIte6zThqHL99BezwSNSPkJc=; b=UVRykVW6S/5FX9SSAHHZJ0VK5K3yZC5OHdsWw14YL7g9M5OaiDGogzOk6DdfSjRkQj MQqq4jGfyOu2m5Et69bzrBrjZtFOY98cyjnRjtr8lZs0dFGBW4MwOeZkYEpcRlGyOWxx dj9xbSbmhtkCiSwQMFdJxGnXk53Yh0JNFaiWboRUfUWw+KMNX8Y6xtrLM4GeXRN03ACR FP+EHCuHptee/j4TN8vFbrB85UrDTT38bD6M/8Hj0x8tTaW/pNo+gd1MfACDajhzxCoO sFZhaa159f77EUEC5IQFqSABsNugCzaRPPLfZxJ4IMD93wRXw634rSzOqnIuhNcJCFED ND2g== X-Gm-Message-State: AOJu0YyeIgiuH/OT1s7OQzwFHVqMOKFyEcbDBfUy0LeGfrb1hpbCcwSU VspvUAdho9Yy+EU6z9VeO1LkUpoVHK+3pm/o1hN5YavO0n+tTTE+XJ+G0g== X-Received: by 2002:a5d:53c3:0:b0:34b:58a2:dea3 with SMTP id a3-20020a5d53c3000000b0034b58a2dea3mr181475wrw.64.1713795958000; Mon, 22 Apr 2024 07:25:58 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.25.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:25:57 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:39 +0100 Message-ID: <20240422142547.281064-2-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 1/9] 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: lkVLlhU4Hp8z 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.c | 1 + libavutil/error.h | 1 + libavutil/version.h | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/libavutil/error.c b/libavutil/error.c index 938a8bc000..7a9d760e76 100644 --- a/libavutil/error.c +++ b/libavutil/error.c @@ -61,6 +61,7 @@ static const struct error_entry error_entries[] = { { ERROR_TAG(HTTP_UNAUTHORIZED), "Server returned 401 Unauthorized (authorization failed)" }, { ERROR_TAG(HTTP_FORBIDDEN), "Server returned 403 Forbidden (access denied)" }, { ERROR_TAG(HTTP_NOT_FOUND), "Server returned 404 Not Found" }, + { ERROR_TAG(HTTP_TOO_MANY_REQUESTS), "Server returned 404 Too Many Requests" }, { ERROR_TAG(HTTP_OTHER_4XX), "Server returned 4XX Client Error, but not one of 40{0,1,3,4}" }, { ERROR_TAG(HTTP_SERVER_ERROR), "Server returned 5XX Server Error reply" }, #if !HAVE_STRERROR_R 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 22 14:25: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: 48215 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325383pzb; Mon, 22 Apr 2024 07:26:29 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUfY2PAWzStybRt0IDWQiq7ab53b1Qyt2S6FC/eMpm5RQtD0TBT/B11O6zalw7zMkbjpMt+OOCifpWhYHzAJTmJkjkCwpr7PAIGVQ== X-Google-Smtp-Source: AGHT+IFTY6dWYWgVR9w5q6eOaWT8/Z9nNuxZ/Dm0By7YJ6o1EYI1zqCBuHkLFYogniglAvrIHmvx X-Received: by 2002:a17:906:3059:b0:a52:19ea:8df0 with SMTP id d25-20020a170906305900b00a5219ea8df0mr7671015ejd.66.1713795988992; Mon, 22 Apr 2024 07:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713795988; cv=none; d=google.com; s=arc-20160816; b=D76IKGaTCLOdJdfGQTurbwfubC5PxhlKa5A9jN5W4Tdds4HBibDt9pwTPa3EjR+cOf SjNiwi+Sh/fX9RooULVoarXve6lW1LCs0o28glzcsRmgX759Lb1FDdAxc4UZpJBX7xPS 2H2enfZ6yPy9CzoriCMcH7KvKj9aEM0OHGq4nqI11Ik0JTkvRrlWjlKiV+liK+Xws4TL cjC7WS/CaQgV8aumeuif81r8X7jY+/A37SdapLIasUDekbJy5RY0cQz6/3s3T32oE2u4 vUxSJsRlbKXgyR0P0xQfIrFvfcZfPx7+ha0YCOy7NRpiE68ZIGLrKgkJI/MBxNIW4dPT MDJg== 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=ccpgSM4ils2LBJWbDgoJflahDR/eC3Ujkq4MHc+pLi5+HyVclmTSUVijNW/VpycAWc 37r7RbHv5Dq9FXZSf5aQd2ihPwrZsixqmDENkbcxrpGNaEV6vG7cFdMkPVRFCwUKkdPH u4cdkUtPbvR3y8STG7aybPj5A2OMpsP/JfY4zcCtcwRWOXuO2RVM/e/Cs9LDFirmnH07 6G6dk3S7Zu0Z1W7sDM/V/D0cSeZBzh7l8tYVIu9VNEuB463U3pyjeI1eK3Dt94m+VjIf Q/KkJ0oLnhlaEaHkkpxqbQjmFmW4GAce9R0nlZ0ZJpXXYVVZljOc+LdTCCddEXr/u+TV iYkw==; 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=DGbZ5HWv; 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 h4-20020a170906260400b00a47261a6b24si5664116ejc.415.2024.04.22.07.26.28; Mon, 22 Apr 2024 07:26: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=DGbZ5HWv; 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 70BCD68D2F1; Mon, 22 Apr 2024 17:26:07 +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 ECE8568D2A6 for ; Mon, 22 Apr 2024 17:26:00 +0300 (EEST) Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-41a55be31eeso8090755e9.0 for ; Mon, 22 Apr 2024 07:26:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795959; x=1714400759; 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=DGbZ5HWvz3ngchqhJ+Yr98Bwhv8TUt7qVUsUobRj9kRo+xz1B+pQ+/iEAZeQV18EME iRY4WxSPlV71Ci85TXtyf9+4stf1aMCjyf0ewWg8FB8sohPX6z/dUjkhBPDGmyWS4QBO TJiIEJ7lmhtXvQ8gZFX1/uBDLWAUIz2ENPsGab5UnespcW8Ox1iflnGUUDL/nX7HoKdN aihrJJzf8GLRYRopq9H7rfiTvVwjpyBrz8RpJkfpNevRj/YK4TTiYVRZIEIqi3srIqpY d3hYOoRFH/NlQOMj6YrAOzD7+t3H1QCbCq5QZ41U++q2kJZqvxsgiD9/AWtuEDJbscLS 2T+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795959; x=1714400759; 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=F754+BAm2cFD/vh/EEn1Gb3b7opZlB3fTGWf/Ah+4meZQjzsiXM+3Ye2qfP2PSHg5/ 2f3mAmVAFHDZ60d4EFa7jrcMcr7nK8g9KiQ8sj2LWuthfEHDkn4fkyd4n8og7YrbGaTS TpWJ2YMtJO3mbGo3IinwcoR2DL/tBv+8Uib4tN6nfY5ajmAez1j6lVpzIsQCVbM0vCqy lJoLsKxnkFmbMWD9tNPhfS5ZK9F/Ti0H++uS1nefa4LuvdIx8DNPKdVhhbNMI9vpr/BI ZZcpDK+YwV0pwf5kYlBJHWwZchZ1IdOQOO+jjLtBODIZ1dTPeGcnOSDLNyayJBrI8MRv W72w== X-Gm-Message-State: AOJu0Yx6kreQNpbI4K+uGkPX0aEuX6QOiKSvjRKAsHfiJlx0jJcaVFvn vL/XUc5IrRHt4f1NSIfywd+8zv8OTclQVLfvmxvCRPTIw/6bxe24cBiyiA== X-Received: by 2002:a05:600c:1c01:b0:419:f27f:5f8f with SMTP id j1-20020a05600c1c0100b00419f27f5f8fmr6132489wms.38.1713795959349; Mon, 22 Apr 2024 07:25:59 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.25.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:25:58 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:40 +0100 Message-ID: <20240422142547.281064-3-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 2/9] 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: YQx5IZDeImOT 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 22 14:25: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: 48216 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325467pzb; Mon, 22 Apr 2024 07:26:38 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVzupm2GZI5cpBhVpbXtqt0Fsi6jE3OXeHuAVOIrYMeLuRJ7NkXFMV7FojuiFGoiKe+O30VbF3qel0Kc0Q2d/99tXInHLpvouI8AA== X-Google-Smtp-Source: AGHT+IGx62Q1tKrlRnTpwIswVjS/BB6vPierd8P5oh88GAOxeoDcOHtiwtySNDD3ASYLA4jEihnY X-Received: by 2002:a50:c345:0:b0:571:bed1:3a36 with SMTP id q5-20020a50c345000000b00571bed13a36mr11034512edb.38.1713795997771; Mon, 22 Apr 2024 07:26:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713795997; cv=none; d=google.com; s=arc-20160816; b=skZyztD+ja2GxqRi1oyaZHnYBJShceVNByjYemdsgi2lTgxlcFjX/3O4VJWpgbHUxQ BvGd+c0n+kipwpO3hRTnpjF92VaUBJyFZiqWp0ccN2umAsWvPw1UGoPV/CJjS4ZctplF qcAwJY3UKCeaJG3HoM5gO/ASsUi8rIeiAz5svZTU/rLRBTCg6nng0dEhKMk4LCE7c8Zn AZvYyDgQABzFqweHXwQeKqtdUJNGPOqQvuL9Dk1TRLkB6axu7+EB/590kkG4xP111iOW B8eVnPi9g+tOMP31RsEnVTMCspI9oDEiF2kGEG9qXAaMTrGV0980UbvaYjxaCSynHO54 imew== 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=ZpmX2QqRRMwQIb+yHYpEZMjvjPOgspgpYWTrMFOPOvsdItTk36bvH5I6bSt/J1dbPF WDSrLoRbdcaBrN+IzAupAzjLppxm67JDi/Bgj8WVU7TBwH4M9dV2HLjry0ytHdkE9nt6 gJnn0swB/gkDrEZWL5HhyrCmWnGDZj2FAzh4TGNno/gz4cG1J3PINgcuQTzYlg3tsGG7 lnMw33cDFuuziHu9/Tkv/dfSfkb939rpA/Mpw6RdLvHGa7j8AOGMo9UHcej3EqiTO7/h /CeuYQiAA3b8GDnfB7Vn6zFc60DtX7G5qE2GF82D9q4hcfP4vELyLT+Ll/fMAWAE8Gc4 rW9w==; 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=CboLBhEw; 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 i5-20020a50d745000000b0056e31afa851si5764387edj.385.2024.04.22.07.26.36; Mon, 22 Apr 2024 07:26:37 -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=CboLBhEw; 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 6DE9E68D2D0; Mon, 22 Apr 2024 17:26:08 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6785D68D2C4 for ; Mon, 22 Apr 2024 17:26:01 +0300 (EEST) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-41a70466b77so5706065e9.0 for ; Mon, 22 Apr 2024 07:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795960; x=1714400760; 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=CboLBhEwLTdi/GGzAp06MShQSr1CWP083OzXO+7KxqF3H5C0OgP0FmrhpdlZ6XvNDA AT8Sjl4Bvrocy91kWfgLhHAvESoN9aGHTLw15QwebxKLF3E1ovp5AWVs6yHz4sTfQZlv rjFu8NY9lzlVVdtE5EDFm4YdIsXZN5QIISzb5Uo9lzTmQd3jC91G316+VdP9zznP9Zw7 c3LXBIDRYwJWh33uDVBvcfrxotCDXimatHZsSSlsNArHSMf0vbaM9jNj9fKvFbrJNFA5 5k4GoK0p1TovTYW+DDLeuzJF+gXnfDpZoULYvhBA+rUQQ5+rH34GCWQqQPwf8BmuFVTd 9K/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795960; x=1714400760; 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=eZfyQnLRcQBBdzdELL5fHX4x+f+jH+9Dcecs53dtvkCZv155Fg7Pt5dkueUtUxcKZd H9q/9pbmRd13MUX5gu0xf4t4uZCed3rjlISr1U3F7K4t4eHHw/DZzIoIN1FHxh9a+NOQ 13DC1dDM2eBnjPGtCtNLErvbzZmNyzb4a6c1uJExRBAmyLA1dOeJbGKDwLE9EfR/SCGX 0iQS7muOGKChp7Z7hnjtKhLJbCDXfUDweUgSu8QmyKMaFX2T7amya9799VkOknokPNJq izvLT1mzeCeEIbge8yNSyEeV6tV5nGpqmb20lwu+ky5kh42SX23Db2tilvQyXitdj3sy cCSw== X-Gm-Message-State: AOJu0YzQozFl2hiKAaimLyHRYNBy6sDUu4QtdNHflARLFwM7dXCA94SL w58cI3tmtueEMU81sSQ+Zb1lpDPYW2D4qgilIS1x3c7U0YYsv5qW6nCPMQ== X-Received: by 2002:a05:600c:1f81:b0:418:ee2f:cabf with SMTP id je1-20020a05600c1f8100b00418ee2fcabfmr9288957wmb.15.1713795960155; Mon, 22 Apr 2024 07:26:00 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:25:59 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:41 +0100 Message-ID: <20240422142547.281064-4-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 3/9] 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: YBn2Ewslbvqq 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 22 14:25:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48217 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325566pzb; Mon, 22 Apr 2024 07:26:46 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCUwX9Tw7myEbgPlRT13aeZ4M4sNzV8+FtOIjRetIHpNFoKHRvjphovkjfRwd2SnI5kDTasdiVxg1OfTh9xyxHuq0ozSpAOrz+hZbQ== X-Google-Smtp-Source: AGHT+IHDLt6SRNRmgJNZhmw4+7MXWc7joK35+2YRdN481CSccjrNrxzzOce5whiZMGgxFykkn5g9 X-Received: by 2002:a50:d4c3:0:b0:570:1026:c98b with SMTP id e3-20020a50d4c3000000b005701026c98bmr6493016edj.0.1713796005977; Mon, 22 Apr 2024 07:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796005; cv=none; d=google.com; s=arc-20160816; b=vSe+oUFcfXreK5nvoNfyNhGxRjlIDwwvKS15k+OE5AitKxB3uVreHZK6OY37Bn2zjv EqlHtT4TiESE0Bv7PSkQx4qEukxqGDn11GIxea5YDklaZYbosXOsd6yetj49H5MTmrB7 AsQnicEoBHO4d9Bje1vmCDqoSA+PByAxXZQSBge7RsFWaPCHIHeJK3lj3HUA/SSm4wwI TWrcR7l1t7R/8kHSrVLEcp0Dp/SDaeNB+NLU+zaDHtrajOEXkWI8oqfNd57nYa8woMCf iJfpDuZ17vrckG1LpZRpzROYR1P/JApGM+hb69wU3YB0KTwQY+fvy6VLfJZM2iRlQCDq wdhg== 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=PrXluRnEfALAPGlDJF9ppppR0PBbZ/wK9jhSjvgQbxo=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=LEuAYCO0lO9Wtp+UpDISX+QSN0oz53fcCrUFzlkuRRpzyOVXklxeYV5jGRsaSppOW3 WtD1/QUAPplqVnk3GXNfVhp8GrsLSclUCUSeaY2JA5d041R8bIOdRlrK/hzp7g/CoHuO P5faW9wQ2dw1xKflZdEOtDc1bdU7oEccwIo1uKo+CCf+BgnFOE+q9in/1q76tepJ0Qs/ FhwK09RadCuJcSj9XtIaZyn6yCneLnIySBegHdUBT+HdueokLb5dtMTkJeL07JiY69Jz VDvjBKeij0GEFqpG5L0g7rYqH9mXZZ+YH+W1/x33kx4ZLRjnY3HtVFq9m/xtvYxQRhDS z0jg==; 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=MUiJqelR; 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 m19-20020aa7c493000000b0056c4e641eecsi5845806edq.219.2024.04.22.07.26.45; Mon, 22 Apr 2024 07:26:45 -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=MUiJqelR; 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 86EB668D362; Mon, 22 Apr 2024 17:26:11 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id C24DC68D2F6 for ; Mon, 22 Apr 2024 17:26:02 +0300 (EEST) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-41a7c7abed9so4754005e9.3 for ; Mon, 22 Apr 2024 07:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795961; x=1714400761; 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=ed35GbOVsIDh5igs22KbqIO4ym27MIMHMP1pm5ApzjU=; b=MUiJqelR+jZVfarG4GH7fPrTD62XgOMnb1qw2zw5Q1uLq2j/vA/Kx/hYTcAzETakvb ZkML0oTAvhGoYMKtEFdHWzTsW4Jb+7BtQZLeu9l9YlHjiKRNta9yUPyQmSR/SHpiifhD Q2QYD8sEWTe63i+8yi0S0nGw2ozK0ewqabPevRAMncr3d9QH6VEGFyF0PDvi/0BB8YHk LX/idG5KefG9O7/VtC3ykNxP0YViLcIUlCsG8IAG3bqDrahjLo/JCR5nTYXaM5NqyWbN Yk8EsF0Bo1Or0n6Ad+HNmiq+PxIALCXXLfWpu1k8VYYY7yE/vBgGLup+jwtdbMtfcsHj c7VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795961; x=1714400761; 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=ed35GbOVsIDh5igs22KbqIO4ym27MIMHMP1pm5ApzjU=; b=mT38xnWu5ooEHOL6k0elEoopsydUVdcmx6O21tvXrX1gY+PxAk9aMQjdLNLZ/Hakys QnZZM6Z+f6pxlKrKhZijgsblr0h/sRZiGXOF1XXw4A80U4AM6P48cW7q3GsoD03BsCTW d6qO+o//D1kUkqkfoKukMpM6i8WbN0zobuFwUzGFga/LIZmd0JEZbb5ROgNy6pjmkrJM 9wEJtGMODzxXqDYQiuYqvK464zs2RHqlqhLfwNKYFJ1Dlla1+8Msjtp3GIZeLG5jH8cC hhw35AJ81tNro87bJWa5YCcEzEcfmRmiK0SGH9OtT3TKJZn4hX78QuBrQXzblU0BNC89 26hg== X-Gm-Message-State: AOJu0YwinBpdAgBMZCJmxnw2ehQt4tChfnsr1T2jtzZkNdeWT/HtcHoH xb4yv2qhrXEOGi6Ti6F39Qsjd+dvXj1ti6IdCcon61eDq/DFHzKodZ5Ozw== X-Received: by 2002:a05:600c:b9a:b0:41a:968a:b2d2 with SMTP id fl26-20020a05600c0b9a00b0041a968ab2d2mr575338wmb.4.1713795961584; Mon, 22 Apr 2024 07:26:01 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.26.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:26:00 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:42 +0100 Message-ID: <20240422142547.281064-5-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 4/9] 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: 4zh7l/qNZMYI 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..5ed481b63a 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; + unsigned 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 = strtoul(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 22 14:25:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48220 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325822pzb; Mon, 22 Apr 2024 07:27:13 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU7z8yF4GFCW6nGovNmzgUaC3a30HRLnXb4L+YRBsnTtkEtLd8y5dC6eIYU+igCiUBH1qk9pNkXdcDCqIoMadjv09wwcneag6KKvA== X-Google-Smtp-Source: AGHT+IFNpfw5kZcKjrI3O/d+/UB9eXuqh+LAaZ4LwlIvQ0x9ru/skrZYLrvwmIWjkzIH47zf2zT2 X-Received: by 2002:a2e:86d3:0:b0:2d4:514b:428 with SMTP id n19-20020a2e86d3000000b002d4514b0428mr6244171ljj.6.1713796033647; Mon, 22 Apr 2024 07:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796033; cv=none; d=google.com; s=arc-20160816; b=sEWOKw5J0L/e0HOJ1oUVQ3otywJUw4b8HurXN1XOinKsMHuwZjrzModB3ERC7A3lRH 5YDRTXVAXM43gntRjBc4cS+bxmND3tSCapIrFIUPn+JNEiVChzY+lZMzDM9s2UFLCYmT zAfzj1WLw2w7foQIbapN/CJlLrAdehhhqf6rkfXzL3/5qGwSWBfXoT0kepPiiUvwsOxk iPfcdjXMilnepf/eiRAQCuALQyRlUTbBLCUoDf0CRlHu2oZN2IFxJhJL3X/CnIkSH6Fw 769Ij16T1fLHzOgH9sIIRJzHgI5EExHnaAdl7yDZEf739FENfgkP7pz3J5VJIP5jSWL4 K6Gg== 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=VmhkffvjzDrHpIN0UH1GMHVw0GRRdKZOT85o+1whPak=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=OubAWlnPA/dDF0htmagN45tljiijNBZLUk4lYrDLf/5Xufdna8KFCB7LqYHOf/BFJL wc8nZrLPSVM6iGnC1CX7rnOSNW0DbhXEZzV10izcD/kdldZ4SJAkBczXh+86VXyiTFXW 6dFbCXpK7YHs+39FWZN407XbkmgUUDHXUYUv06XqJFCmGxXKevXrssjjrTzURJqIzntb 5SdW+9xNSnIwNbQHz7DFTcu1n1WpMxGg8uHoHpdsWRh8hKQj8ifunuYAQYArmf8f1tWO l4aGSaePBlnAQmg0O2ZwU+5h4rcR+GgkkyNROllAf0i6pKXevfFMZqW4GqlI8oVq+aRS VOmg==; 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=hX9Flob3; 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 a11-20020a2eb16b000000b002d9080a62eesi2825938ljm.66.2024.04.22.07.27.13; Mon, 22 Apr 2024 07:27:13 -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=hX9Flob3; 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 BE30A68D370; Mon, 22 Apr 2024 17:26:14 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8C01D68D2D6 for ; Mon, 22 Apr 2024 17:26:04 +0300 (EEST) Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-41a74e60753so5796795e9.1 for ; Mon, 22 Apr 2024 07:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795963; x=1714400763; 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=Ms19ve/5z5HPAfTLKU7FFo5PSrNOm3Dkh5NnotI6Rtk=; b=hX9Flob3s3YQr3tBBDDPmyen9Y/UUusHkZ+YXQOwZk2XKSHjtO7daEVesjysgMxih2 wNG0x9s3yVNmDXTlSFvX4tq0esLVPw8noZqHGT9ZIt0sQUC3UqpRixzf6nvnoZ8Dxt5T yQp/WMF1thnbww0Hd07EhmkuKtBGksNbQk5zv6Asg2aUKOUECjvOKQhDJILU/EACt4Ih RqRamnBv9p0MI0cCO00JHnHqv/5IMLodK0AaXc5WoAHWsCRtujTHClm4T4dbzAxMUHJa we/xzPnjJy932VjiUrosjvZd5RcudUyW63sIwz9OTMpizZakk6ll4nZ3kULMBSZD20KT 9raQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795963; x=1714400763; 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=Ms19ve/5z5HPAfTLKU7FFo5PSrNOm3Dkh5NnotI6Rtk=; b=O2q2qnj1p8EZrZnzdr5RqGwAXgDD8DDkShXeyNI1CNwr5JhQILlZPIou3iUsTKu3t5 mEg45CJACCC1iHTq7aaoIQc02JDXj+LUYP706TKyjj+J9rHZn28sXyoE+TT/cLM+KL4Q tSPzCQXZSX69fvLLW8fK2Yq/rIe1plQi4EtnSX6HqvU8xbSuMvwkISfmma194ERDuTGz flPGN8ps8LOhpza2hO7JFF9Ck7NSZxf9migD914/i2f426gZ2YpXv0nJSJx0OF/X7UWe DKds96HdIpLjUQn9noqi0A0ZsMZMtB7gQE3xVRgYURApPvrV2vUu2/PT20IwYmSsTavv 3yaA== X-Gm-Message-State: AOJu0Yz4Up8QdGQWghIsCV1y76czvECdn9aX3bLncwQTq61g30O6gct9 NzWicEXSDiBCV+bnyzJbRTgBKla50LnESKF/hHmPOY/Fvp+nxEls3CNWEA== X-Received: by 2002:a05:600c:4508:b0:418:a17e:cb47 with SMTP id t8-20020a05600c450800b00418a17ecb47mr7189315wmo.10.1713795962965; Mon, 22 Apr 2024 07:26:02 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.26.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:26:01 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:43 +0100 Message-ID: <20240422142547.281064-6-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 5/9] 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: 1BWGEAduXfNC 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 5ed481b63a..6927fea2fb 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 22 14:25:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48221 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325921pzb; Mon, 22 Apr 2024 07:27:21 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXyjEkN3W+1GDEvDmYI61UPtt0hdy3O6PDf5qkCR6Zdj8vXbwDvsnVaNGyapTVdRW3y8fNXmQbD4fV8S7PtgqU3lQVA0y4UiuFINg== X-Google-Smtp-Source: AGHT+IFcmHtoHFlTtxUgUB73/RjJQEoKKdy6WHEfpn+UYuOXBmtVwrIT+3zMyJaZB93hdqHp4r09 X-Received: by 2002:a17:906:38b:b0:a55:6135:7ab7 with SMTP id b11-20020a170906038b00b00a5561357ab7mr9289480eja.6.1713796041705; Mon, 22 Apr 2024 07:27:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796041; cv=none; d=google.com; s=arc-20160816; b=nMe+KCFFI55FOsyq2oJU6NgN4hNwOKsKXS6uaWXUje/EVtUhluLmD2qMiKQ97tKf73 KVlSocbz0X1gzFs1VIE9YBCMlt1nzlYfK1nPcJGKokB/ZPuvvs+5Agta76CO35R0bdaR bWq30d7vG34ZYVRyH65UcDW8paX23bdgv1WKA19n7mSXjlVMf35URjLi/Rcfa7kLEHMP qoO/KNbRWOOXWkTD/XEBFKp+3s1ugF2FsyU1KCJi13Ww8Aw1y0lzeVossJljKI8Ch9U8 6xkVK+8Pbr+2XjEuV+NbJLTqr77tA7l23CkRAVklen5MXyeCL7/wjDwD+wNPH5RwQKIM hOIg== 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=NOoCVnODc6Tt3bCPDvs08wsnh22EnLVzEpEGLmvUSNs=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=tGiP4w/FwXm0aBjfuNWZue9gcxFd4UkPAhxwJ6irSZ3UKV7MrvAGKZjD74P3rVSOui XxffSXg2afUUaUtj7aN9bRfjoa6mRbUQZQw5z+BmIWy29Awo1jc682iJdTUf9u7gf8Mm wQK2eJ+xx+7AssW/feU4d1jEdvrEn8w08JNmb08bV7tCC2s3cKiT1nRDC9rdzO8JX9O/ bmH69s/NAj+/QdIeEZ+uz5YtUNy2hxgxO/DgKo/6dvr1lmF4xkFUfZGeVdZ/N45H0Iw/ fxsa5i105WtHyDYuAAkelgDc2CdMwW0ETsPQPh0ghBt70ecGIXbWUzsDWYqG205ljbCf 5gLQ==; 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=fNSKqeTd; 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 ho12-20020a1709070e8c00b00a55bbc83796si993666ejc.388.2024.04.22.07.27.21; Mon, 22 Apr 2024 07:27: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=fNSKqeTd; 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 BE78268D385; Mon, 22 Apr 2024 17:26:15 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f53.google.com (mail-wm1-f53.google.com [209.85.128.53]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id AE26C68D32A for ; Mon, 22 Apr 2024 17:26:05 +0300 (EEST) Received: by mail-wm1-f53.google.com with SMTP id 5b1f17b1804b1-416a8ec0239so25063635e9.0 for ; Mon, 22 Apr 2024 07:26:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795964; x=1714400764; 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=7avWcIstWjoAfFNuEIrWVZvuRfk6gppMQ1X05ezhCoA=; b=fNSKqeTdFVSqXVB49PzwotDPg4UjQ3iRAjVmaTUzQABQ6yRB3CYypiorUYhu6qRk1W OJVYSQ54jTQus3QdQFLj8otDP3w0YiGgtQQsucPeRw9He+hTloGARfkhlEkyOXuwIGD8 0EltGD74My5fIiQ50KfNHeKkq1u3B48r7XY9dd/JY0vd6N7wqJmmR8m4CgzhyrWMzM/H azoYxZYqmUv7OtaqHEKOXB1Y5inqyFLs/9ndyvkivb6pbowwP4DO+sLw62DgdlGMa8ts 36zl5Z5P8zjd7j5AIvIJB7SMNre5/MvtESOsgNjNKvXYKmEz+BCbDuTPf1Wqj060W3PU fi6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795964; x=1714400764; 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=7avWcIstWjoAfFNuEIrWVZvuRfk6gppMQ1X05ezhCoA=; b=JYHz4+IOltYLtTcz3IB9KebEoZp7XwXRkHhBgeZQ1IaJNqIdWWKCJtgJ1eUkYrFT2L eymr7XMqlmqvqmZtiAp1sU3J9H4uEArK9s44Sqh8znhGis/hhnyqItUEDMacv+24oq68 1iGT1QiQRjxejAyJ5mfpzqjPNttkpuCil8ocV8XwjufuQIke4w7RAcPyrfL5c/drA6eC K//kHnQ8cOmJtcRKBgwD9V9/4uriqFly0eMCVifP6ZWzYn/x79F8skUVi4cyKqSGO9RV uCJ0QytqN6nI6K5sLx0/SQrEEopxqmHEyn/GcFjf0nUC8T9Dtlj6rwnLeF/WQQpsgMdl fFRw== X-Gm-Message-State: AOJu0YyHcIChMVL4436homIo24FV6pEnOkHWFrYhD7JSAKVA3FCTqbKG 96cn/68fiu45kIGp0P37sTbUSElPVbU9d9HFLTld7y32Dphv9wCjjklBZQ== X-Received: by 2002:a05:600c:1c85:b0:418:7ec1:7bdb with SMTP id k5-20020a05600c1c8500b004187ec17bdbmr10754320wms.5.1713795963980; Mon, 22 Apr 2024 07:26:03 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.26.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:26:03 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:44 +0100 Message-ID: <20240422142547.281064-7-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 6/9] 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: jBBRbfLGKNoj 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 6927fea2fb..06bd3e340e 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; unsigned 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 Mon Apr 22 14:25:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48222 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2326013pzb; Mon, 22 Apr 2024 07:27:30 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVd5uQjL4eR5696SwxLOaz0D18b8/QgNp4U9chCMhAEV0VsqX9OT93adrZCATJlb6Ukm5CEdi4sy65TIP+tz42jLek1RPPyRQKKyQ== X-Google-Smtp-Source: AGHT+IEIPIjkCWnxKzw6ct8HJWYmAb3oLoyJH0A6hu7p8nMIWKJxaJ++lNqADjKuQcWVDhATeLaq X-Received: by 2002:a50:cd12:0:b0:56e:2c1d:1174 with SMTP id z18-20020a50cd12000000b0056e2c1d1174mr7300278edi.4.1713796050168; Mon, 22 Apr 2024 07:27:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796050; cv=none; d=google.com; s=arc-20160816; b=bfzQ/5spa+Ptk856DzY9Gb73Wtpl5T4oufHlqITyjcuzVPoZJXkYNDZblniuPEl8sr BG9qdcP/iLJg2fHt0PhACXrj4aLn4m3XVEEzYkEkSbMNhCstaKmk+TdLVhAnaG2lclY9 SskJALx6JKu3Z20SjmVml2sNIt9qdfe4ID+OgB2EDJ/1HJImZ32RLgWtQ9njXqN/BdLf YWadpFwiK/7NS9PAC5NKbKsrlRQErPlN7sZq0EoPsyG1r3HHTiOpPWHJ9TgkkD6Aphg7 0OqLo95Eru0GQkkQNa6IYUJL6tETQGXhP4Xc037HWlP8JtSq8vp198fI1BKxcGcfQNkZ x/3g== 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=dG/gO/N+hzyzQKjOzqORGELQL8R/pf/hq56rF0Y4DD8=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=gCLoIQJLWj3oIgBoCOyk3rKOgL+mPC8D9unFX0oM9qwCFWRtQcNQ7QMrb1aKMcU8F5 fIR4EELaJx4eNFrpKeiEIodtFtOb3xyq2wTGoXedsB59s+y9fTcDGHXQ7yNpepGl+fJd RMMY9qI9y5a5C+Vv6+xJLGU1zU0ZfugOdpqFdLMR4+LM7I9SRjx/ah/pjLv+EhjdMnzK 6p1Nmwc3N776BgnRb18poBWHey87wVXLR+rGnnp67Do6fCzi/OwpnRHBV0yNxnA9nb7u FTZVne6oLF2+ZLg98DrBX48QoI2AuZNlRzJhQU8VsYJhusSIeC3cEwrSO5Q97c1A+DYH 81Bw==; 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=iM1XXcMq; 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 y4-20020a50eb04000000b005720ec1cdf3si1074969edp.121.2024.04.22.07.27.29; Mon, 22 Apr 2024 07:27: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=iM1XXcMq; 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 A59AF68D38B; Mon, 22 Apr 2024 17:26:16 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2BD9268D32A for ; Mon, 22 Apr 2024 17:26:06 +0300 (EEST) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-41a523e2888so7376255e9.1 for ; Mon, 22 Apr 2024 07:26:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795965; x=1714400765; 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=PoK1u0FcUJnwc28EJhZ7aNZq796cHyRVudv7K4HKB6E=; b=iM1XXcMqbkGj3bzC8UTJ9LjSXyA4jxuwp9ckFSjFUlhYOKK2QONkCgAzScGuKA6Ims m1CgIzKKRidbzmqVMOZvQXXJizrWymBgEoZuXGHjPRc10jq+0UYh4fpNex9YjsDq8fqc BueX3+K6cEJWeFdKYdIIdA7MRbuHA1K+NXvAKQoX+k2ptUMtZ3BBuyraJBeedjpSgp1M G5VZmFV5FUS07f/ZUwlEGeseDlp+vOpwNw3Qt0sUaq7HVvMDr9lbkhKS0UAV0EaexVAe ZjmuL0juSiMWa9Qy9evUMDTum/tlEc3PhOoHMvJA6h4ElSM8QAwUHwA3ksbJnzIii+j1 AuDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795965; x=1714400765; 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=PoK1u0FcUJnwc28EJhZ7aNZq796cHyRVudv7K4HKB6E=; b=oroaEK3vAs+iuNWhYCH/htrbZOMbNuNg6NxwUYA1HeEpegPRsLtZZa0tguVJSyfuo/ m5XoxLC7LQToiZMpoHtd2aNmVgviQnqP3PUxyYCQCfIW/YpzcbfhvBBw4dJUEUQXQy6d 48cU8Q0OqLsbglRdlorK5IgoaQxOkBEOySCx7GXqAKOXlkLDpVTPywcEG6OJcDk4BBcI Tk0vGYa2oCbCM6J1KLAY88XO1ENvydF3oYHmvQtU0EOwxlQHnrNCa0kd7a7fYt1Zkxsz kJlQE1P+eEeCLwrZ/cQKZdM+pOB9xCtI81s/A+/B92D1y21JcYbiAWmjtb40kPdGaHzo Dn6A== X-Gm-Message-State: AOJu0Ywk5J90iOPjF/B57VaamoMouHK8FtsAuwwbksz4nxi2/K8Rz4J4 IcC8h0ci7wVM+RPzdTsvsHXLUlHbaFlbuVPu8pGSh05DRnZnf36odD0QxQ== X-Received: by 2002:a05:600c:4ec9:b0:419:ed35:e312 with SMTP id g9-20020a05600c4ec900b00419ed35e312mr5807273wmq.21.1713795964857; Mon, 22 Apr 2024 07:26:04 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:26:04 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:45 +0100 Message-ID: <20240422142547.281064-8-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 7/9] avformat/http: Add option to limit total reconnect delay 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: ldIV8HEPdt+I The existing option only allows users to set the max delay for a single attempt, rather than the total allowed delay, which is both pretty unintitive, and only applicable when exponential backoff is used. The default for this option is set to 256, which is just above the effective total delay accomplished by the the existing reconnect_delay_max default of 120. Signed-off-by: Derek Buitenhuis --- libavformat/http.c | 12 ++++++++++-- libavformat/version.h | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/libavformat/http.c b/libavformat/http.c index 06bd3e340e..930c115ec3 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -141,6 +141,7 @@ typedef struct HTTPContext { int respect_retry_after; unsigned int retry_after; int reconnect_max_retries; + int reconnect_delay_total_max; } HTTPContext; #define OFFSET(x) offsetof(HTTPContext, x) @@ -180,6 +181,7 @@ static const AVOption options[] = { { "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 }, + { "reconnect_delay_total_max", "max total reconnect delay in seconds after which to give up", OFFSET(reconnect_delay_total_max), AV_OPT_TYPE_INT, { .i64 = 256 }, 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 }, @@ -363,6 +365,7 @@ static int http_open_cnx(URLContext *h, AVDictionary **options) HTTPContext *s = h->priv_data; int ret, conn_attempts = 1, auth_attempts = 0, redirects = 0; int reconnect_delay = 0; + int reconnect_delay_total = 0; uint64_t off; char *cached; @@ -389,7 +392,8 @@ redo: if (ret < 0) { if (!http_should_reconnect(s, ret) || reconnect_delay > s->reconnect_delay_max || - (s->reconnect_max_retries >= 0 && conn_attempts > s->reconnect_max_retries)) + (s->reconnect_max_retries >= 0 && conn_attempts > s->reconnect_max_retries) || + reconnect_delay_total > s->reconnect_delay_total_max) goto fail; if (s->respect_retry_after && s->retry_after > 0) { @@ -403,6 +407,7 @@ redo: ret = ff_network_sleep_interruptible(1000U * 1000 * reconnect_delay, &h->interrupt_callback); if (ret != AVERROR(ETIMEDOUT)) goto fail; + reconnect_delay_total += reconnect_delay; reconnect_delay = 1 + 2 * reconnect_delay; conn_attempts++; @@ -1710,6 +1715,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 reconnect_delay_total = 0; int conn_attempt = 1; if (!s->hd) @@ -1739,13 +1745,15 @@ 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 || (s->reconnect_max_retries >= 0 && conn_attempt > s->reconnect_max_retries)) + if (reconnect_delay > s->reconnect_delay_max || (s->reconnect_max_retries >= 0 && conn_attempt > s->reconnect_max_retries) || + reconnect_delay_total > s->reconnect_delay_total_max) 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)); err = ff_network_sleep_interruptible(1000U*1000*reconnect_delay, &h->interrupt_callback); if (err != AVERROR(ETIMEDOUT)) return err; + reconnect_delay_total += reconnect_delay; reconnect_delay = 1 + 2*reconnect_delay; conn_attempt++; seek_ret = http_seek_internal(h, target, SEEK_SET, 1); diff --git a/libavformat/version.h b/libavformat/version.h index 41dbd4ad01..5310326bda 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 102 +#define LIBAVFORMAT_VERSION_MICRO 103 #define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ LIBAVFORMAT_VERSION_MINOR, \ From patchwork Mon Apr 22 14:25:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48218 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325659pzb; Mon, 22 Apr 2024 07:26:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCU0NdXuGO1KvU88s7V7+bP8Wt6TonFrgSGh+2WVJFGheRUHHl7DdYlD+zsUgq7HPWNtP1vHefUCd2rIX9n0EpW3eD3ZlQ5BX/LEAQ== X-Google-Smtp-Source: AGHT+IH6GcVtoESZnsar/wQATSubLM8JLUIPMbhvWGbEq8Hdq8F8jlcFrCYrLjx48IdJEEYqn6Wt X-Received: by 2002:a17:907:940c:b0:a55:b577:d2f with SMTP id dk12-20020a170907940c00b00a55b5770d2fmr2288071ejc.71.1713796015308; Mon, 22 Apr 2024 07:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796015; cv=none; d=google.com; s=arc-20160816; b=fqpGfPi3wyK/0E6zcS+43KGfqzPOt3swTQU0bNf7fJ8AWztpMcWzR8Dwt1/0VHpmEM TytDnOBt7OO93j+J/iLneLdmZc34UTCvdkUPr8rNfsHfVKj8yov1Op4028FGnbmBLQoE hDpObybYvDyFIGqAuuOLNEJWnFBpJ1ID7jejRgetxjn3gQDq0EKRekOJwITaOB+steqn Gm/u95yVAOkr8n3sX0dU4UutmKCJdxH+2QZSD3+mWlDzDufaEGnd+1hg7EUIQVVSIXgX J/5Clb3dQxx2svGI5V7Fi1tw/gR5uKqziAviF2Hwn9EoSO90uwp71xmUMwoVTuhR2UU0 7NLg== 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=OKPKNnP7ntfjkWrNhlwZsBNzjYXlH0sZhSCWE+I26BdxoLlVs5d18enOmZuMrLfr+r 0kHT91eSM8u2TZExqkLLl3PUBRHRC+zhZQFU1mf9EcX2dB2xQTZIFguFwe7oIkC4XwSF GUl1S5gHlVnAzHFnGPZ+YsbUkYJloyBNEWCmU9t6Oh9NCcJCDSGqAa/s8Gh/V9KngWGH AAbad3xKvOQvifoz3OGIo2bbnnVt8bzVfCQUN8ETI9o7gQMn0syt0axcIlAT3PeU6rGr qJpJZbmKrHLPcilu8iWZNwDe6dCvMJUvvkj4c2+inal0YgTMBwYJnaqixgQUvTWFNcfk fbAg==; 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=JkXYXyC1; 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 z24-20020a170906715800b00a51e004de4bsi5672119ejj.763.2024.04.22.07.26.54; Mon, 22 Apr 2024 07:26:55 -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=JkXYXyC1; 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 B2CB968D355; Mon, 22 Apr 2024 17:26:12 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 437E768D308 for ; Mon, 22 Apr 2024 17:26:08 +0300 (EEST) Received: by mail-wm1-f43.google.com with SMTP id 5b1f17b1804b1-41a72f3a20dso5679715e9.0 for ; Mon, 22 Apr 2024 07:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795966; x=1714400766; 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=JkXYXyC12qeTrwlAT1AvccMTke4WYLox+hR9812ed9pvVDn00Uws3MPj6D0Vl8gmWB +dhoH00CySVgsm0OFPQWk2MUClVStZ5n0fNkpP4RHeUcwWRBtyI6M87XB2xV3R+THHGX 7YylWiaWYanc5rXGA6EryzXameZQaKK0MxGDiva1hKAidYqmvKWszUQaTQLQGbpwXe23 y7g8BmZN69+fDGLjLuH/GwOZyLZCcIihcLf6zV3c9QS+UrTq5bZVdSKlf+UGQOMGFxLR 9thUs1aDB6Kxe8+tonCoD31XqniZqiooaIOesjYZ3mI5pTpkTfSGo1js1m4rjbEtR2ZX JTIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795966; x=1714400766; 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=iEN3vxKVidbdofU4TZaC8a8x49LaYO+fUKtjH/s4ecfdTQwI0TrZgf3P/c78QlGz2p GM1m32f6LOmIw0MEI4OQNCsPYEn78NKNngKRRZVl6OX8A7J/CvYKGSYVjEeZPJ5BTxQQ RY+ykycVkf+qjMB3dXB4XTfQWpEfp5WrBKYNEfsAtOqDi+00VuftpoTw6pQn/uK1qncY 40wJAPJtlUWkrxW/kAT73wHqqQY6D5olMnYVrjknZ6FfxrpFQkEhdCXhI5bU5qGPlrPm rFiLpxQmQ9AHVV4C9g3SPEMQSSxqoQ/Hj831qpuITIUxhS82F+g6zZcOty++P+1SnkQo O6hw== X-Gm-Message-State: AOJu0YwqKkt1ohjUIw7fZdr8XHiBCdAj4SKK9BLRY6Wym6/LzPITms1N lYgnslnhwVvh/Ue3pHJLurCM2XIRvbg/jsC1kEUGsnGinQgED+VM9WwsHQ== X-Received: by 2002:a05:600c:5020:b0:41a:66ef:e543 with SMTP id n32-20020a05600c502000b0041a66efe543mr1395276wmr.19.1713795966445; Mon, 22 Apr 2024 07:26:06 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.26.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:26:05 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:46 +0100 Message-ID: <20240422142547.281064-9-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 8/9] 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: gD1I4goQ2E/z 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 Mon Apr 22 14:25:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Derek Buitenhuis X-Patchwork-Id: 48219 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:c906:b0:1a9:af23:56c1 with SMTP id gx6csp2325742pzb; Mon, 22 Apr 2024 07:27:04 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWvc/hlU3vdw5gwHCaioVgvj/W5kJlCxNBEij/ztfEE5seY9UA8mgz2FvO7WuVzPekTpI618Fi6y2x6NibnQWaP0pCKU3UyJAw7AQ== X-Google-Smtp-Source: AGHT+IEdTwQM6WaiuZ8Hb1d8ph1WwnYjncHzA2b9BVx/im/dHZC2XjCcSClXgRgf2UkiMZlux/BZ X-Received: by 2002:ac2:5bd2:0:b0:518:c3b7:bc0 with SMTP id u18-20020ac25bd2000000b00518c3b70bc0mr5481827lfn.10.1713796024169; Mon, 22 Apr 2024 07:27:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1713796024; cv=none; d=google.com; s=arc-20160816; b=f2pVBvlYlRDWCJerEhHGuFTqCjJBBMjCe0ROl249Ea5RDYU1TgBEx5PxlM/6DDLf01 sT+YB9714hYznkc+18OHHEoLaGbfeqtzL/aj0qiB1wOAYjbSwcCPkG/A8m9D+SW2WtPp M88Q6E9ZTHtqmlTbbibtZeS5rTJpPPlugM2TN79c0IyzH55dhaYQtIrQQ5nLAo8IS2kT t4+ak4Eummhen+CLdmLSTEwtbp+k2j8j5AvohklvXTaxoEMYwNif/fUGWW1COiEgpAwC Y3pYRLqqCgL8sEyiRDJuNSQqNF5pk6+P6zM4cC+opwFENnW1zHONxK+6uyD0l4hL8i+Q JSSg== 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=XCfAnexJFwvzQTGn4P+ixAY7Y6KGPUMncMHkToDwN34=; fh=YOA8vD9MJZuwZ71F/05pj6KdCjf6jQRmzLS+CATXUQk=; b=D8pFpzmvVHc8KGJehljOyAnS5yeuLrRbNy9vH8glwLZ1JTB4iFIjqT0h4E1ty96svh xWaKVUQh6Q4Od3MexoW0oLz9ropUq5jrvmDjl2A+gq/rve/s7JjhMZMy8GWmLA0d9HmS MaOc676MwB3ZXfW2ULO0ia6nRKidB8V6XeExZONh3HLvaIXc5IsOnI7QmItvVFp3LA63 qJ5teO7SHE5mpNgBLlX0T6Wuy/VFT6yo2TW8/dmlejpkEd0tRBxPETffca3BNoVpKFwv RQ5GflLdevyMPJKSDYmBTnz8T12lHAAi9Q4ZwOSC66QtmGWB+E+Yxcx/FVnwLDV1QWaq dtnQ==; 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=i2gvwtyU; 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 r7-20020a170906350700b00a51fc671857si5964590eja.457.2024.04.22.07.27.03; Mon, 22 Apr 2024 07:27:04 -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=i2gvwtyU; 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 C130768D2BB; Mon, 22 Apr 2024 17:26:13 +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 19C2F68D2D6 for ; Mon, 22 Apr 2024 17:26:08 +0300 (EEST) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-41a5b68ed0aso6524195e9.2 for ; Mon, 22 Apr 2024 07:26:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713795967; x=1714400767; 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=JSHq4hFzOGO2Ykaw/26pb9JQBSR968l3EqcOazb7rsc=; b=i2gvwtyUG1Ixn2xmRS0hefj1XBiEjVk15LWL/z1/ayaia4GsjOR6X9E7FtnIZY/tWL EbkBcUUIxgt7fPCfdCyd5GsnZ/ejgjlUojWxmLpY5Kx6iZvMPwdB9Q91/taEeucUDpm1 vdUTCdQm7KptBokD+dvvd2qACsgYcZ4Tv1xu2jrR01GIR2U6EcQYhiB2/5aZGVoAyWuu TCO3B5gF1NMfvhKfsdFqCER7JAUO4G/lbbjK4CQ6i01ijiPLFOHMjV9GZ9sXSulXd1t6 SIg/hI1mVhWkmn0aFOMHuWjGIQk0g9CTowjhxRJuBhkeIVLDUDf7pvmHUDPyDi2QspzN bbHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713795967; x=1714400767; 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=JSHq4hFzOGO2Ykaw/26pb9JQBSR968l3EqcOazb7rsc=; b=dx3TVL5OCf+ABWmveLVTBOcA1pbLJTYDn0tAzoTZ3tWr+fP/2StpOVmBK+HTZIANqw 6q7s7nvNI+XwGAC/xWCkmZPkE82/krLKA6rtASY1se9HVxXID7GR2MgPrVWznf3LGnnL 6Ll1KBr4AS8cAr40UKHvzUnliyCiizatp2/Abe6/PYmWHUZc0rSTfYZKDSM3zLh3ipWg yli8nDwjB2wTpbB1CJk37VlAdXcwk7nfB3OWAnT1mIL0AZEkd5NOH5I7sB8HYl+cP885 6El+9Qscm/KtnLZWG2VK+si1ITx0Fnuzk6Bl24Q0nJdcTeKjknp0s1k1AL/Mp8jluqE8 wQEw== X-Gm-Message-State: AOJu0Yzf3zc+56+eakSUa/zaUpWZ+Qa4MoOwn6SotAE9ALypj7ceOljK qwCwSG15c8UExu8kkQ+Ks6c5OUZfmuOAI3X5YdM6EMCJhqfqTNw7Fx62XQ== X-Received: by 2002:a05:600c:4f43:b0:41a:226f:d481 with SMTP id m3-20020a05600c4f4300b0041a226fd481mr3149844wmq.39.1713795967243; Mon, 22 Apr 2024 07:26:07 -0700 (PDT) Received: from localhost.localdomain (33bf3d9d.skybroadband.com. [51.191.61.157]) by smtp.gmail.com with ESMTPSA id d11-20020a05600c3acb00b0041aa14b4646sm67111wms.8.2024.04.22.07.26.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 07:26:06 -0700 (PDT) From: Derek Buitenhuis To: ffmpeg-devel@ffmpeg.org Date: Mon, 22 Apr 2024 15:25:47 +0100 Message-ID: <20240422142547.281064-10-derek.buitenhuis@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240422142547.281064-1-derek.buitenhuis@gmail.com> References: <20240422142547.281064-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2 9/9] 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: iHWJHegvTTFZ Signed-off-by: Derek Buitenhuis --- doc/protocols.texi | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/protocols.texi b/doc/protocols.texi index 5ce1ddc8f4..ed70af4b33 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 +Set 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. @@ -550,7 +561,18 @@ include specific status codes (e.g. '503') or the strings '4xx' / '5xx'. 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 +Set the maximum delay in seconds after which to give up reconnecting. + +@item reconnect_max_retries +Set the maximum number of times to retry a connection. Default unset. + +@item reconnect_delay_total_max +Set the maximum total delay in seconds after which to give up reconnecting. + +@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 @@ -578,6 +600,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 +Set 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