diff options
author | Alexander M Pickering <alex@cogarr.net> | 2024-11-08 15:51:33 -0600 |
---|---|---|
committer | Alexander M Pickering <alex@cogarr.net> | 2024-11-08 15:51:33 -0600 |
commit | 41025a7f5b8b0f839d6515ff67dbb153a3e3f1b1 (patch) | |
tree | b415cb40a37012c0e809fa205f2b3d5e6b69ecbc | |
parent | 95889ab1e9d4a53db81b68e4d2e6cfe4f7d1054d (diff) | |
download | busybox-w32-packaging-41025a7f5b8b0f839d6515ff67dbb153a3e3f1b1.tar.gz busybox-w32-packaging-41025a7f5b8b0f839d6515ff67dbb153a3e3f1b1.tar.bz2 busybox-w32-packaging-41025a7f5b8b0f839d6515ff67dbb153a3e3f1b1.zip |
debugging
-rw-r--r-- | libressl.patch | 246 |
1 files changed, 245 insertions, 1 deletions
diff --git a/libressl.patch b/libressl.patch index 4c0fe3a..cb233da 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..e3d4b73c5 100644 | 138 | index 6a64836fb..7ca84e645 100644 |
139 | --- a/networking/wget.c | 139 | --- a/networking/wget.c |
140 | +++ b/networking/wget.c | 140 | +++ b/networking/wget.c |
141 | @@ -689,6 +689,7 @@ static void reset_beg_range_to_zero(void) | 141 | @@ -689,6 +689,7 @@ static void reset_beg_range_to_zero(void) |
@@ -182,6 +182,250 @@ index 6a64836fb..e3d4b73c5 100644 | |||
182 | #endif | 182 | #endif |
183 | 183 | ||
184 | #if ENABLE_FEATURE_WGET_HTTPS | 184 | #if ENABLE_FEATURE_WGET_HTTPS |
185 | @@ -1151,6 +1181,7 @@ static void download_one_url(const char *url) | ||
186 | server.user = NULL; | ||
187 | target.user = NULL; | ||
188 | |||
189 | + printf("wget download_one_url 1\n"); | ||
190 | parse_url(url, &target); | ||
191 | |||
192 | /* Use the proxy if necessary */ | ||
193 | @@ -1172,6 +1203,7 @@ static void download_one_url(const char *url) | ||
194 | server.host = target.host; | ||
195 | } | ||
196 | } | ||
197 | + printf("wget download_one_url 2\n"); | ||
198 | |||
199 | if (ENABLE_FEATURE_IPV6) | ||
200 | strip_ipv6_scope_id(target.host); | ||
201 | @@ -1191,6 +1223,7 @@ static void download_one_url(const char *url) | ||
202 | G.fname_out = fname_out_alloc = xstrdup(G.fname_out); | ||
203 | } | ||
204 | } | ||
205 | + printf("wget download_one_url 3\n"); | ||
206 | #if ENABLE_FEATURE_WGET_STATUSBAR | ||
207 | G.curfile = bb_get_last_path_component_nostrip(G.fname_out); | ||
208 | #endif | ||
209 | @@ -1206,15 +1239,19 @@ static void download_one_url(const char *url) | ||
210 | * We are not sure it exists on remote side */ | ||
211 | } | ||
212 | |||
213 | + printf("wget download_one_url 4\n"); | ||
214 | redir_limit = 16; | ||
215 | resolve_lsa: | ||
216 | + printf("wget download_one_url 5\n"); | ||
217 | lsa = xhost2sockaddr(server.host, server.port); | ||
218 | if (!(option_mask32 & WGET_OPT_QUIET)) { | ||
219 | char *s = xmalloc_sockaddr2dotted(&lsa->u.sa); | ||
220 | fprintf(stderr, "Connecting to %s (%s)\n", server.host, s); | ||
221 | free(s); | ||
222 | } | ||
223 | + printf("wget download_one_url 6\n"); | ||
224 | establish_session: | ||
225 | + printf("wget download_one_url 7\n"); | ||
226 | /*G.content_len = 0; - redundant, got_clen = 0 is enough */ | ||
227 | G.got_clen = 0; | ||
228 | G.chunked = 0; | ||
229 | @@ -1229,37 +1266,48 @@ static void download_one_url(const char *url) | ||
230 | |||
231 | /* Open socket to http(s) server */ | ||
232 | #if ENABLE_FEATURE_WGET_OPENSSL | ||
233 | + printf("wget download_one_url 8\n"); | ||
234 | /* openssl (and maybe internal TLS) support is configured */ | ||
235 | if (server.protocol == P_HTTPS) { | ||
236 | /* openssl-based helper | ||
237 | * Inconvenient API since we can't give it an open fd | ||
238 | */ | ||
239 | + printf("wget download_one_url 9\n"); | ||
240 | int fd = spawn_https_helper_openssl(server.host, server.port); | ||
241 | + printf("wget download_one_url 10\n"); | ||
242 | # if ENABLE_FEATURE_WGET_HTTPS | ||
243 | if (fd < 0) { /* no openssl? try internal */ | ||
244 | + printf("wget download_one_url 11\n"); | ||
245 | sfp = open_socket(lsa); | ||
246 | spawn_ssl_client(server.host, fileno(sfp), /*flags*/ 0); | ||
247 | goto socket_opened; | ||
248 | + printf("wget download_one_url 12\n"); | ||
249 | } | ||
250 | # else | ||
251 | /* We don't check for exec("openssl") failure in this case */ | ||
252 | # endif | ||
253 | + printf("wget download_one_url 13\n"); | ||
254 | sfp = fdopen(fd, "r+"); | ||
255 | if (!sfp) | ||
256 | bb_die_memory_exhausted(); | ||
257 | + printf("wget download_one_url 14\n"); | ||
258 | goto socket_opened; | ||
259 | } | ||
260 | + printf("wget download_one_url 15\n"); | ||
261 | sfp = open_socket(lsa); | ||
262 | socket_opened: | ||
263 | #elif ENABLE_FEATURE_WGET_HTTPS | ||
264 | /* Only internal TLS support is configured */ | ||
265 | + printf("wget download_one_url 16\n"); | ||
266 | sfp = open_socket(lsa); | ||
267 | if (server.protocol == P_HTTPS) | ||
268 | spawn_ssl_client(server.host, fileno(sfp), /*flags*/ 0); | ||
269 | #else | ||
270 | + printf("wget download_one_url 17\n"); | ||
271 | /* ssl (https) support is not configured */ | ||
272 | sfp = open_socket(lsa); | ||
273 | #endif | ||
274 | + printf("wget download_one_url 18\n"); | ||
275 | /* Send HTTP request */ | ||
276 | if (use_proxy) { | ||
277 | SENDFMT(sfp, "GET %s://%s/%s HTTP/1.1\r\n", | ||
278 | @@ -1270,6 +1318,7 @@ static void download_one_url(const char *url) | ||
279 | (option_mask32 & WGET_OPT_POST) ? "POST" : "GET", | ||
280 | target.path); | ||
281 | } | ||
282 | + printf("wget download_one_url 19\n"); | ||
283 | if (!USR_HEADER_HOST) | ||
284 | SENDFMT(sfp, "Host: %s\r\n", target.host); | ||
285 | if (!USR_HEADER_USER_AGENT) | ||
286 | @@ -1280,6 +1329,7 @@ static void download_one_url(const char *url) | ||
287 | */ | ||
288 | SENDFMT(sfp, "Connection: close\r\n"); | ||
289 | |||
290 | + printf("wget download_one_url 20\n"); | ||
291 | #if ENABLE_FEATURE_WGET_AUTHENTICATION | ||
292 | if (target.user && !USR_HEADER_AUTH) { | ||
293 | SENDFMT(sfp, "Proxy-Authorization: Basic %s\r\n"+6, | ||
294 | @@ -1291,6 +1341,7 @@ static void download_one_url(const char *url) | ||
295 | } | ||
296 | #endif | ||
297 | |||
298 | + printf("wget download_one_url 21\n"); | ||
299 | if (G.beg_range != 0 && !USR_HEADER_RANGE) | ||
300 | SENDFMT(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); | ||
301 | |||
302 | @@ -1300,6 +1351,7 @@ static void download_one_url(const char *url) | ||
303 | fputs(G.extra_headers, sfp); | ||
304 | } | ||
305 | |||
306 | + printf("wget download_one_url 22\n"); | ||
307 | if (option_mask32 & WGET_OPT_POST_FILE) { | ||
308 | int fd = xopen_stdin(G.post_file); | ||
309 | G.post_data = xmalloc_read(fd, NULL); | ||
310 | @@ -1314,15 +1366,18 @@ static void download_one_url(const char *url) | ||
311 | ); | ||
312 | } | ||
313 | # if ENABLE_PLATFORM_MINGW32 | ||
314 | + printf("wget download_one_url 23\n"); | ||
315 | if (!USR_HEADER_CONTENT_LENGTH) | ||
316 | SENDFMT(sfp, "Content-Length: %u\r\n", | ||
317 | (int)strlen(G.post_data) | ||
318 | ); | ||
319 | + printf("wget download_one_url 24\n"); | ||
320 | SENDFMT(sfp, | ||
321 | "\r\n" | ||
322 | "%s", | ||
323 | G.post_data | ||
324 | ); | ||
325 | + printf("wget download_one_url 25\n"); | ||
326 | } else | ||
327 | # else | ||
328 | SENDFMT(sfp, | ||
329 | @@ -1338,6 +1393,7 @@ static void download_one_url(const char *url) | ||
330 | SENDFMT(sfp, "\r\n"); | ||
331 | } | ||
332 | |||
333 | + printf("wget download_one_url 26\n"); | ||
334 | fflush(sfp); | ||
335 | |||
336 | /* Tried doing this unconditionally. | ||
337 | @@ -1358,6 +1414,7 @@ static void download_one_url(const char *url) | ||
338 | * Retrieve HTTP response line and check for "200" status code. | ||
339 | */ | ||
340 | read_response: | ||
341 | + printf("wget download_one_url 27\n"); | ||
342 | fgets_trim_sanitize(sfp, " %s\n"); | ||
343 | |||
344 | str = G.wget_buf; | ||
345 | @@ -1441,6 +1498,7 @@ However, in real world it was observed that some web servers | ||
346 | /* | ||
347 | * Retrieve HTTP headers. | ||
348 | */ | ||
349 | + printf("wget download_one_url 28\n"); | ||
350 | while ((str = get_sanitized_hdr(sfp)) != NULL) { | ||
351 | static const char keywords[] ALIGN1 = | ||
352 | "content-length\0""transfer-encoding\0""location\0"; | ||
353 | @@ -1497,6 +1555,7 @@ However, in real world it was observed that some web servers | ||
354 | goto establish_session; | ||
355 | } | ||
356 | } | ||
357 | + printf("wget download_one_url 29\n"); | ||
358 | // if (status >= 300) | ||
359 | // bb_error_msg_and_die("bad redirection (no Location: header from server)"); | ||
360 | |||
361 | @@ -1514,6 +1573,7 @@ However, in real world it was observed that some web servers | ||
362 | |||
363 | free(lsa); | ||
364 | |||
365 | + printf("wget download_one_url 30\n"); | ||
366 | if (!(option_mask32 & WGET_OPT_SPIDER)) { | ||
367 | if (G.output_fd < 0) | ||
368 | G.output_fd = xopen(G.fname_out, G.o_flags); | ||
369 | @@ -1536,6 +1596,7 @@ However, in real world it was observed that some web servers | ||
370 | /* ftpcmd("QUIT", NULL, sfp); - why bother? */ | ||
371 | } | ||
372 | #endif | ||
373 | + printf("wget download_one_url 31\n"); | ||
374 | fclose(sfp); | ||
375 | |||
376 | free(server.allocated); | ||
377 | @@ -1544,11 +1605,13 @@ However, in real world it was observed that some web servers | ||
378 | free(target.user); | ||
379 | free(fname_out_alloc); | ||
380 | free(redirected_path); | ||
381 | + printf("wget download_one_url 32\n"); | ||
382 | } | ||
383 | |||
384 | int wget_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | ||
385 | int wget_main(int argc UNUSED_PARAM, char **argv) | ||
386 | { | ||
387 | + printf("wget main 1\n"); | ||
388 | #if ENABLE_FEATURE_WGET_LONG_OPTIONS | ||
389 | static const char wget_longopts[] ALIGN1 = | ||
390 | /* name, has_arg, val */ | ||
391 | @@ -1590,6 +1653,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | ||
392 | #endif | ||
393 | |||
394 | INIT_G(); | ||
395 | + printf("wget main 2\n"); | ||
396 | |||
397 | #if ENABLE_FEATURE_WGET_TIMEOUT | ||
398 | G.timeout_seconds = 900; | ||
399 | @@ -1626,6 +1690,8 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | ||
400 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_data) | ||
401 | IF_FEATURE_WGET_LONG_OPTIONS(, &G.post_file) | ||
402 | ); | ||
403 | + | ||
404 | + printf("wget main 3\n"); | ||
405 | #if 0 /* option bits debug */ | ||
406 | if (option_mask32 & WGET_OPT_RETRIES) bb_error_msg("-t NUM"); | ||
407 | if (option_mask32 & WGET_OPT_nsomething) bb_error_msg("-nsomething"); | ||
408 | @@ -1670,6 +1736,7 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | ||
409 | } | ||
410 | #endif | ||
411 | |||
412 | + printf("wget main 4\n"); | ||
413 | G.output_fd = -1; | ||
414 | G.o_flags = O_WRONLY | O_CREAT | O_TRUNC | O_EXCL; | ||
415 | if (G.fname_out) { /* -O FILE ? */ | ||
416 | @@ -1691,8 +1758,11 @@ IF_DESKTOP( "no-parent\0" No_argument "\xf0") | ||
417 | } | ||
418 | } | ||
419 | |||
420 | - while (*argv) | ||
421 | + printf("wget main 5\n"); | ||
422 | + while (*argv) { | ||
423 | + printf("wget main 5-%s\n",argv); | ||
424 | download_one_url(*argv++); | ||
425 | + } | ||
426 | |||
427 | if (G.output_fd >= 0) | ||
428 | xclose(G.output_fd); | ||
185 | diff --git a/scripts/trylink b/scripts/trylink | 429 | diff --git a/scripts/trylink b/scripts/trylink |
186 | index 2456252a3..6186284f1 100755 | 430 | index 2456252a3..6186284f1 100755 |
187 | --- a/scripts/trylink | 431 | --- a/scripts/trylink |