Re: [FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS

2024-04-24 Thread Derek Buitenhuis
On 4/24/2024 11:58 AM, Martin Storsjö wrote:
> 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.

Good catch. Added.

- Derek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS

2024-04-24 Thread Derek Buitenhuis
On 4/24/2024 11:53 AM, Martin Storsjö wrote:
> Typo in the commit message

Fixed locally.

- Derek
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS

2024-04-24 Thread Martin Storsjö

On Mon, 22 Apr 2024, Derek Buitenhuis wrote:


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:


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-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS

2024-04-24 Thread Martin Storsjö

On Mon, 22 Apr 2024, Derek Buitenhuis wrote:


Added in thep previous commit.


Typo in the commit message

// 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-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-devel] [PATCH v2 2/9] avformat/http: Use AVERROR_HTTP_TOO_MANY_REQUESTS

2024-04-22 Thread Derek Buitenhuis
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";
-- 
2.43.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".