| | @@ -456,16 +456,27 @@ |
| 456 | 456 | ssl_global_init_client(); |
| 457 | 457 | if( pUrlData->useProxy ){ |
| 458 | 458 | int rc; |
| 459 | 459 | char *connStr = mprintf("%s:%d", g.url.name, pUrlData->port); |
| 460 | 460 | BIO *sBio = BIO_new_connect(connStr); |
| 461 | | - if( g.fIPv4 ){ |
| 461 | + switch( g.eIPvers ){ |
| 462 | + default: /* Any available protocol */ |
| 463 | + break; |
| 464 | + case 1: /* IPv4 only */ |
| 462 | 465 | #ifdef BIO_FAMILY_IPV4 |
| 463 | | - BIO_set_conn_ip_family(sBio, BIO_FAMILY_IPV4); |
| 466 | + BIO_set_conn_ip_family(sBio, BIO_FAMILY_IPV4); |
| 467 | +#else |
| 468 | + fossil_warning("The --ipv4 option is not supported in this build\n"); |
| 469 | +#endif |
| 470 | + break; |
| 471 | + case 2: /* IPv6 only */ |
| 472 | +#ifdef BIO_FAMILY_IPV6 |
| 473 | + BIO_set_conn_ip_family(sBio, BIO_FAMILY_IPV6); |
| 464 | 474 | #else |
| 465 | | - fossil_warning("The --ipv4 option is not supported in this build\n"); |
| 475 | + fossil_warning("The --ipv6 option is not supported in this build\n"); |
| 466 | 476 | #endif |
| 477 | + break; |
| 467 | 478 | } |
| 468 | 479 | fossil_free(connStr); |
| 469 | 480 | if( BIO_do_connect(sBio)<=0 ){ |
| 470 | 481 | ssl_set_errmsg("SSL: cannot connect to proxy %s:%d (%s)", |
| 471 | 482 | pUrlData->name, pUrlData->port, |
| | @@ -516,16 +527,27 @@ |
| 516 | 527 | |
| 517 | 528 | if( !pUrlData->useProxy ){ |
| 518 | 529 | char *connStr = mprintf("%s:%d", pUrlData->name, pUrlData->port); |
| 519 | 530 | BIO_set_conn_hostname(iBio, connStr); |
| 520 | 531 | fossil_free(connStr); |
| 521 | | - if( g.fIPv4 ){ |
| 532 | + switch( g.eIPvers ){ |
| 533 | + default: /* Any available protocol */ |
| 534 | + break; |
| 535 | + case 1: /* IPv4 only */ |
| 522 | 536 | #ifdef BIO_FAMILY_IPV4 |
| 523 | | - BIO_set_conn_ip_family(iBio, BIO_FAMILY_IPV4); |
| 537 | + BIO_set_conn_ip_family(iBio, BIO_FAMILY_IPV4); |
| 538 | +#else |
| 539 | + fossil_warning("The --ipv4 option is not supported in this build\n"); |
| 540 | +#endif |
| 541 | + break; |
| 542 | + case 2: /* IPv6 only */ |
| 543 | +#ifdef BIO_FAMILY_IPV6 |
| 544 | + BIO_set_conn_ip_family(iBio, BIO_FAMILY_IPV6); |
| 524 | 545 | #else |
| 525 | | - fossil_warning("The --ipv4 option is not supported in this build\n"); |
| 546 | + fossil_warning("The --ipv6 option is not supported in this build\n"); |
| 526 | 547 | #endif |
| 548 | + break; |
| 527 | 549 | } |
| 528 | 550 | if( BIO_do_connect(iBio)<=0 ){ |
| 529 | 551 | ssl_set_errmsg("SSL: cannot connect to host %s:%d (%s)", |
| 530 | 552 | pUrlData->name, pUrlData->port, |
| 531 | 553 | ERR_reason_error_string(ERR_get_error())); |
| 532 | 554 | |