diff mbox series

[FFmpeg-devel,1/6] avutil/error: Add HTTP 429 Too Many Requests AVERROR code

Message ID 20240415162741.110374-2-derek.buitenhuis@gmail.com
State New
Headers show
Series HTTP rate limiting and retry improvements | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Derek Buitenhuis April 15, 2024, 4:27 p.m. UTC
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 <derek.buitenhuis@gmail.com>
---
 libavutil/error.h   | 1 +
 libavutil/version.h | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Andreas Rheinhardt April 15, 2024, 4:31 p.m. UTC | #1
Derek Buitenhuis:
> 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 <derek.buitenhuis@gmail.com>
> ---
>  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, \

Wouldn't you need to add a new entry to error_entries in error.c for this?

- Andreas
Derek Buitenhuis April 15, 2024, 4:43 p.m. UTC | #2
On 4/15/2024 5:31 PM, Andreas Rheinhardt wrote:
> Wouldn't you need to add a new entry to error_entries in error.c for this?

You are right, I missed that since grep failed me, as error.c uses macros, and
thus does not contain any AVERROR_HTTP_* directly.

I have sent a v2 for this patch.

- Derek
diff mbox series

Patch

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, \