diff options
author | Alexander M Pickering <alex@cogarr.net> | 2024-11-14 19:34:16 -0600 |
---|---|---|
committer | Alexander M Pickering <alex@cogarr.net> | 2024-11-14 19:34:16 -0600 |
commit | d305666110dfc0ac1aff6804511bff0adf53fed2 (patch) | |
tree | da8cecacd80178f31072ef74baa1e0c192195d80 | |
parent | bc30028b01840a1f1edd1100d4a1ac499096f83c (diff) | |
download | busybox-w32-packaging-d305666110dfc0ac1aff6804511bff0adf53fed2.tar.gz busybox-w32-packaging-d305666110dfc0ac1aff6804511bff0adf53fed2.tar.bz2 busybox-w32-packaging-d305666110dfc0ac1aff6804511bff0adf53fed2.zip |
Rewrite header parsing.
-rw-r--r-- | libressl.patch | 99 |
1 files changed, 52 insertions, 47 deletions
diff --git a/libressl.patch b/libressl.patch index bcc7860..564d620 100644 --- a/libressl.patch +++ b/libressl.patch | |||
@@ -135,7 +135,7 @@ index 9f1dd67ec..7e8da6df2 100644 | |||
135 | static void tls_xwrite(tls_state_t *tls, int len) | 135 | static void tls_xwrite(tls_state_t *tls, int len) |
136 | { | 136 | { |
137 | diff --git a/networking/wget.c b/networking/wget.c | 137 | diff --git a/networking/wget.c b/networking/wget.c |
138 | index 6a64836fb..0a8e282cc 100644 | 138 | index 6a64836fb..918ad6812 100644 |
139 | --- a/networking/wget.c | 139 | --- a/networking/wget.c |
140 | +++ b/networking/wget.c | 140 | +++ b/networking/wget.c |
141 | @@ -169,7 +169,11 @@ | 141 | @@ -169,7 +169,11 @@ |
@@ -191,7 +191,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
191 | /* IPv6 knows scoped address types i.e. link and site local addresses. Link | 191 | /* IPv6 knows scoped address types i.e. link and site local addresses. Link |
192 | * local addresses can have a scope identifier to specify the | 192 | * local addresses can have a scope identifier to specify the |
193 | * interface/link an address is valid on (e.g. fe80::1%eth0). This scope | 193 | * interface/link an address is valid on (e.g. fe80::1%eth0). This scope |
194 | @@ -482,32 +519,63 @@ static char* sanitize_string(char *s) | 194 | @@ -482,18 +519,45 @@ static char* sanitize_string(char *s) |
195 | return s; | 195 | return s; |
196 | } | 196 | } |
197 | 197 | ||
@@ -239,12 +239,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
239 | c = *buf_ptr; | 239 | c = *buf_ptr; |
240 | #if 1 | 240 | #if 1 |
241 | /* Disallow any control chars: trim at first char < 0x20 */ | 241 | /* Disallow any control chars: trim at first char < 0x20 */ |
242 | + printf("wget fgets_trim_sanitize 5\n"); | 242 | @@ -504,10 +568,12 @@ static char fgets_trim_sanitize(FILE *fp, const char *fmt) |
243 | sanitize_string(G.wget_buf); | ||
244 | + printf("wget fgets_trim_sanitize 6\n"); | ||
245 | #else | ||
246 | *buf_ptr = '\0'; | ||
247 | buf_ptr = strchrnul(G.wget_buf, '\r'); | ||
248 | *buf_ptr = '\0'; | 243 | *buf_ptr = '\0'; |
249 | #endif | 244 | #endif |
250 | 245 | ||
@@ -257,26 +252,40 @@ index 6a64836fb..0a8e282cc 100644 | |||
257 | 252 | ||
258 | return c; | 253 | return c; |
259 | } | 254 | } |
260 | @@ -636,6 +704,32 @@ static void parse_url(const char *src_url, struct host_info *h) | 255 | @@ -636,6 +702,46 @@ static void parse_url(const char *src_url, struct host_info *h) |
261 | */ | 256 | */ |
262 | } | 257 | } |
263 | 258 | ||
264 | +static char *tls_sanitized_hdr(struct tls *ctx) | 259 | +static int tls_sanitized_hdr(struct tls *ctx, char* start, char **header, char **value) |
265 | +{ | 260 | +{ |
266 | + printf("wget tls_sanitized_hdr 1\n"); | 261 | + printf("wget tls_sanitized_hdr 1\n"); |
267 | + printf("wget_buf was: %s\n",G.wget_buf); | 262 | + printf("wget_buf was: %s\n",G.wget_buf); |
268 | + char *s, *hdrval; | ||
269 | + char c; | 263 | + char c; |
270 | + c = tlsgets_trim_sanitize(ctx, " %s\n"); | 264 | + char *s; |
265 | + //c = tlsgets_trim_sanitize(ctx, " %s\n"); | ||
266 | + if(*start =='\n'){ | ||
267 | + printf("Found end of headers\n"); | ||
268 | + return 0; | ||
269 | + } | ||
271 | + if(G.wget_buf[0] == '\0') | 270 | + if(G.wget_buf[0] == '\0') |
272 | + return NULL; | 271 | + return -1; |
273 | + printf("While getting header, buf was: %s\n", G.wget_buf); | 272 | + printf("While getting header, buf was: %s\n", G.wget_buf); |
273 | + *header = G.wget_buf; | ||
274 | + /* Convert to lowercase */ | ||
274 | + for(s = G.wget_buf; isalnum(*s) || *s == '-' || *s == '.' || *s == '_'; ++s) | 275 | + for(s = G.wget_buf; isalnum(*s) || *s == '-' || *s == '.' || *s == '_'; ++s) |
275 | + *s |= 0x20; | 276 | + *s |= 0x20; |
277 | + /* Find seperator */ | ||
276 | + if(*s != ':') | 278 | + if(*s != ':') |
277 | + bb_error_msg_and_die("Bad header line: %s", G.wget_buf); | 279 | + bb_error_msg_and_die("Bad header line: %s", G.wget_buf); |
278 | + *s++ = '\0'; | 280 | + *s++ = '\0'; |
279 | + hdrval = skip_whitespace(s); | 281 | + s = skip_whitespace(s); |
282 | + *value = s; | ||
283 | + s = strchr(s,'\n'); | ||
284 | + if(*s == NULL) { | ||
285 | + printf("Buffer too small!\n"); | ||
286 | + while (tls_read(ctx, &c, sizeof(char)) == 1 && c != '\n') | ||
287 | + /*Consume the rest of the header */; | ||
288 | + } | ||
280 | + if (c != '\n'){ | 289 | + if (c != '\n'){ |
281 | + printf("buffer too small!\n"); | 290 | + printf("buffer too small!\n"); |
282 | + while (tls_read(ctx,&c,sizeof(char)) == 1 && c != EOF && c != '\n') | 291 | + while (tls_read(ctx,&c,sizeof(char)) == 1 && c != EOF && c != '\n') |
@@ -290,7 +299,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
290 | static char *get_sanitized_hdr(FILE *fp) | 299 | static char *get_sanitized_hdr(FILE *fp) |
291 | { | 300 | { |
292 | char *s, *hdrval; | 301 | char *s, *hdrval; |
293 | @@ -689,6 +783,7 @@ static void reset_beg_range_to_zero(void) | 302 | @@ -689,6 +795,7 @@ static void reset_beg_range_to_zero(void) |
294 | } | 303 | } |
295 | 304 | ||
296 | #if ENABLE_FEATURE_WGET_OPENSSL | 305 | #if ENABLE_FEATURE_WGET_OPENSSL |
@@ -298,7 +307,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
298 | static int spawn_https_helper_openssl(const char *host, unsigned port) | 307 | static int spawn_https_helper_openssl(const char *host, unsigned port) |
299 | { | 308 | { |
300 | char *allocated = NULL; | 309 | char *allocated = NULL; |
301 | @@ -777,6 +872,38 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) | 310 | @@ -777,6 +884,38 @@ static int spawn_https_helper_openssl(const char *host, unsigned port) |
302 | # endif | 311 | # endif |
303 | return sp[0]; | 312 | return sp[0]; |
304 | } | 313 | } |
@@ -337,7 +346,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
337 | #endif | 346 | #endif |
338 | 347 | ||
339 | #if ENABLE_FEATURE_WGET_HTTPS | 348 | #if ENABLE_FEATURE_WGET_HTTPS |
340 | @@ -1151,6 +1278,7 @@ static void download_one_url(const char *url) | 349 | @@ -1151,6 +1290,7 @@ static void download_one_url(const char *url) |
341 | server.user = NULL; | 350 | server.user = NULL; |
342 | target.user = NULL; | 351 | target.user = NULL; |
343 | 352 | ||
@@ -345,7 +354,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
345 | parse_url(url, &target); | 354 | parse_url(url, &target); |
346 | 355 | ||
347 | /* Use the proxy if necessary */ | 356 | /* Use the proxy if necessary */ |
348 | @@ -1172,6 +1300,7 @@ static void download_one_url(const char *url) | 357 | @@ -1172,6 +1312,7 @@ static void download_one_url(const char *url) |
349 | server.host = target.host; | 358 | server.host = target.host; |
350 | } | 359 | } |
351 | } | 360 | } |
@@ -353,7 +362,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
353 | 362 | ||
354 | if (ENABLE_FEATURE_IPV6) | 363 | if (ENABLE_FEATURE_IPV6) |
355 | strip_ipv6_scope_id(target.host); | 364 | strip_ipv6_scope_id(target.host); |
356 | @@ -1191,6 +1320,7 @@ static void download_one_url(const char *url) | 365 | @@ -1191,6 +1332,7 @@ static void download_one_url(const char *url) |
357 | G.fname_out = fname_out_alloc = xstrdup(G.fname_out); | 366 | G.fname_out = fname_out_alloc = xstrdup(G.fname_out); |
358 | } | 367 | } |
359 | } | 368 | } |
@@ -361,7 +370,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
361 | #if ENABLE_FEATURE_WGET_STATUSBAR | 370 | #if ENABLE_FEATURE_WGET_STATUSBAR |
362 | G.curfile = bb_get_last_path_component_nostrip(G.fname_out); | 371 | G.curfile = bb_get_last_path_component_nostrip(G.fname_out); |
363 | #endif | 372 | #endif |
364 | @@ -1206,15 +1336,19 @@ static void download_one_url(const char *url) | 373 | @@ -1206,15 +1348,19 @@ static void download_one_url(const char *url) |
365 | * We are not sure it exists on remote side */ | 374 | * We are not sure it exists on remote side */ |
366 | } | 375 | } |
367 | 376 | ||
@@ -381,7 +390,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
381 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ | 390 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ |
382 | G.got_clen = 0; | 391 | G.got_clen = 0; |
383 | G.chunked = 0; | 392 | G.chunked = 0; |
384 | @@ -1229,37 +1363,64 @@ static void download_one_url(const char *url) | 393 | @@ -1229,37 +1375,64 @@ static void download_one_url(const char *url) |
385 | 394 | ||
386 | /* Open socket to http(s) server */ | 395 | /* Open socket to http(s) server */ |
387 | #if ENABLE_FEATURE_WGET_OPENSSL | 396 | #if ENABLE_FEATURE_WGET_OPENSSL |
@@ -459,7 +468,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
459 | /* Send HTTP request */ | 468 | /* Send HTTP request */ |
460 | if (use_proxy) { | 469 | if (use_proxy) { |
461 | SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n", | 470 | SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n", |
462 | @@ -1270,6 +1431,7 @@ static void download_one_url(const char *url) | 471 | @@ -1270,6 +1443,7 @@ static void download_one_url(const char *url) |
463 | (option_mask32 & WGET_OPT_POST) ? "POST" : "GET", | 472 | (option_mask32 & WGET_OPT_POST) ? "POST" : "GET", |
464 | target.path); | 473 | target.path); |
465 | } | 474 | } |
@@ -467,7 +476,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
467 | if (!USR_HEADER_HOST) | 476 | if (!USR_HEADER_HOST) |
468 | SENDFMT(sfp, "Host: %s\r\n", target.host); | 477 | SENDFMT(sfp, "Host: %s\r\n", target.host); |
469 | if (!USR_HEADER_USER_AGENT) | 478 | if (!USR_HEADER_USER_AGENT) |
470 | @@ -1280,6 +1442,7 @@ static void download_one_url(const char *url) | 479 | @@ -1280,6 +1454,7 @@ static void download_one_url(const char *url) |
471 | */ | 480 | */ |
472 | SENDFMT(sfp, "Connection: close\r\n"); | 481 | SENDFMT(sfp, "Connection: close\r\n"); |
473 | 482 | ||
@@ -475,7 +484,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
475 | #if ENABLE_FEATURE_WGET_AUTHENTICATION | 484 | #if ENABLE_FEATURE_WGET_AUTHENTICATION |
476 | if (target.user && !USR_HEADER_AUTH) { | 485 | if (target.user && !USR_HEADER_AUTH) { |
477 | SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6, | 486 | SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6, |
478 | @@ -1291,6 +1454,7 @@ static void download_one_url(const char *url) | 487 | @@ -1291,6 +1466,7 @@ static void download_one_url(const char *url) |
479 | } | 488 | } |
480 | #endif | 489 | #endif |
481 | 490 | ||
@@ -483,7 +492,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
483 | if (G.beg_range != 0 && !USR_HEADER_RANGE) | 492 | if (G.beg_range != 0 && !USR_HEADER_RANGE) |
484 | SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); | 493 | SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); |
485 | 494 | ||
486 | @@ -1300,6 +1464,7 @@ static void download_one_url(const char *url) | 495 | @@ -1300,6 +1476,7 @@ static void download_one_url(const char *url) |
487 | fputs(G.extra_headers, sfp); | 496 | fputs(G.extra_headers, sfp); |
488 | } | 497 | } |
489 | 498 | ||
@@ -491,7 +500,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
491 | if (option_mask32 & WGET_OPT_POST_FILE) { | 500 | if (option_mask32 & WGET_OPT_POST_FILE) { |
492 | int fd = xopen_stdin(G.post_file); | 501 | int fd = xopen_stdin(G.post_file); |
493 | G.post_data = xmalloc_read(fd, NULL); | 502 | G.post_data = xmalloc_read(fd, NULL); |
494 | @@ -1314,15 +1479,18 @@ static void download_one_url(const char *url) | 503 | @@ -1314,15 +1491,18 @@ static void download_one_url(const char *url) |
495 | ); | 504 | ); |
496 | } | 505 | } |
497 | # if ENABLE_PLATFORM_MINGW32 | 506 | # if ENABLE_PLATFORM_MINGW32 |
@@ -510,7 +519,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
510 | } else | 519 | } else |
511 | # else | 520 | # else |
512 | SENDFMT(sfp, | 521 | SENDFMT(sfp, |
513 | @@ -1338,6 +1506,7 @@ static void download_one_url(const char *url) | 522 | @@ -1338,6 +1518,7 @@ static void download_one_url(const char *url) |
514 | SENDFMT(sfp, "\r\n"); | 523 | SENDFMT(sfp, "\r\n"); |
515 | } | 524 | } |
516 | 525 | ||
@@ -518,7 +527,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
518 | fflush(sfp); | 527 | fflush(sfp); |
519 | 528 | ||
520 | /* Tried doing this unconditionally. | 529 | /* Tried doing this unconditionally. |
521 | @@ -1345,31 +1514,61 @@ static void download_one_url(const char *url) | 530 | @@ -1345,31 +1526,55 @@ static void download_one_url(const char *url) |
522 | */ | 531 | */ |
523 | #if SSL_SUPPORTED | 532 | #if SSL_SUPPORTED |
524 | if (target.protocol == P_HTTPS) { | 533 | if (target.protocol == P_HTTPS) { |
@@ -542,7 +551,6 @@ index 6a64836fb..0a8e282cc 100644 | |||
542 | + bb_error_msg_and_die("Failed to read tmpfile: %s\n", strerror(errno)); | 551 | + bb_error_msg_and_die("Failed to read tmpfile: %s\n", strerror(errno)); |
543 | + if(tls_write(ctx, outbuf, wlen) < wlen) | 552 | + if(tls_write(ctx, outbuf, wlen) < wlen) |
544 | + bb_error_msg_and_die("Failed to write:%s\n",tls_error(ctx)); | 553 | + bb_error_msg_and_die("Failed to write:%s\n",tls_error(ctx)); |
545 | + | ||
546 | + | 554 | + |
547 | + printf("About to seek\n"); | 555 | + printf("About to seek\n"); |
548 | + fseek(dfp,0,SEEK_END); | 556 | + fseek(dfp,0,SEEK_END); |
@@ -564,16 +572,11 @@ index 6a64836fb..0a8e282cc 100644 | |||
564 | 572 | ||
565 | str = G.wget_buf; | 573 | str = G.wget_buf; |
566 | + printf("wget_buf was: %s\n",G.wget_buf); | 574 | + printf("wget_buf was: %s\n",G.wget_buf); |
567 | + printf("wget download_one_url 27-2\n"); | ||
568 | str = skip_non_whitespace(str); | 575 | str = skip_non_whitespace(str); |
569 | + printf("wget download_one_url 27-3\n"); | ||
570 | str = skip_whitespace(str); | 576 | str = skip_whitespace(str); |
571 | + printf("wget download_one_url 27-4\n"); | ||
572 | // FIXME: no error check | 577 | // FIXME: no error check |
573 | // xatou wouldn't work: "200 OK" | 578 | // xatou wouldn't work: "200 OK" |
574 | + printf("wget download_one_url 27-5\n"); | ||
575 | status = atoi(str); | 579 | status = atoi(str); |
576 | + printf("wget download_one_url 27-6\n"); | ||
577 | + printf("Status was: %d\n",status); | 580 | + printf("Status was: %d\n",status); |
578 | switch (status) { | 581 | switch (status) { |
579 | case 0: | 582 | case 0: |
@@ -583,20 +586,22 @@ index 6a64836fb..0a8e282cc 100644 | |||
583 | /* eat all remaining headers */; | 586 | /* eat all remaining headers */; |
584 | goto read_response; | 587 | goto read_response; |
585 | 588 | ||
586 | @@ -1441,7 +1640,11 @@ However, in real world it was observed that some web servers | 589 | @@ -1441,7 +1646,13 @@ However, in real world it was observed that some web servers |
587 | /* | 590 | /* |
588 | * Retrieve HTTP headers. | 591 | * Retrieve HTTP headers. |
589 | */ | 592 | */ |
590 | - while ((str = get_sanitized_hdr(sfp)) != NULL) { | 593 | - while ((str = get_sanitized_hdr(sfp)) != NULL) { |
591 | + printf("wget download_one_url 28\n"); | 594 | + printf("wget download_one_url 28\n"); |
592 | + printf("At this point wget_buf is: %s\n",G.wget_buf); | 595 | + printf("At this point wget_buf is: %s\n",G.wget_buf); |
593 | + while ((str = tls_sanitized_hdr(ctx)) != NULL) { | 596 | + str = strchr(str,'\n'); |
597 | + char *header, *value; | ||
598 | + while (tls_sanitized_hdr(ctx, str, &header, &value) > 0) { | ||
594 | + printf("wget Retreiving the next part of the headers\n"); | 599 | + printf("wget Retreiving the next part of the headers\n"); |
595 | + printf("wget str was: %s\n", str); | 600 | + printf("wget str was: %s\n", str); |
596 | static const char keywords[] ALIGN1 = | 601 | static const char keywords[] ALIGN1 = |
597 | "content-length\0""transfer-encoding\0""location\0"; | 602 | "content-length\0""transfer-encoding\0""location\0"; |
598 | enum { | 603 | enum { |
599 | @@ -1453,6 +1656,7 @@ However, in real world it was observed that some web servers | 604 | @@ -1453,6 +1664,7 @@ However, in real world it was observed that some web servers |
600 | 605 | ||
601 | /* strip trailing whitespace */ | 606 | /* strip trailing whitespace */ |
602 | char *s = strchrnul(str, '\0') - 1; | 607 | char *s = strchrnul(str, '\0') - 1; |
@@ -604,7 +609,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
604 | while (s >= str && (*s == ' ' || *s == '\t')) { | 609 | while (s >= str && (*s == ' ' || *s == '\t')) { |
605 | *s = '\0'; | 610 | *s = '\0'; |
606 | s--; | 611 | s--; |
607 | @@ -1460,6 +1664,7 @@ However, in real world it was observed that some web servers | 612 | @@ -1460,6 +1672,7 @@ However, in real world it was observed that some web servers |
608 | key = index_in_strings(keywords, G.wget_buf) + 1; | 613 | key = index_in_strings(keywords, G.wget_buf) + 1; |
609 | if (key == KEY_content_length) { | 614 | if (key == KEY_content_length) { |
610 | G.content_len = BB_STRTOOFF(str, NULL, 10); | 615 | G.content_len = BB_STRTOOFF(str, NULL, 10); |
@@ -612,7 +617,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
612 | if (G.content_len < 0 || errno) { | 617 | if (G.content_len < 0 || errno) { |
613 | bb_error_msg_and_die("content-length %s is garbage", str); | 618 | bb_error_msg_and_die("content-length %s is garbage", str); |
614 | } | 619 | } |
615 | @@ -1469,6 +1674,7 @@ However, in real world it was observed that some web servers | 620 | @@ -1469,6 +1682,7 @@ However, in real world it was observed that some web servers |
616 | if (key == KEY_transfer_encoding) { | 621 | if (key == KEY_transfer_encoding) { |
617 | if (strcmp(str_tolower(str), "chunked") != 0) | 622 | if (strcmp(str_tolower(str), "chunked") != 0) |
618 | bb_error_msg_and_die("transfer encoding '%s' is not supported", str); | 623 | bb_error_msg_and_die("transfer encoding '%s' is not supported", str); |
@@ -620,7 +625,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
620 | G.chunked = 1; | 625 | G.chunked = 1; |
621 | } | 626 | } |
622 | if (key == KEY_location && status >= 300) { | 627 | if (key == KEY_location && status >= 300) { |
623 | @@ -1494,9 +1700,11 @@ However, in real world it was observed that some web servers | 628 | @@ -1494,9 +1708,11 @@ However, in real world it was observed that some web servers |
624 | goto resolve_lsa; | 629 | goto resolve_lsa; |
625 | } /* else: lsa stays the same: we use proxy */ | 630 | } /* else: lsa stays the same: we use proxy */ |
626 | } | 631 | } |
@@ -632,7 +637,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
632 | // if (status >= 300) | 637 | // if (status >= 300) |
633 | // bb_error_msg_and_die("bad redirection (no Location: header from server)"); | 638 | // bb_error_msg_and_die("bad redirection (no Location: header from server)"); |
634 | 639 | ||
635 | @@ -1514,6 +1722,7 @@ However, in real world it was observed that some web servers | 640 | @@ -1514,6 +1730,7 @@ However, in real world it was observed that some web servers |
636 | 641 | ||
637 | free(lsa); | 642 | free(lsa); |
638 | 643 | ||
@@ -640,7 +645,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
640 | if (!(option_mask32 & WGET_OPT_SPIDER)) { | 645 | if (!(option_mask32 & WGET_OPT_SPIDER)) { |
641 | if (G.output_fd < 0) | 646 | if (G.output_fd < 0) |
642 | G.output_fd = xopen(G.fname_out, G.o_flags); | 647 | G.output_fd = xopen(G.fname_out, G.o_flags); |
643 | @@ -1536,6 +1745,7 @@ However, in real world it was observed that some web servers | 648 | @@ -1536,6 +1753,7 @@ However, in real world it was observed that some web servers |
644 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ | 649 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ |
645 | } | 650 | } |
646 | #endif | 651 | #endif |
@@ -648,7 +653,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
648 | fclose(sfp); | 653 | fclose(sfp); |
649 | 654 | ||
650 | free(server.allocated); | 655 | free(server.allocated); |
651 | @@ -1544,11 +1754,13 @@ However, in real world it was observed that some web servers | 656 | @@ -1544,11 +1762,13 @@ However, in real world it was observed that some web servers |
652 | free(target.user); | 657 | free(target.user); |
653 | free(fname_out_alloc); | 658 | free(fname_out_alloc); |
654 | free(redirected_path); | 659 | free(redirected_path); |
@@ -662,7 +667,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
662 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | 667 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS |
663 | static const char wget_longopts[] ALIGN1 = | 668 | static const char wget_longopts[] ALIGN1 = |
664 | /* name, has_arg, val */ | 669 | /* name, has_arg, val */ |
665 | @@ -1590,6 +1802,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 670 | @@ -1590,6 +1810,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
666 | #endif | 671 | #endif |
667 | 672 | ||
668 | INIT_G(); | 673 | INIT_G(); |
@@ -670,7 +675,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
670 | 675 | ||
671 | #if ENABLE_FEATURE_WGET_TIMEOUT | 676 | #if ENABLE_FEATURE_WGET_TIMEOUT |
672 | G.timeout_seconds = 900; | 677 | G.timeout_seconds = 900; |
673 | @@ -1626,6 +1839,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 678 | @@ -1626,6 +1847,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
674 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) | 679 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) |
675 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file) | 680 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file) |
676 | ); | 681 | ); |
@@ -679,7 +684,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
679 | #if 0 /* option bits debug */ | 684 | #if 0 /* option bits debug */ |
680 | if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM"); | 685 | if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM"); |
681 | if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething"); | 686 | if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething"); |
682 | @@ -1670,6 +1885,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 687 | @@ -1670,6 +1893,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
683 | } | 688 | } |
684 | #endif | 689 | #endif |
685 | 690 | ||
@@ -687,7 +692,7 @@ index 6a64836fb..0a8e282cc 100644 | |||
687 | G.output_fd = -1; | 692 | G.output_fd = -1; |
688 | G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL; | 693 | G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL; |
689 | if (G.fname_out) { /* -O FILE ? */ | 694 | if (G.fname_out) { /* -O FILE ? */ |
690 | @@ -1691,8 +1907,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 695 | @@ -1691,8 +1915,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
691 | } | 696 | } |
692 | } | 697 | } |
693 | 698 | ||