Переглянути джерело

[image] Omit URI query string and fragment from download progress messages

The URIs printed as part of download progress messages are intended to
provide a quick visual progress indication to the user.  Very long
query strings can render this visual indication useless in practice,
since the most important information (generally the URI host and path)
is drowned out by multiple lines of human-illegible URI-encoded data.

Omit the query string entirely from the download progress message.
For consistency and brevity, also omit the URI fragment along with the
username and password (which was previously redacted anyway).

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 6 роки тому
джерело
коміт
be9ed2848d
1 змінених файлів з 7 додано та 6 видалено
  1. 7
    6
      src/usr/imgmgmt.c

+ 7
- 6
src/usr/imgmgmt.c Переглянути файл

@@ -50,16 +50,17 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
50 50
  */
51 51
 int imgdownload ( struct uri *uri, unsigned long timeout,
52 52
 		  struct image **image ) {
53
-	const char *password;
53
+	struct uri uri_redacted;
54 54
 	char *uri_string_redacted;
55 55
 	int rc;
56 56
 
57 57
 	/* Construct redacted URI */
58
-	password = uri->password;
59
-	if ( password )
60
-		uri->password = "***";
61
-	uri_string_redacted = format_uri_alloc ( uri );
62
-	uri->password = password;
58
+	memcpy ( &uri_redacted, uri, sizeof ( uri_redacted ) );
59
+	uri_redacted.user = NULL;
60
+	uri_redacted.password = NULL;
61
+	uri_redacted.query = NULL;
62
+	uri_redacted.fragment = NULL;
63
+	uri_string_redacted = format_uri_alloc ( &uri_redacted );
63 64
 	if ( ! uri_string_redacted ) {
64 65
 		rc = -ENOMEM;
65 66
 		goto err_uri_string;

Завантаження…
Відмінити
Зберегти