[pkg-lynx-maint] Bug#1041686: Add support for HTTP Status Code 308 as described in RFC 7238 (with patch)
Joey Schulze
joey at infodrom.org
Sat Jul 22 08:05:17 BST 2023
Package: lynx
Version: 2.9.0dev.12-1
Severity: wishlist
Tags: patch upstream
X-Debbugs-Cc: joey at infodrom.org
Hi,
please add support for HTTP Status Code 308 (Permanent Redirect) to
lynx, at least for the request method GET. This new code has been
specified in RFC 7238 in 2014.
Attached please find a patch for the quilt system which can be easily
integrated.
Please also forward it to the upstream project.
Regards
Joey
-------------- next part --------------
Support HTTP Status Code 308 Permanent Redirect
Code 308 does not allow switching from POST to GET protocol,
thus aborting when doing POST requests.
Index: lynx-2.9.0dev.12/WWW/Library/Implementation/HTTP.c
===================================================================
--- lynx-2.9.0dev.12.orig/WWW/Library/Implementation/HTTP.c
+++ lynx-2.9.0dev.12/WWW/Library/Implementation/HTTP.c
@@ -2213,7 +2213,8 @@ static int HTLoadHTTP(const char *arg,
* 305 Use Proxy.
* 306 Set Proxy.
* 307 Temporary Redirect with method retained.
- * > 308 is unknown.
+ * 308 Permanent Redirect
+ * > 309 is unknown.
*/
if (no_url_redirection || do_head || keep_mime_headers) {
/*
@@ -2267,7 +2268,7 @@ static int HTLoadHTTP(const char *arg,
if (server_status == 305 ||
server_status == 306 ||
- server_status > 307) {
+ server_status > 308) {
/*
* Show user the content, if any, for 305, 306, or unknown
* status. - FM
@@ -2341,6 +2342,19 @@ static int HTLoadHTTP(const char *arg,
HTAlert(gettext("Have POST content. Treating Permanent Redirection as Temporary.\n"));
} else {
permanent_redirection = TRUE;
+ }
+ }
+ if (server_status == 308) { /* Permanent Redirect */
+ if (do_post) {
+ /*
+ * Don't make the redirection permanent if we have
+ * POST content. - FM
+ */
+ CTRACE((tfp,
+ "HTTP: Have POST content. Treating 308 (Permanent) as Temporary.\n"));
+ HTAlert(gettext("Have POST content. Treating Permanent Redirection as Temporary.\n"));
+ } else {
+ permanent_redirection = TRUE;
}
}
doing_redirect = TRUE;
More information about the pkg-lynx-maint
mailing list