diff --git a/res/about/version.gmi b/res/about/version.gmi

index 8c88c024..0a430b58 100644

--- a/res/about/version.gmi

+++ b/res/about/version.gmi

@@ -6,6 +6,9 @@

Release notes



+## 1.15.3

+* Fixed handling of redirects in the inline media player and file downloader.

+

1.15.2

diff --git a/src/gmrequest.c b/src/gmrequest.c

index aaee50c0..3fe638d2 100644

--- a/src/gmrequest.c

+++ b/src/gmrequest.c

@@ -1142,6 +1142,10 @@ iBool isFinished_GmRequest(const iGmRequest *d) {

 return iTrue;

}



+iBool filtersEnabled_GmRequest(const iGmRequest *d) {

+ return d->isFilterEnabled;

+}

+

enum iGmStatusCode status_GmRequest(const iGmRequest *d) {

 if (d) {

     enum iGmStatusCode code;

diff --git a/src/gmrequest.h b/src/gmrequest.h

index 1ad4b7f3..634a7b62 100644

--- a/src/gmrequest.h

+++ b/src/gmrequest.h

@@ -83,6 +83,7 @@ void unlockResponse_GmRequest (iGmRequest *);



uint32_t id_GmRequest (const iGmRequest ); / unique ID */

iBool isFinished_GmRequest (const iGmRequest *);

+iBool filtersEnabled_GmRequest (const iGmRequest *);

enum iGmStatusCode status_GmRequest (const iGmRequest *);

const iString * meta_GmRequest (const iGmRequest *);

const iBlock * body_GmRequest (const iGmRequest *);

diff --git a/src/media.c b/src/media.c

index 57f126a2..f9ac0a2d 100644

--- a/src/media.c

+++ b/src/media.c

@@ -641,6 +641,19 @@ void deinit_MediaRequest(iMediaRequest *d) {

 iRelease(d->req);

}



+void resubmitWithUrl_MediaRequest(iMediaRequest *d, const iString *url) {

+ iAssert(d->req);

+ iAssert(isFinished_GmRequest(d->req));

+ const iBool enableFilters = filtersEnabled_GmRequest(d->req);

+ deinit_MediaRequest(d); /* release request, disconnect audiences */

+ d->req = new_GmRequest(certs_App());

+ setUrl_GmRequest(d->req, url);

+ enableFilters_GmRequest(d->req, enableFilters);

+ iConnect(GmRequest, d->req, updated, d, updated_MediaRequest_);

+ iConnect(GmRequest, d->req, finished, d, finished_MediaRequest_);

+ submit_GmRequest(d->req);

+}

+

iMediaRequest *newReused_MediaRequest(iDocumentWidget *doc, unsigned int linkId,

                                   iGmRequest *request) {

 iMediaRequest *d = new_Object(&Class_MediaRequest);

diff --git a/src/media.h b/src/media.h

index 73ea9d83..0a818ec9 100644

--- a/src/media.h

+++ b/src/media.h

@@ -124,5 +124,7 @@ struct Impl_MediaRequest {

iDeclareObjectConstructionArgs(MediaRequest, iDocumentWidget *doc, unsigned int linkId,

                            const iString *url, iBool enableFilters)

 

+void resubmitWithUrl_MediaRequest (iMediaRequest *, const iString *url);

+ 

iMediaRequest * newReused_MediaRequest (iDocumentWidget *doc, unsigned int linkId,

                                      iGmRequest *request);

diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c

index 6fdac976..6e73a891 100644

--- a/src/ui/documentwidget.c

+++ b/src/ui/documentwidget.c

@@ -3741,6 +3741,19 @@ static iBool handleMediaCommand_DocumentWidget_(iDocumentWidget *d, const char *

             refresh_Widget(as_Widget(d));

         }

     }

+ else if (category_GmStatusCode(code) == categoryRedirect_GmStatusCode) {

+ if (d->redirectCount++ < 5) {

+ /* Redo the request. */

+ iString *url = copy_String(meta_GmRequest(req->req));

+ resubmitWithUrl_MediaRequest(req, url);

+ delete_String(url);

+ }

+ else {

+ const iGmError *err = get_GmError(tooManyRedirects_GmStatusCode);

+ makeSimpleMessage_Widget(format_CStr(uiTextCaution_ColorEscape "%s", err->title), err->info);

+ removeMediaRequest_DocumentWidget_(d, req->linkId);

+ }

+ }

     else {

         const iGmError *err = get_GmError(code);

         makeSimpleMessage_Widget(format_CStr(uiTextCaution_ColorEscape "%s", err->title), err->info);

Proxy Information
Original URL
gemini://git.skyjake.fi/lagrange/release/pcdiff/8bbdcbca728de93d4249f9569d56c008e07f73d6
Status Code
Success (20)
Meta
text/plain
Capsule Response Time
78.80128 milliseconds
Gemini-to-HTML Time
2.386082 milliseconds

This content has been proxied by September (ba2dc).