Skip to content
Suresoft-GLaDOS edited this page May 26, 2023 · 8 revisions

#1

Link : https://gitlab.com/gnuwget/wget2/commit/9a9bb472501202d1d34523e4a60b4468c78fbe9a
Description: Remove n_recurse_iris.

At src/wget.c

@@ -3304,7 +3304,7 @@ static int WGET_GCC_NONNULL((1)) prepare_file(wget_http_response *resp, const ch
 	// Load partial content
 	if (partial_content) {
 		long long size = get_file_size(unique[0] ? unique : fname);
+		if (size >= 0) {
-		if (size > 0) {
 			fd = open_unique(fname, O_RDONLY | O_BINARY, 0, multiple, unique, sizeof(unique));
 			if (fd >= 0) {
 				size_t rc;
@@ -3723,7 +3723,7 @@ static wget_http_request *http_create_request(const wget_iri *iri, JOB *job)
 		if (config.continue_download) {
 			long long file_size = get_file_size(local_filename);
+			if (file_size >= 0)
-			if (file_size > 0)
 				wget_http_add_header_printf(req, "Range", "bytes=%lld-", file_size);
 		}

Tags
#Invalid-condition #Multi-line #Modified

#2

Link : https://gitlab.com/gnuwget/wget2/commit/ea2a463451b72b65fa1743d21bd2cac858edbc73
Description: Tune clash checks

At src/wget.c

@@ -3305,7 +3305,7 @@ static int WGET_GCC_NONNULL((1)) prepare_file(wget_http_response *resp, const ch
 			flag = O_TRUNC;
 	} else if (!config.clobber || (config.recursive && config.directories)) {
 		// debug_printf("oflag=%02x recursive %d directories %d page_requsites %d clobber %d\n",oflag,config.recursive,config.directories,config.page_requisites,config.clobber);
+		if (oflag == O_TRUNC && (!(config.recursive && config.directories) || !config.clobber)) {
-		if (oflag == O_TRUNC && (!(config.recursive && config.directories) || (config.page_requisites && !config.clobber))) {
 			flag = O_EXCL;
 		}
 	} else if (flag != O_APPEND) {
@@ -3390,13 +3390,13 @@ static int WGET_GCC_NONNULL((1)) prepare_file(wget_http_response *resp, const ch
 		// TODO SAVE UNIQUE-NESS
 	} else {
 		if (fd == -1) {
+			if (errno == EEXIST && is_file(fname)) {
-			if (errno == EEXIST) {
 				error_printf(_("File '%s' already there; not retrieving.\n"), fname);
 				if (config.page_requisites && !config.clobber) {
 					parse_localfile(job, job->local_filename, config.remote_encoding, resp->content_type, job->iri);
 				}
+			} else if (errno == EISDIR || is_directory(fname))
-			} else if (errno == EISDIR)
 				info_printf(_("Directory / file name clash - not saving '%s'\n"), fname);
 			else {
 				error_printf(_("Failed to open '%s' (errno=%d): %s\n"), fname, errno, strerror(errno));

Tags
#Invalid-condition #Multi-line #Modified

#3

Link : https://gitlab.com/gnuwget/wget2/commit/5645e709a27f98aef4527480e713d991bac95cc0
Description: New file added

At libwget/decompressor.c

@@ -530,7 +530,7 @@ wget_decompressor *wget_decompress_open(
 			dc->exit = bzip2_exit;
 		}
 #endif
+	} else if (encoding == wget_content_encoding_lzma || encoding == wget_content_encoding_xz) {
-	} else if (encoding == wget_content_encoding_lzma) {
 #ifdef WITH_LZMA
 		if ((rc = lzma_init(&dc->lzma_strm)) == 0) {
 			dc->decompress = lzma_decompress;
@@ -562,8 +562,7 @@ wget_decompressor *wget_decompress_open(
 	if (!dc->decompress) {
 		// identity
+		if (encoding != wget_content_encoding_identity)
+			debug_printf("Falling back to Content-Encoding 'identity'\n");
-		debug_printf("Falling back to Content-Encoding 'identity'\n");
 		dc->decompress = identity;
 	}

Tags
#Invalid-condition #Multi-line #Modified

Clone this wiki locally