Merge pull request #260011 from lilyinstarlight/fix/prefetch-npm-deps-network-error-recovery

prefetch-npm-deps: read url bodies within the retry loop

authored by Weijia Wang and committed by GitHub 093f098d 7f480265

+172 -214
+140 -184
pkgs/build-support/node/fetch-npm-deps/Cargo.lock
··· 4 5 [[package]] 6 name = "aho-corasick" 7 - version = "1.0.2" 8 source = "registry+https://github.com/rust-lang/crates.io-index" 9 - checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" 10 dependencies = [ 11 "memchr", 12 ] 13 14 [[package]] 15 name = "anyhow" 16 - version = "1.0.71" 17 source = "registry+https://github.com/rust-lang/crates.io-index" 18 - checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" 19 20 [[package]] 21 name = "async-channel" 22 - version = "1.8.0" 23 source = "registry+https://github.com/rust-lang/crates.io-index" 24 - checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" 25 dependencies = [ 26 "concurrent-queue", 27 "event-listener", ··· 47 48 [[package]] 49 name = "base64" 50 - version = "0.21.2" 51 source = "registry+https://github.com/rust-lang/crates.io-index" 52 - checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" 53 54 [[package]] 55 name = "bitflags" ··· 59 60 [[package]] 61 name = "bitflags" 62 - version = "2.3.3" 63 source = "registry+https://github.com/rust-lang/crates.io-index" 64 - checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" 65 66 [[package]] 67 name = "block-buffer" ··· 74 75 [[package]] 76 name = "bytes" 77 - version = "1.4.0" 78 source = "registry+https://github.com/rust-lang/crates.io-index" 79 - checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" 80 81 [[package]] 82 name = "castaway" ··· 86 87 [[package]] 88 name = "cc" 89 - version = "1.0.79" 90 source = "registry+https://github.com/rust-lang/crates.io-index" 91 - checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" 92 93 [[package]] 94 name = "cfg-if" ··· 98 99 [[package]] 100 name = "concurrent-queue" 101 - version = "2.2.0" 102 source = "registry+https://github.com/rust-lang/crates.io-index" 103 - checksum = "62ec6771ecfa0762d24683ee5a32ad78487a3d3afdc0fb8cae19d2c5deb50b7c" 104 dependencies = [ 105 "crossbeam-utils", 106 ] 107 108 [[package]] 109 name = "cpufeatures" 110 - version = "0.2.8" 111 source = "registry+https://github.com/rust-lang/crates.io-index" 112 - checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" 113 dependencies = [ 114 "libc", 115 ] 116 117 [[package]] 118 - name = "crossbeam-channel" 119 - version = "0.5.8" 120 - source = "registry+https://github.com/rust-lang/crates.io-index" 121 - checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" 122 - dependencies = [ 123 - "cfg-if", 124 - "crossbeam-utils", 125 - ] 126 - 127 - [[package]] 128 name = "crossbeam-deque" 129 version = "0.8.3" 130 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 184 185 [[package]] 186 name = "curl-sys" 187 - version = "0.4.63+curl-8.1.2" 188 source = "registry+https://github.com/rust-lang/crates.io-index" 189 - checksum = "aeb0fef7046022a1e2ad67a004978f0e3cacb9e3123dc62ce768f92197b771dc" 190 dependencies = [ 191 "cc", 192 "libc", ··· 194 "openssl-sys", 195 "pkg-config", 196 "vcpkg", 197 - "winapi", 198 ] 199 200 [[package]] ··· 209 210 [[package]] 211 name = "either" 212 - version = "1.8.1" 213 source = "registry+https://github.com/rust-lang/crates.io-index" 214 - checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" 215 216 [[package]] 217 name = "env_logger" ··· 228 229 [[package]] 230 name = "errno" 231 - version = "0.3.1" 232 source = "registry+https://github.com/rust-lang/crates.io-index" 233 - checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" 234 dependencies = [ 235 - "errno-dragonfly", 236 "libc", 237 "windows-sys", 238 - ] 239 - 240 - [[package]] 241 - name = "errno-dragonfly" 242 - version = "0.1.2" 243 - source = "registry+https://github.com/rust-lang/crates.io-index" 244 - checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" 245 - dependencies = [ 246 - "cc", 247 - "libc", 248 ] 249 250 [[package]] ··· 261 dependencies = [ 262 "instant", 263 ] 264 265 [[package]] 266 name = "fnv" ··· 295 source = "registry+https://github.com/rust-lang/crates.io-index" 296 checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" 297 dependencies = [ 298 - "fastrand", 299 "futures-core", 300 "futures-io", 301 "memchr", ··· 327 328 [[package]] 329 name = "hermit-abi" 330 - version = "0.3.2" 331 source = "registry+https://github.com/rust-lang/crates.io-index" 332 - checksum = "443144c8cdadd93ebf52ddb4056d257f5b52c04d3c804e657d19eb73fc33668b" 333 334 [[package]] 335 name = "http" ··· 368 ] 369 370 [[package]] 371 - name = "io-lifetimes" 372 - version = "1.0.11" 373 - source = "registry+https://github.com/rust-lang/crates.io-index" 374 - checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" 375 - dependencies = [ 376 - "hermit-abi", 377 - "libc", 378 - "windows-sys", 379 - ] 380 - 381 - [[package]] 382 name = "is-terminal" 383 - version = "0.4.8" 384 source = "registry+https://github.com/rust-lang/crates.io-index" 385 - checksum = "24fddda5af7e54bf7da53067d6e802dbcc381d0a8eef629df528e3ebf68755cb" 386 dependencies = [ 387 "hermit-abi", 388 - "rustix 0.38.2", 389 "windows-sys", 390 ] 391 ··· 416 417 [[package]] 418 name = "itoa" 419 - version = "1.0.8" 420 source = "registry+https://github.com/rust-lang/crates.io-index" 421 - checksum = "62b02a5381cc465bd3041d84623d0fa3b66738b52b8e2fc3bab8ad63ab032f4a" 422 423 [[package]] 424 name = "libc" 425 - version = "0.2.147" 426 source = "registry+https://github.com/rust-lang/crates.io-index" 427 - checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" 428 429 [[package]] 430 name = "libz-sys" 431 - version = "1.1.9" 432 source = "registry+https://github.com/rust-lang/crates.io-index" 433 - checksum = "56ee889ecc9568871456d42f603d6a0ce59ff328d291063a45cbdf0036baf6db" 434 dependencies = [ 435 "cc", 436 "libc", ··· 440 441 [[package]] 442 name = "linux-raw-sys" 443 - version = "0.3.8" 444 source = "registry+https://github.com/rust-lang/crates.io-index" 445 - checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" 446 - 447 - [[package]] 448 - name = "linux-raw-sys" 449 - version = "0.4.3" 450 - source = "registry+https://github.com/rust-lang/crates.io-index" 451 - checksum = "09fc20d2ca12cb9f044c93e3bd6d32d523e6e2ec3db4f7b2939cd99026ecd3f0" 452 453 [[package]] 454 name = "log" 455 - version = "0.4.19" 456 source = "registry+https://github.com/rust-lang/crates.io-index" 457 - checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" 458 459 [[package]] 460 name = "memchr" 461 - version = "2.5.0" 462 source = "registry+https://github.com/rust-lang/crates.io-index" 463 - checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" 464 465 [[package]] 466 name = "memoffset" ··· 472 ] 473 474 [[package]] 475 - name = "num_cpus" 476 - version = "1.16.0" 477 - source = "registry+https://github.com/rust-lang/crates.io-index" 478 - checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" 479 - dependencies = [ 480 - "hermit-abi", 481 - "libc", 482 - ] 483 - 484 - [[package]] 485 name = "once_cell" 486 version = "1.18.0" 487 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 495 496 [[package]] 497 name = "openssl-sys" 498 - version = "0.9.90" 499 source = "registry+https://github.com/rust-lang/crates.io-index" 500 - checksum = "374533b0e45f3a7ced10fcaeccca020e66656bc03dac384f852e4e5a7a8104a6" 501 dependencies = [ 502 "cc", 503 "libc", ··· 507 508 [[package]] 509 name = "parking" 510 - version = "2.1.0" 511 source = "registry+https://github.com/rust-lang/crates.io-index" 512 - checksum = "14f2252c834a40ed9bb5422029649578e63aa341ac401f74e719dd1afda8394e" 513 514 [[package]] 515 name = "percent-encoding" ··· 519 520 [[package]] 521 name = "pin-project" 522 - version = "1.1.2" 523 source = "registry+https://github.com/rust-lang/crates.io-index" 524 - checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" 525 dependencies = [ 526 "pin-project-internal", 527 ] 528 529 [[package]] 530 name = "pin-project-internal" 531 - version = "1.1.2" 532 source = "registry+https://github.com/rust-lang/crates.io-index" 533 - checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" 534 dependencies = [ 535 "proc-macro2", 536 "quote", ··· 539 540 [[package]] 541 name = "pin-project-lite" 542 - version = "0.2.10" 543 source = "registry+https://github.com/rust-lang/crates.io-index" 544 - checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" 545 546 [[package]] 547 name = "pkg-config" ··· 593 594 [[package]] 595 name = "proc-macro2" 596 - version = "1.0.63" 597 source = "registry+https://github.com/rust-lang/crates.io-index" 598 - checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" 599 dependencies = [ 600 "unicode-ident", 601 ] 602 603 [[package]] 604 name = "quote" 605 - version = "1.0.29" 606 source = "registry+https://github.com/rust-lang/crates.io-index" 607 - checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" 608 dependencies = [ 609 "proc-macro2", 610 ] ··· 641 642 [[package]] 643 name = "rayon" 644 - version = "1.7.0" 645 source = "registry+https://github.com/rust-lang/crates.io-index" 646 - checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" 647 dependencies = [ 648 "either", 649 "rayon-core", ··· 651 652 [[package]] 653 name = "rayon-core" 654 - version = "1.11.0" 655 source = "registry+https://github.com/rust-lang/crates.io-index" 656 - checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" 657 dependencies = [ 658 - "crossbeam-channel", 659 "crossbeam-deque", 660 "crossbeam-utils", 661 - "num_cpus", 662 ] 663 664 [[package]] ··· 672 673 [[package]] 674 name = "regex" 675 - version = "1.8.4" 676 source = "registry+https://github.com/rust-lang/crates.io-index" 677 - checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" 678 dependencies = [ 679 "aho-corasick", 680 "memchr", 681 "regex-syntax", 682 ] 683 684 [[package]] 685 - name = "regex-syntax" 686 - version = "0.7.2" 687 source = "registry+https://github.com/rust-lang/crates.io-index" 688 - checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" 689 690 [[package]] 691 - name = "rustix" 692 - version = "0.37.22" 693 source = "registry+https://github.com/rust-lang/crates.io-index" 694 - checksum = "8818fa822adcc98b18fedbb3632a6a33213c070556b5aa7c4c8cc21cff565c4c" 695 - dependencies = [ 696 - "bitflags 1.3.2", 697 - "errno", 698 - "io-lifetimes", 699 - "libc", 700 - "linux-raw-sys 0.3.8", 701 - "windows-sys", 702 - ] 703 704 [[package]] 705 name = "rustix" 706 - version = "0.38.2" 707 source = "registry+https://github.com/rust-lang/crates.io-index" 708 - checksum = "aabcb0461ebd01d6b79945797c27f8529082226cb630a9865a71870ff63532a4" 709 dependencies = [ 710 - "bitflags 2.3.3", 711 "errno", 712 "libc", 713 - "linux-raw-sys 0.4.3", 714 "windows-sys", 715 ] 716 717 [[package]] 718 name = "ryu" 719 - version = "1.0.14" 720 source = "registry+https://github.com/rust-lang/crates.io-index" 721 - checksum = "fe232bdf6be8c8de797b22184ee71118d63780ea42ac85b61d1baa6d3b782ae9" 722 723 [[package]] 724 name = "same-file" ··· 740 741 [[package]] 742 name = "scopeguard" 743 - version = "1.1.0" 744 source = "registry+https://github.com/rust-lang/crates.io-index" 745 - checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 746 747 [[package]] 748 name = "serde" 749 - version = "1.0.166" 750 source = "registry+https://github.com/rust-lang/crates.io-index" 751 - checksum = "d01b7404f9d441d3ad40e6a636a7782c377d2abdbe4fa2440e2edcc2f4f10db8" 752 dependencies = [ 753 "serde_derive", 754 ] 755 756 [[package]] 757 name = "serde_derive" 758 - version = "1.0.166" 759 source = "registry+https://github.com/rust-lang/crates.io-index" 760 - checksum = "5dd83d6dde2b6b2d466e14d9d1acce8816dedee94f735eac6395808b3483c6d6" 761 dependencies = [ 762 "proc-macro2", 763 "quote", ··· 766 767 [[package]] 768 name = "serde_json" 769 - version = "1.0.99" 770 source = "registry+https://github.com/rust-lang/crates.io-index" 771 - checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" 772 dependencies = [ 773 "itoa", 774 "ryu", ··· 777 778 [[package]] 779 name = "sha1" 780 - version = "0.10.5" 781 source = "registry+https://github.com/rust-lang/crates.io-index" 782 - checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" 783 dependencies = [ 784 "cfg-if", 785 "cpufeatures", ··· 788 789 [[package]] 790 name = "sha2" 791 - version = "0.10.7" 792 source = "registry+https://github.com/rust-lang/crates.io-index" 793 - checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" 794 dependencies = [ 795 "cfg-if", 796 "cpufeatures", ··· 799 800 [[package]] 801 name = "slab" 802 - version = "0.4.8" 803 source = "registry+https://github.com/rust-lang/crates.io-index" 804 - checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" 805 dependencies = [ 806 "autocfg", 807 ] ··· 829 830 [[package]] 831 name = "syn" 832 - version = "2.0.23" 833 source = "registry+https://github.com/rust-lang/crates.io-index" 834 - checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" 835 dependencies = [ 836 "proc-macro2", 837 "quote", ··· 840 841 [[package]] 842 name = "tempfile" 843 - version = "3.6.0" 844 source = "registry+https://github.com/rust-lang/crates.io-index" 845 - checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" 846 dependencies = [ 847 - "autocfg", 848 "cfg-if", 849 - "fastrand", 850 "redox_syscall", 851 - "rustix 0.37.22", 852 "windows-sys", 853 ] 854 855 [[package]] 856 name = "termcolor" 857 - version = "1.2.0" 858 source = "registry+https://github.com/rust-lang/crates.io-index" 859 - checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" 860 dependencies = [ 861 "winapi-util", 862 ] ··· 921 922 [[package]] 923 name = "typenum" 924 - version = "1.16.0" 925 source = "registry+https://github.com/rust-lang/crates.io-index" 926 - checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" 927 928 [[package]] 929 name = "unicode-bidi" ··· 933 934 [[package]] 935 name = "unicode-ident" 936 - version = "1.0.10" 937 source = "registry+https://github.com/rust-lang/crates.io-index" 938 - checksum = "22049a19f4a68748a168c0fc439f9516686aa045927ff767eca0a85101fb6e73" 939 940 [[package]] 941 name = "unicode-normalization" ··· 948 949 [[package]] 950 name = "url" 951 - version = "2.4.0" 952 source = "registry+https://github.com/rust-lang/crates.io-index" 953 - checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" 954 dependencies = [ 955 "form_urlencoded", 956 "idna", ··· 972 973 [[package]] 974 name = "waker-fn" 975 - version = "1.1.0" 976 source = "registry+https://github.com/rust-lang/crates.io-index" 977 - checksum = "9d5b2c62b4012a3e1eca5a7e077d13b3bf498c4073e33ccd58626607748ceeca" 978 979 [[package]] 980 name = "walkdir" 981 - version = "2.3.3" 982 source = "registry+https://github.com/rust-lang/crates.io-index" 983 - checksum = "36df944cda56c7d8d8b7496af378e6b16de9284591917d307c9b4d313c44e698" 984 dependencies = [ 985 "same-file", 986 "winapi-util", ··· 1010 1011 [[package]] 1012 name = "winapi-util" 1013 - version = "0.1.5" 1014 source = "registry+https://github.com/rust-lang/crates.io-index" 1015 - checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" 1016 dependencies = [ 1017 "winapi", 1018 ] ··· 1034 1035 [[package]] 1036 name = "windows-targets" 1037 - version = "0.48.1" 1038 source = "registry+https://github.com/rust-lang/crates.io-index" 1039 - checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" 1040 dependencies = [ 1041 "windows_aarch64_gnullvm", 1042 "windows_aarch64_msvc", ··· 1049 1050 [[package]] 1051 name = "windows_aarch64_gnullvm" 1052 - version = "0.48.0" 1053 source = "registry+https://github.com/rust-lang/crates.io-index" 1054 - checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" 1055 1056 [[package]] 1057 name = "windows_aarch64_msvc" 1058 - version = "0.48.0" 1059 source = "registry+https://github.com/rust-lang/crates.io-index" 1060 - checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" 1061 1062 [[package]] 1063 name = "windows_i686_gnu" 1064 - version = "0.48.0" 1065 source = "registry+https://github.com/rust-lang/crates.io-index" 1066 - checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" 1067 1068 [[package]] 1069 name = "windows_i686_msvc" 1070 - version = "0.48.0" 1071 source = "registry+https://github.com/rust-lang/crates.io-index" 1072 - checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" 1073 1074 [[package]] 1075 name = "windows_x86_64_gnu" 1076 - version = "0.48.0" 1077 source = "registry+https://github.com/rust-lang/crates.io-index" 1078 - checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" 1079 1080 [[package]] 1081 name = "windows_x86_64_gnullvm" 1082 - version = "0.48.0" 1083 source = "registry+https://github.com/rust-lang/crates.io-index" 1084 - checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" 1085 1086 [[package]] 1087 name = "windows_x86_64_msvc" 1088 - version = "0.48.0" 1089 source = "registry+https://github.com/rust-lang/crates.io-index" 1090 - checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"
··· 4 5 [[package]] 6 name = "aho-corasick" 7 + version = "1.1.2" 8 source = "registry+https://github.com/rust-lang/crates.io-index" 9 + checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" 10 dependencies = [ 11 "memchr", 12 ] 13 14 [[package]] 15 name = "anyhow" 16 + version = "1.0.75" 17 source = "registry+https://github.com/rust-lang/crates.io-index" 18 + checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" 19 20 [[package]] 21 name = "async-channel" 22 + version = "1.9.0" 23 source = "registry+https://github.com/rust-lang/crates.io-index" 24 + checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" 25 dependencies = [ 26 "concurrent-queue", 27 "event-listener", ··· 47 48 [[package]] 49 name = "base64" 50 + version = "0.21.4" 51 source = "registry+https://github.com/rust-lang/crates.io-index" 52 + checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" 53 54 [[package]] 55 name = "bitflags" ··· 59 60 [[package]] 61 name = "bitflags" 62 + version = "2.4.0" 63 source = "registry+https://github.com/rust-lang/crates.io-index" 64 + checksum = "b4682ae6287fcf752ecaabbfcc7b6f9b72aa33933dc23a554d853aea8eea8635" 65 66 [[package]] 67 name = "block-buffer" ··· 74 75 [[package]] 76 name = "bytes" 77 + version = "1.5.0" 78 source = "registry+https://github.com/rust-lang/crates.io-index" 79 + checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" 80 81 [[package]] 82 name = "castaway" ··· 86 87 [[package]] 88 name = "cc" 89 + version = "1.0.83" 90 source = "registry+https://github.com/rust-lang/crates.io-index" 91 + checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" 92 + dependencies = [ 93 + "libc", 94 + ] 95 96 [[package]] 97 name = "cfg-if" ··· 101 102 [[package]] 103 name = "concurrent-queue" 104 + version = "2.3.0" 105 source = "registry+https://github.com/rust-lang/crates.io-index" 106 + checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" 107 dependencies = [ 108 "crossbeam-utils", 109 ] 110 111 [[package]] 112 name = "cpufeatures" 113 + version = "0.2.9" 114 source = "registry+https://github.com/rust-lang/crates.io-index" 115 + checksum = "a17b76ff3a4162b0b27f354a0c87015ddad39d35f9c0c36607a3bdd175dde1f1" 116 dependencies = [ 117 "libc", 118 ] 119 120 [[package]] 121 name = "crossbeam-deque" 122 version = "0.8.3" 123 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 177 178 [[package]] 179 name = "curl-sys" 180 + version = "0.4.67+curl-8.3.0" 181 source = "registry+https://github.com/rust-lang/crates.io-index" 182 + checksum = "3cc35d066510b197a0f72de863736641539957628c8a42e70e27c66849e77c34" 183 dependencies = [ 184 "cc", 185 "libc", ··· 187 "openssl-sys", 188 "pkg-config", 189 "vcpkg", 190 + "windows-sys", 191 ] 192 193 [[package]] ··· 202 203 [[package]] 204 name = "either" 205 + version = "1.9.0" 206 source = "registry+https://github.com/rust-lang/crates.io-index" 207 + checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" 208 209 [[package]] 210 name = "env_logger" ··· 221 222 [[package]] 223 name = "errno" 224 + version = "0.3.5" 225 source = "registry+https://github.com/rust-lang/crates.io-index" 226 + checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" 227 dependencies = [ 228 "libc", 229 "windows-sys", 230 ] 231 232 [[package]] ··· 243 dependencies = [ 244 "instant", 245 ] 246 + 247 + [[package]] 248 + name = "fastrand" 249 + version = "2.0.1" 250 + source = "registry+https://github.com/rust-lang/crates.io-index" 251 + checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" 252 253 [[package]] 254 name = "fnv" ··· 283 source = "registry+https://github.com/rust-lang/crates.io-index" 284 checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" 285 dependencies = [ 286 + "fastrand 1.9.0", 287 "futures-core", 288 "futures-io", 289 "memchr", ··· 315 316 [[package]] 317 name = "hermit-abi" 318 + version = "0.3.3" 319 source = "registry+https://github.com/rust-lang/crates.io-index" 320 + checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" 321 322 [[package]] 323 name = "http" ··· 356 ] 357 358 [[package]] 359 name = "is-terminal" 360 + version = "0.4.9" 361 source = "registry+https://github.com/rust-lang/crates.io-index" 362 + checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" 363 dependencies = [ 364 "hermit-abi", 365 + "rustix", 366 "windows-sys", 367 ] 368 ··· 393 394 [[package]] 395 name = "itoa" 396 + version = "1.0.9" 397 source = "registry+https://github.com/rust-lang/crates.io-index" 398 + checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" 399 400 [[package]] 401 name = "libc" 402 + version = "0.2.149" 403 source = "registry+https://github.com/rust-lang/crates.io-index" 404 + checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" 405 406 [[package]] 407 name = "libz-sys" 408 + version = "1.1.12" 409 source = "registry+https://github.com/rust-lang/crates.io-index" 410 + checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b" 411 dependencies = [ 412 "cc", 413 "libc", ··· 417 418 [[package]] 419 name = "linux-raw-sys" 420 + version = "0.4.10" 421 source = "registry+https://github.com/rust-lang/crates.io-index" 422 + checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" 423 424 [[package]] 425 name = "log" 426 + version = "0.4.20" 427 source = "registry+https://github.com/rust-lang/crates.io-index" 428 + checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" 429 430 [[package]] 431 name = "memchr" 432 + version = "2.6.4" 433 source = "registry+https://github.com/rust-lang/crates.io-index" 434 + checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" 435 436 [[package]] 437 name = "memoffset" ··· 443 ] 444 445 [[package]] 446 name = "once_cell" 447 version = "1.18.0" 448 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 456 457 [[package]] 458 name = "openssl-sys" 459 + version = "0.9.93" 460 source = "registry+https://github.com/rust-lang/crates.io-index" 461 + checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" 462 dependencies = [ 463 "cc", 464 "libc", ··· 468 469 [[package]] 470 name = "parking" 471 + version = "2.1.1" 472 source = "registry+https://github.com/rust-lang/crates.io-index" 473 + checksum = "e52c774a4c39359c1d1c52e43f73dd91a75a614652c825408eec30c95a9b2067" 474 475 [[package]] 476 name = "percent-encoding" ··· 480 481 [[package]] 482 name = "pin-project" 483 + version = "1.1.3" 484 source = "registry+https://github.com/rust-lang/crates.io-index" 485 + checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" 486 dependencies = [ 487 "pin-project-internal", 488 ] 489 490 [[package]] 491 name = "pin-project-internal" 492 + version = "1.1.3" 493 source = "registry+https://github.com/rust-lang/crates.io-index" 494 + checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" 495 dependencies = [ 496 "proc-macro2", 497 "quote", ··· 500 501 [[package]] 502 name = "pin-project-lite" 503 + version = "0.2.13" 504 source = "registry+https://github.com/rust-lang/crates.io-index" 505 + checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" 506 507 [[package]] 508 name = "pkg-config" ··· 554 555 [[package]] 556 name = "proc-macro2" 557 + version = "1.0.69" 558 source = "registry+https://github.com/rust-lang/crates.io-index" 559 + checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" 560 dependencies = [ 561 "unicode-ident", 562 ] 563 564 [[package]] 565 name = "quote" 566 + version = "1.0.33" 567 source = "registry+https://github.com/rust-lang/crates.io-index" 568 + checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" 569 dependencies = [ 570 "proc-macro2", 571 ] ··· 602 603 [[package]] 604 name = "rayon" 605 + version = "1.8.0" 606 source = "registry+https://github.com/rust-lang/crates.io-index" 607 + checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" 608 dependencies = [ 609 "either", 610 "rayon-core", ··· 612 613 [[package]] 614 name = "rayon-core" 615 + version = "1.12.0" 616 source = "registry+https://github.com/rust-lang/crates.io-index" 617 + checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" 618 dependencies = [ 619 "crossbeam-deque", 620 "crossbeam-utils", 621 ] 622 623 [[package]] ··· 631 632 [[package]] 633 name = "regex" 634 + version = "1.9.6" 635 source = "registry+https://github.com/rust-lang/crates.io-index" 636 + checksum = "ebee201405406dbf528b8b672104ae6d6d63e6d118cb10e4d51abbc7b58044ff" 637 dependencies = [ 638 "aho-corasick", 639 "memchr", 640 + "regex-automata", 641 "regex-syntax", 642 ] 643 644 [[package]] 645 + name = "regex-automata" 646 + version = "0.3.9" 647 source = "registry+https://github.com/rust-lang/crates.io-index" 648 + checksum = "59b23e92ee4318893fa3fe3e6fb365258efbfe6ac6ab30f090cdcbb7aa37efa9" 649 + dependencies = [ 650 + "aho-corasick", 651 + "memchr", 652 + "regex-syntax", 653 + ] 654 655 [[package]] 656 + name = "regex-syntax" 657 + version = "0.7.5" 658 source = "registry+https://github.com/rust-lang/crates.io-index" 659 + checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" 660 661 [[package]] 662 name = "rustix" 663 + version = "0.38.18" 664 source = "registry+https://github.com/rust-lang/crates.io-index" 665 + checksum = "5a74ee2d7c2581cd139b42447d7d9389b889bdaad3a73f1ebb16f2a3237bb19c" 666 dependencies = [ 667 + "bitflags 2.4.0", 668 "errno", 669 "libc", 670 + "linux-raw-sys", 671 "windows-sys", 672 ] 673 674 [[package]] 675 name = "ryu" 676 + version = "1.0.15" 677 source = "registry+https://github.com/rust-lang/crates.io-index" 678 + checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" 679 680 [[package]] 681 name = "same-file" ··· 697 698 [[package]] 699 name = "scopeguard" 700 + version = "1.2.0" 701 source = "registry+https://github.com/rust-lang/crates.io-index" 702 + checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" 703 704 [[package]] 705 name = "serde" 706 + version = "1.0.188" 707 source = "registry+https://github.com/rust-lang/crates.io-index" 708 + checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" 709 dependencies = [ 710 "serde_derive", 711 ] 712 713 [[package]] 714 name = "serde_derive" 715 + version = "1.0.188" 716 source = "registry+https://github.com/rust-lang/crates.io-index" 717 + checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" 718 dependencies = [ 719 "proc-macro2", 720 "quote", ··· 723 724 [[package]] 725 name = "serde_json" 726 + version = "1.0.107" 727 source = "registry+https://github.com/rust-lang/crates.io-index" 728 + checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" 729 dependencies = [ 730 "itoa", 731 "ryu", ··· 734 735 [[package]] 736 name = "sha1" 737 + version = "0.10.6" 738 source = "registry+https://github.com/rust-lang/crates.io-index" 739 + checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" 740 dependencies = [ 741 "cfg-if", 742 "cpufeatures", ··· 745 746 [[package]] 747 name = "sha2" 748 + version = "0.10.8" 749 source = "registry+https://github.com/rust-lang/crates.io-index" 750 + checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" 751 dependencies = [ 752 "cfg-if", 753 "cpufeatures", ··· 756 757 [[package]] 758 name = "slab" 759 + version = "0.4.9" 760 source = "registry+https://github.com/rust-lang/crates.io-index" 761 + checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" 762 dependencies = [ 763 "autocfg", 764 ] ··· 786 787 [[package]] 788 name = "syn" 789 + version = "2.0.38" 790 source = "registry+https://github.com/rust-lang/crates.io-index" 791 + checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" 792 dependencies = [ 793 "proc-macro2", 794 "quote", ··· 797 798 [[package]] 799 name = "tempfile" 800 + version = "3.8.0" 801 source = "registry+https://github.com/rust-lang/crates.io-index" 802 + checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" 803 dependencies = [ 804 "cfg-if", 805 + "fastrand 2.0.1", 806 "redox_syscall", 807 + "rustix", 808 "windows-sys", 809 ] 810 811 [[package]] 812 name = "termcolor" 813 + version = "1.3.0" 814 source = "registry+https://github.com/rust-lang/crates.io-index" 815 + checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" 816 dependencies = [ 817 "winapi-util", 818 ] ··· 877 878 [[package]] 879 name = "typenum" 880 + version = "1.17.0" 881 source = "registry+https://github.com/rust-lang/crates.io-index" 882 + checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" 883 884 [[package]] 885 name = "unicode-bidi" ··· 889 890 [[package]] 891 name = "unicode-ident" 892 + version = "1.0.12" 893 source = "registry+https://github.com/rust-lang/crates.io-index" 894 + checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" 895 896 [[package]] 897 name = "unicode-normalization" ··· 904 905 [[package]] 906 name = "url" 907 + version = "2.4.1" 908 source = "registry+https://github.com/rust-lang/crates.io-index" 909 + checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" 910 dependencies = [ 911 "form_urlencoded", 912 "idna", ··· 928 929 [[package]] 930 name = "waker-fn" 931 + version = "1.1.1" 932 source = "registry+https://github.com/rust-lang/crates.io-index" 933 + checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" 934 935 [[package]] 936 name = "walkdir" 937 + version = "2.4.0" 938 source = "registry+https://github.com/rust-lang/crates.io-index" 939 + checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" 940 dependencies = [ 941 "same-file", 942 "winapi-util", ··· 966 967 [[package]] 968 name = "winapi-util" 969 + version = "0.1.6" 970 source = "registry+https://github.com/rust-lang/crates.io-index" 971 + checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" 972 dependencies = [ 973 "winapi", 974 ] ··· 990 991 [[package]] 992 name = "windows-targets" 993 + version = "0.48.5" 994 source = "registry+https://github.com/rust-lang/crates.io-index" 995 + checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" 996 dependencies = [ 997 "windows_aarch64_gnullvm", 998 "windows_aarch64_msvc", ··· 1005 1006 [[package]] 1007 name = "windows_aarch64_gnullvm" 1008 + version = "0.48.5" 1009 source = "registry+https://github.com/rust-lang/crates.io-index" 1010 + checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" 1011 1012 [[package]] 1013 name = "windows_aarch64_msvc" 1014 + version = "0.48.5" 1015 source = "registry+https://github.com/rust-lang/crates.io-index" 1016 + checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" 1017 1018 [[package]] 1019 name = "windows_i686_gnu" 1020 + version = "0.48.5" 1021 source = "registry+https://github.com/rust-lang/crates.io-index" 1022 + checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" 1023 1024 [[package]] 1025 name = "windows_i686_msvc" 1026 + version = "0.48.5" 1027 source = "registry+https://github.com/rust-lang/crates.io-index" 1028 + checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" 1029 1030 [[package]] 1031 name = "windows_x86_64_gnu" 1032 + version = "0.48.5" 1033 source = "registry+https://github.com/rust-lang/crates.io-index" 1034 + checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" 1035 1036 [[package]] 1037 name = "windows_x86_64_gnullvm" 1038 + version = "0.48.5" 1039 source = "registry+https://github.com/rust-lang/crates.io-index" 1040 + checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" 1041 1042 [[package]] 1043 name = "windows_x86_64_msvc" 1044 + version = "0.48.5" 1045 source = "registry+https://github.com/rust-lang/crates.io-index" 1046 + checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
+10 -10
pkgs/build-support/node/fetch-npm-deps/Cargo.toml
··· 6 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 8 [dependencies] 9 - anyhow = "1.0.71" 10 backoff = "0.4.0" 11 - base64 = "0.21.2" 12 digest = "0.10.7" 13 env_logger = "0.10.0" 14 isahc = { version = "1.7.2", default_features = false } 15 - rayon = "1.7.0" 16 - serde = { version = "1.0.164", features = ["derive"] } 17 - serde_json = "1.0.99" 18 - sha1 = "0.10.5" 19 - sha2 = "0.10.7" 20 - tempfile = "3.6.0" 21 - url = { version = "2.4.0", features = ["serde"] } 22 - walkdir = "2.3.3"
··· 6 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 8 [dependencies] 9 + anyhow = "1.0.75" 10 backoff = "0.4.0" 11 + base64 = "0.21.4" 12 digest = "0.10.7" 13 env_logger = "0.10.0" 14 isahc = { version = "1.7.2", default_features = false } 15 + rayon = "1.8.0" 16 + serde = { version = "1.0.188", features = ["derive"] } 17 + serde_json = "1.0.107" 18 + sha1 = "0.10.6" 19 + sha2 = "0.10.8" 20 + tempfile = "3.8.0" 21 + url = { version = "2.4.1", features = ["serde"] } 22 + walkdir = "2.4.0"
+4 -10
pkgs/build-support/node/fetch-npm-deps/src/parse/mod.rs
··· 4 use serde_json::{Map, Value}; 5 use std::{ 6 fs, 7 - io::{self, Read}, 8 process::{Command, Stdio}, 9 }; 10 use tempfile::{tempdir, TempDir}; ··· 106 107 let specifics = match get_hosted_git_url(&resolved)? { 108 Some(hosted) => { 109 - let mut body = util::get_url_with_retry(&hosted)?; 110 111 let workdir = tempdir()?; 112 ··· 120 .stdin(Stdio::piped()) 121 .spawn()?; 122 123 - io::copy(&mut body, &mut cmd.stdin.take().unwrap())?; 124 125 let exit = cmd.wait()?; 126 ··· 154 155 pub fn tarball(&self) -> anyhow::Result<Vec<u8>> { 156 match &self.specifics { 157 - Specifics::Registry { .. } => { 158 - let mut body = Vec::new(); 159 - 160 - util::get_url_with_retry(&self.url)?.read_to_end(&mut body)?; 161 - 162 - Ok(body) 163 - } 164 Specifics::Git { workdir } => Ok(Command::new("tar") 165 .args([ 166 "--sort=name",
··· 4 use serde_json::{Map, Value}; 5 use std::{ 6 fs, 7 + io::Write, 8 process::{Command, Stdio}, 9 }; 10 use tempfile::{tempdir, TempDir}; ··· 106 107 let specifics = match get_hosted_git_url(&resolved)? { 108 Some(hosted) => { 109 + let body = util::get_url_body_with_retry(&hosted)?; 110 111 let workdir = tempdir()?; 112 ··· 120 .stdin(Stdio::piped()) 121 .spawn()?; 122 123 + cmd.stdin.take().unwrap().write_all(&body)?; 124 125 let exit = cmd.wait()?; 126 ··· 154 155 pub fn tarball(&self) -> anyhow::Result<Vec<u8>> { 156 match &self.specifics { 157 + Specifics::Registry { .. } => Ok(util::get_url_body_with_retry(&self.url)?), 158 Specifics::Git { workdir } => Ok(Command::new("tar") 159 .args([ 160 "--sort=name",
+18 -10
pkgs/build-support/node/fetch-npm-deps/src/util.rs
··· 4 Body, Request, RequestExt, 5 }; 6 use serde_json::{Map, Value}; 7 - use std::{env, path::Path}; 8 use url::Url; 9 10 pub fn get_url(url: &Url) -> Result<Body, isahc::Error> { ··· 28 if let Some(host) = url.host_str() { 29 if let Ok(npm_tokens) = env::var("NIX_NPM_TOKENS") { 30 if let Ok(tokens) = serde_json::from_str::<Map<String, Value>>(&npm_tokens) { 31 - if let Some(token) = tokens.get(host).and_then(|val| val.as_str()) { 32 request = request.header("Authorization", format!("Bearer {token}")); 33 } 34 } ··· 38 Ok(request.body(())?.send()?.into_body()) 39 } 40 41 - pub fn get_url_with_retry(url: &Url) -> Result<Body, isahc::Error> { 42 retry(ExponentialBackoff::default(), || { 43 - get_url(url).map_err(|err| { 44 - if err.is_network() || err.is_timeout() { 45 - backoff::Error::transient(err) 46 - } else { 47 - backoff::Error::permanent(err) 48 - } 49 - }) 50 }) 51 .map_err(|backoff_err| match backoff_err { 52 backoff::Error::Permanent(err)
··· 4 Body, Request, RequestExt, 5 }; 6 use serde_json::{Map, Value}; 7 + use std::{env, io::Read, path::Path}; 8 use url::Url; 9 10 pub fn get_url(url: &Url) -> Result<Body, isahc::Error> { ··· 28 if let Some(host) = url.host_str() { 29 if let Ok(npm_tokens) = env::var("NIX_NPM_TOKENS") { 30 if let Ok(tokens) = serde_json::from_str::<Map<String, Value>>(&npm_tokens) { 31 + if let Some(token) = tokens.get(host).and_then(serde_json::Value::as_str) { 32 request = request.header("Authorization", format!("Bearer {token}")); 33 } 34 } ··· 38 Ok(request.body(())?.send()?.into_body()) 39 } 40 41 + pub fn get_url_body_with_retry(url: &Url) -> Result<Vec<u8>, isahc::Error> { 42 retry(ExponentialBackoff::default(), || { 43 + get_url(url) 44 + .and_then(|mut body| { 45 + let mut buf = Vec::new(); 46 + 47 + body.read_to_end(&mut buf)?; 48 + 49 + Ok(buf) 50 + }) 51 + .map_err(|err| { 52 + if err.is_network() || err.is_timeout() { 53 + backoff::Error::transient(err) 54 + } else { 55 + backoff::Error::permanent(err) 56 + } 57 + }) 58 }) 59 .map_err(|backoff_err| match backoff_err { 60 backoff::Error::Permanent(err)