diff options
author | Alexander M Pickering <alex@cogarr.net> | 2024-11-11 14:08:19 -0600 |
---|---|---|
committer | Alexander M Pickering <alex@cogarr.net> | 2024-11-11 14:08:19 -0600 |
commit | 70d3399b58a8b4d8a5206bb82ed45c6933e83346 (patch) | |
tree | 3dfd0000dc255e5cc2dc3c2ac5fc05e613cec05e | |
parent | 11b4644df5de275049210f301c4b791e782fa8a5 (diff) | |
download | busybox-w32-packaging-70d3399b58a8b4d8a5206bb82ed45c6933e83346.tar.gz busybox-w32-packaging-70d3399b58a8b4d8a5206bb82ed45c6933e83346.tar.bz2 busybox-w32-packaging-70d3399b58a8b4d8a5206bb82ed45c6933e83346.zip |
rewind output file
-rw-r--r-- | libressl.patch | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/libressl.patch b/libressl.patch index 0c7f495..d8a5430 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..8805aae0b 100644 | 138 | index 6a64836fb..33d5ff2d5 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 @@ |
@@ -305,7 +305,7 @@ index 6a64836fb..8805aae0b 100644 | |||
305 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ | 305 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ |
306 | G.got_clen = 0; | 306 | G.got_clen = 0; |
307 | G.chunked = 0; | 307 | G.chunked = 0; |
308 | @@ -1229,37 +1300,54 @@ static void download_one_url(const char *url) | 308 | @@ -1229,37 +1300,58 @@ static void download_one_url(const char *url) |
309 | 309 | ||
310 | /* Open socket to http(s) server */ | 310 | /* Open socket to http(s) server */ |
311 | #if ENABLE_FEATURE_WGET_OPENSSL | 311 | #if ENABLE_FEATURE_WGET_OPENSSL |
@@ -324,6 +324,10 @@ index 6a64836fb..8805aae0b 100644 | |||
324 | - goto socket_opened; | 324 | - goto socket_opened; |
325 | + printf("wget download_one_url 9\n"); | 325 | + printf("wget download_one_url 9\n"); |
326 | + //int fd = spawn_https_helper_openssl(server.host, server.port); | 326 | + //int fd = spawn_https_helper_openssl(server.host, server.port); |
327 | + char *allocated, *servername, *p, *host; | ||
328 | + if(!strchr(server.host, ":")) | ||
329 | + host = allocated = xasprintf("%s:%u", server.host, server.port); | ||
330 | + servername = xstrdup(host); | ||
327 | + ctx = tls_client(); | 331 | + ctx = tls_client(); |
328 | + if(ctx == NULL) | 332 | + if(ctx == NULL) |
329 | + bb_error_msg_and_die("Out of memory 1"); | 333 | + bb_error_msg_and_die("Out of memory 1"); |
@@ -373,7 +377,7 @@ index 6a64836fb..8805aae0b 100644 | |||
373 | /* Send HTTP request */ | 377 | /* Send HTTP request */ |
374 | if (use_proxy) { | 378 | if (use_proxy) { |
375 | SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n", | 379 | SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n", |
376 | @@ -1270,6 +1358,7 @@ static void download_one_url(const char *url) | 380 | @@ -1270,6 +1362,7 @@ static void download_one_url(const char *url) |
377 | (option_mask32 & WGET_OPT_POST) ? "POST" : "GET", | 381 | (option_mask32 & WGET_OPT_POST) ? "POST" : "GET", |
378 | target.path); | 382 | target.path); |
379 | } | 383 | } |
@@ -381,7 +385,7 @@ index 6a64836fb..8805aae0b 100644 | |||
381 | if (!USR_HEADER_HOST) | 385 | if (!USR_HEADER_HOST) |
382 | SENDFMT(sfp, "Host: %s\r\n", target.host); | 386 | SENDFMT(sfp, "Host: %s\r\n", target.host); |
383 | if (!USR_HEADER_USER_AGENT) | 387 | if (!USR_HEADER_USER_AGENT) |
384 | @@ -1280,6 +1369,7 @@ static void download_one_url(const char *url) | 388 | @@ -1280,6 +1373,7 @@ static void download_one_url(const char *url) |
385 | */ | 389 | */ |
386 | SENDFMT(sfp, "Connection: close\r\n"); | 390 | SENDFMT(sfp, "Connection: close\r\n"); |
387 | 391 | ||
@@ -389,7 +393,7 @@ index 6a64836fb..8805aae0b 100644 | |||
389 | #if ENABLE_FEATURE_WGET_AUTHENTICATION | 393 | #if ENABLE_FEATURE_WGET_AUTHENTICATION |
390 | if (target.user && !USR_HEADER_AUTH) { | 394 | if (target.user && !USR_HEADER_AUTH) { |
391 | SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6, | 395 | SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6, |
392 | @@ -1291,6 +1381,7 @@ static void download_one_url(const char *url) | 396 | @@ -1291,6 +1385,7 @@ static void download_one_url(const char *url) |
393 | } | 397 | } |
394 | #endif | 398 | #endif |
395 | 399 | ||
@@ -397,7 +401,7 @@ index 6a64836fb..8805aae0b 100644 | |||
397 | if (G.beg_range != 0 && !USR_HEADER_RANGE) | 401 | if (G.beg_range != 0 && !USR_HEADER_RANGE) |
398 | SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); | 402 | SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); |
399 | 403 | ||
400 | @@ -1300,6 +1391,7 @@ static void download_one_url(const char *url) | 404 | @@ -1300,6 +1395,7 @@ static void download_one_url(const char *url) |
401 | fputs(G.extra_headers, sfp); | 405 | fputs(G.extra_headers, sfp); |
402 | } | 406 | } |
403 | 407 | ||
@@ -405,7 +409,7 @@ index 6a64836fb..8805aae0b 100644 | |||
405 | if (option_mask32 & WGET_OPT_POST_FILE) { | 409 | if (option_mask32 & WGET_OPT_POST_FILE) { |
406 | int fd = xopen_stdin(G.post_file); | 410 | int fd = xopen_stdin(G.post_file); |
407 | G.post_data = xmalloc_read(fd, NULL); | 411 | G.post_data = xmalloc_read(fd, NULL); |
408 | @@ -1314,15 +1406,18 @@ static void download_one_url(const char *url) | 412 | @@ -1314,15 +1410,18 @@ static void download_one_url(const char *url) |
409 | ); | 413 | ); |
410 | } | 414 | } |
411 | # if ENABLE_PLATFORM_MINGW32 | 415 | # if ENABLE_PLATFORM_MINGW32 |
@@ -424,7 +428,7 @@ index 6a64836fb..8805aae0b 100644 | |||
424 | } else | 428 | } else |
425 | # else | 429 | # else |
426 | SENDFMT(sfp, | 430 | SENDFMT(sfp, |
427 | @@ -1338,6 +1433,7 @@ static void download_one_url(const char *url) | 431 | @@ -1338,6 +1437,7 @@ static void download_one_url(const char *url) |
428 | SENDFMT(sfp, "\r\n"); | 432 | SENDFMT(sfp, "\r\n"); |
429 | } | 433 | } |
430 | 434 | ||
@@ -432,10 +436,11 @@ index 6a64836fb..8805aae0b 100644 | |||
432 | fflush(sfp); | 436 | fflush(sfp); |
433 | 437 | ||
434 | /* Tried doing this unconditionally. | 438 | /* Tried doing this unconditionally. |
435 | @@ -1358,14 +1454,22 @@ static void download_one_url(const char *url) | 439 | @@ -1358,14 +1458,23 @@ static void download_one_url(const char *url) |
436 | * Retrieve HTTP response line and check for "200" status code. | 440 | * Retrieve HTTP response line and check for "200" status code. |
437 | */ | 441 | */ |
438 | read_response: | 442 | read_response: |
443 | + rewind(dfp); | ||
439 | + sfp = dfp; | 444 | + sfp = dfp; |
440 | + printf("wget download_one_url 27\n"); | 445 | + printf("wget download_one_url 27\n"); |
441 | fgets_trim_sanitize(sfp, " %s\n"); | 446 | fgets_trim_sanitize(sfp, " %s\n"); |
@@ -455,7 +460,7 @@ index 6a64836fb..8805aae0b 100644 | |||
455 | switch (status) { | 460 | switch (status) { |
456 | case 0: | 461 | case 0: |
457 | case 100: | 462 | case 100: |
458 | @@ -1441,6 +1545,7 @@ However, in real world it was observed that some web servers | 463 | @@ -1441,6 +1550,7 @@ However, in real world it was observed that some web servers |
459 | /* | 464 | /* |
460 | * Retrieve HTTP headers. | 465 | * Retrieve HTTP headers. |
461 | */ | 466 | */ |
@@ -463,7 +468,7 @@ index 6a64836fb..8805aae0b 100644 | |||
463 | while ((str = get_sanitized_hdr(sfp)) != NULL) { | 468 | while ((str = get_sanitized_hdr(sfp)) != NULL) { |
464 | static const char keywords[] ALIGN1 = | 469 | static const char keywords[] ALIGN1 = |
465 | "content-length\0""transfer-encoding\0""location\0"; | 470 | "content-length\0""transfer-encoding\0""location\0"; |
466 | @@ -1497,6 +1602,7 @@ However, in real world it was observed that some web servers | 471 | @@ -1497,6 +1607,7 @@ However, in real world it was observed that some web servers |
467 | goto establish_session; | 472 | goto establish_session; |
468 | } | 473 | } |
469 | } | 474 | } |
@@ -471,7 +476,7 @@ index 6a64836fb..8805aae0b 100644 | |||
471 | // if (status >= 300) | 476 | // if (status >= 300) |
472 | // bb_error_msg_and_die("bad redirection (no Location: header from server)"); | 477 | // bb_error_msg_and_die("bad redirection (no Location: header from server)"); |
473 | 478 | ||
474 | @@ -1514,6 +1620,7 @@ However, in real world it was observed that some web servers | 479 | @@ -1514,6 +1625,7 @@ However, in real world it was observed that some web servers |
475 | 480 | ||
476 | free(lsa); | 481 | free(lsa); |
477 | 482 | ||
@@ -479,7 +484,7 @@ index 6a64836fb..8805aae0b 100644 | |||
479 | if (!(option_mask32 & WGET_OPT_SPIDER)) { | 484 | if (!(option_mask32 & WGET_OPT_SPIDER)) { |
480 | if (G.output_fd < 0) | 485 | if (G.output_fd < 0) |
481 | G.output_fd = xopen(G.fname_out, G.o_flags); | 486 | G.output_fd = xopen(G.fname_out, G.o_flags); |
482 | @@ -1536,6 +1643,7 @@ However, in real world it was observed that some web servers | 487 | @@ -1536,6 +1648,7 @@ However, in real world it was observed that some web servers |
483 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ | 488 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ |
484 | } | 489 | } |
485 | #endif | 490 | #endif |
@@ -487,7 +492,7 @@ index 6a64836fb..8805aae0b 100644 | |||
487 | fclose(sfp); | 492 | fclose(sfp); |
488 | 493 | ||
489 | free(server.allocated); | 494 | free(server.allocated); |
490 | @@ -1544,11 +1652,13 @@ However, in real world it was observed that some web servers | 495 | @@ -1544,11 +1657,13 @@ However, in real world it was observed that some web servers |
491 | free(target.user); | 496 | free(target.user); |
492 | free(fname_out_alloc); | 497 | free(fname_out_alloc); |
493 | free(redirected_path); | 498 | free(redirected_path); |
@@ -501,7 +506,7 @@ index 6a64836fb..8805aae0b 100644 | |||
501 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | 506 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS |
502 | static const char wget_longopts[] ALIGN1 = | 507 | static const char wget_longopts[] ALIGN1 = |
503 | /* name, has_arg, val */ | 508 | /* name, has_arg, val */ |
504 | @@ -1590,6 +1700,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 509 | @@ -1590,6 +1705,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
505 | #endif | 510 | #endif |
506 | 511 | ||
507 | INIT_G(); | 512 | INIT_G(); |
@@ -509,7 +514,7 @@ index 6a64836fb..8805aae0b 100644 | |||
509 | 514 | ||
510 | #if ENABLE_FEATURE_WGET_TIMEOUT | 515 | #if ENABLE_FEATURE_WGET_TIMEOUT |
511 | G.timeout_seconds = 900; | 516 | G.timeout_seconds = 900; |
512 | @@ -1626,6 +1737,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 517 | @@ -1626,6 +1742,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
513 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) | 518 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) |
514 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file) | 519 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file) |
515 | ); | 520 | ); |
@@ -518,7 +523,7 @@ index 6a64836fb..8805aae0b 100644 | |||
518 | #if 0 /* option bits debug */ | 523 | #if 0 /* option bits debug */ |
519 | if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM"); | 524 | if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM"); |
520 | if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething"); | 525 | if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething"); |
521 | @@ -1670,6 +1783,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 526 | @@ -1670,6 +1788,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
522 | } | 527 | } |
523 | #endif | 528 | #endif |
524 | 529 | ||
@@ -526,7 +531,7 @@ index 6a64836fb..8805aae0b 100644 | |||
526 | G.output_fd = -1; | 531 | G.output_fd = -1; |
527 | G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL; | 532 | G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL; |
528 | if (G.fname_out) { /* -O FILE ? */ | 533 | if (G.fname_out) { /* -O FILE ? */ |
529 | @@ -1691,8 +1805,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | 534 | @@ -1691,8 +1810,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") |
530 | } | 535 | } |
531 | } | 536 | } |
532 | 537 | ||