diff --git a/src/tool_writeout.c b/src/tool_writeout.c
index 7892b68a8b..fed81acb0b 100644
--- a/src/tool_writeout.c
+++ b/src/tool_writeout.c
@@ -200,7 +200,7 @@ static int urlpart(struct per_transfer *per, writeoutid vid,
char *part = NULL;
const char *url = NULL;
- if(vid >= VAR_INPUT_URLEHOST) {
+ if(vid >= VAR_INPUT_URLESCHEME) {
if(curl_easy_getinfo(per->curl, CURLINFO_EFFECTIVE_URL, &url))
rc = 5;
}
diff --git a/src/tool_writeout.h b/src/tool_writeout.h
index 77ceaff1c4..7b3ca7bd02 100644
--- a/src/tool_writeout.h
+++ b/src/tool_writeout.h
@@ -57,7 +57,7 @@ typedef enum {
VAR_INPUT_URLFRAGMENT,
VAR_INPUT_URLZONEID,
/* the same ones again for url *effective* */
- VAR_INPUT_URLESCHEME,
+ VAR_INPUT_URLESCHEME, /* keep this the first URLE* variable */
VAR_INPUT_URLEUSER,
VAR_INPUT_URLEPASSWORD,
VAR_INPUT_URLEOPTIONS,
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index aa329174a5..619a97d8f0 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -77,6 +77,7 @@ test435 test436 test437 test438 test439 test440 test441 test442 test443 \
test444 test445 test446 test447 test448 test449 test450 test451 test452 \
test453 test454 test455 test456 test457 test458 test459 test460 test461 \
test462 test463 test467 test468 test469 test470 test471 test472 test473 \
+test474 \
\
test490 test491 test492 test493 test494 test495 test496 test497 test498 \
test499 test500 test501 test502 test503 test504 test505 test506 test507 \
diff --git a/tests/data/test424 b/tests/data/test424
index 36ba8c4b74..9ae6b1fab9 100644
--- a/tests/data/test424
+++ b/tests/data/test424
@@ -59,10 +59,10 @@ http
# Verify data after the test has been "shot"
-anotherhost.example+/%TESTNUMBER0002+http+uuuu+pppp+2023+moo.html+
-hello2000+/%TESTNUMBER+h55p+++1+qqqq+ffff
+anotherhost.example+/4240002+http+++2023+moo.html+
+hello2000+/424+h55p+++1+qqqq+ffff
+++++++
-anotherhost.example+/%TESTNUMBER0002+http+u22u+p22p+2023+moo.html+
+anotherhost.example+/4240002+http+++2023+moo.html+
diff --git a/tests/data/test474 b/tests/data/test474
new file mode 100644
index 0000000000..37e0805b5e
--- /dev/null
+++ b/tests/data/test474
@@ -0,0 +1,52 @@
+
+
+
+-w
+--write-out
+
+
+
+#
+# Server-side
+
+
+HTTP/1.1 301 OK
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Content-Length: 0
+Connection: close
+Content-Type: text/html
+Location: https://%HOSTIP:%HTTPSPORT/%TESTNUMBER0002
+
+
+
+HTTP/1.1 200 OK
+Date: Tue, 09 Nov 2010 14:49:00 GMT
+Content-Length: 0
+Connection: close
+
+
+
+
+#
+# Client-side
+
+
+http
+https
+
+
+-w urle.scheme after HTTP to HTTPS redirect
+
+
+-k -L http://%HOSTIP:%HTTPPORT/%TESTNUMBER -w "%{num_redirects} %{url_effective} %{urle.scheme}\n"
+
+
+
+#
+# Verify data after the test has been "shot"
+
+
+1 https://%HOSTIP:%HTTPSPORT/%TESTNUMBER0002 https
+
+
+