From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS
Date: Wed, 24 Apr 2024 13:58:08 +0300 (EEST)
Message-ID: <90304d9b-d2cd-bf6-88c2-1fb95982e75f@martin.st> (raw)
In-Reply-To: <20240422142547.281064-3-derek.buitenhuis@gmail.com>
On Mon, 22 Apr 2024, Derek Buitenhuis wrote:
> Added in thep previous commit.
>
> Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
> ---
> 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:
This function seems to handle both the literal status codes, like 429, and
also AVERROR style error codes, as when called from handle_http_errors, so
perhaps it would be good for consistency to add the AVERROR here too.
// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2024-04-24 10:58 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-22 14:25 [FFmpeg-devel] [PATCH v2 0/9] HTTP rate limiting and retry improvements Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 1/9] avutil/error: Add HTTP 429 Too Many Requests AVERROR code Derek Buitenhuis
2024-04-22 15:20 ` Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS Derek Buitenhuis
2024-04-24 10:53 ` Martin Storsjö
2024-04-24 19:40 ` Derek Buitenhuis
2024-04-24 10:58 ` Martin Storsjö [this message]
2024-04-24 19:41 ` Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 3/9] avformat/http: Don't bail on parsing headers on "bad" HTTP codes Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 4/9] avformat/http: Add support for Retry-After header Derek Buitenhuis
2024-04-24 11:06 ` Martin Storsjö
2024-04-24 19:40 ` Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 5/9] avformat/http: Rename attempts to auth_attempts Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 6/9] avformat/http: Add options to set the max number of connection retries Derek Buitenhuis
2024-04-24 11:08 ` Martin Storsjö
2024-04-24 19:42 ` Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 7/9] avformat/http: Add option to limit total reconnect delay Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 8/9] doc/protocols: Re-order HTTP options to match http.c order Derek Buitenhuis
2024-04-22 14:25 ` [FFmpeg-devel] [PATCH v2 9/9] doc/protocols: Fill in missing HTTP options Derek Buitenhuis
2024-04-24 11:13 ` [FFmpeg-devel] [PATCH v2 0/9] HTTP rate limiting and retry improvements Martin Storsjö
2024-04-24 19:43 ` Derek Buitenhuis
2024-04-25 13:27 ` Derek Buitenhuis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=90304d9b-d2cd-bf6-88c2-1fb95982e75f@martin.st \
--to=martin@martin.st \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git