summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Satiro <raysatiro@yahoo.com>2023-05-03 14:48:04 -0400
committerJay Satiro <raysatiro@yahoo.com>2023-05-05 02:52:23 -0400
commit30ba26d9c3f6c98024e47934279a8b5f3d5591ca (patch)
treeae1dce4b54e2fde4504c9139529ad05355370ea1
parent89f6fafedbb57b62fddf58223cfa92307bf51a68 (diff)
downloadcurl-30ba26d9c3f6c98024e47934279a8b5f3d5591ca.tar.gz
tool_cb_hdr: Fix 'Location:' formatting for early VTE terminals
- Disable hyperlink formatting for the 'Location:' header value in VTE 0.48.1 and earlier, since it is buggy in some of those versions. Prior to this change those terminals may show the location header value as gibberish or show it twice. Ref: https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda#backward-compatibility Fixes https://github.com/curl/curl/issues/10428 Closes https://github.com/curl/curl/pull/11071
-rw-r--r--src/tool_cb_hdr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/tool_cb_hdr.c b/src/tool_cb_hdr.c
index 04817af6c..ed22ef460 100644
--- a/src/tool_cb_hdr.c
+++ b/src/tool_cb_hdr.c
@@ -344,6 +344,15 @@ void write_linked_location(CURL *curl, const char *location, size_t loclen,
char *copyloc = NULL, *locurl = NULL, *scheme = NULL, *finalurl = NULL;
const char *loc = location;
size_t llen = loclen;
+ char *vver = getenv("VTE_VERSION");
+
+ if(vver) {
+ long vvn = strtol(vver, NULL, 10);
+ /* Skip formatting for old versions of VTE <= 0.48.1 (Mar 2017) since some
+ of those versions have formatting bugs. (#10428) */
+ if(0 < vvn && vvn <= 4801)
+ goto locout;
+ }
/* Strip leading whitespace of the redirect URL */
while(llen && *loc == ' ') {