| 455 | */ |
| 456 | |
| 457 | http_t * /* O - New HTTP connection */ |
| 458 | httpConnect2( |
| 459 | const char *host, /* I - Host to connect to */ |
| 460 | int port, /* I - Port number */ |
| 461 | http_addrlist_t *addrlist, /* I - List of addresses or @code NULL@ to lookup */ |
| 462 | int family, /* I - Address family to use or @code AF_UNSPEC@ for any */ |
| 463 | http_encryption_t encryption, /* I - Type of encryption to use */ |
| 464 | int blocking, /* I - 1 for blocking connection, 0 for non-blocking */ |
| 465 | int msec, /* I - Connection timeout in milliseconds, 0 means don't connect */ |
| 466 | int *cancel) /* I - Pointer to "cancel" variable */ |
| 467 | { |
| 468 | http_t *http; /* New HTTP connection */ |
| 469 | |
| 470 | |
| 471 | DEBUG_printf(("httpConnect2(host=\"%s\", port=%d, addrlist=%p, family=%d, encryption=%d, blocking=%d, msec=%d, cancel=%p)", host, port, (void *)addrlist, family, encryption, blocking, msec, (void *)cancel)); |
| 472 | |
| 473 | /* |
| 474 | * Create the HTTP structure... |
| 475 | */ |
| 476 | |
| 477 | if ((http = http_create(host, port, addrlist, family, encryption, blocking, |
| 478 | _HTTP_MODE_CLIENT)) == NULL) |
| 479 | return (NULL); |
| 480 | |
| 481 | /* |
| 482 | * Optionally connect to the remote system... |
| 483 | */ |
| 484 | |
| 485 | if (msec == 0 || !httpReconnect2(http, msec, cancel)) |
| 486 | return (http); |
| 487 | |
| 488 | /* |
| 489 | * Could not connect to any known address - bail out! |
| 490 | */ |
| 491 | |
| 492 | httpClose(http); |
| 493 | |
| 494 | return (NULL); |
| 495 | } |
| 496 | |
| 497 | |
| 498 | /* |