Skip to content

Stalled TLS handshake ignores --timeout (SSL_WAIT_HANDSHAKE never arms the per-slot timeout) #607

Description

@xroche

Found while investigating #605. Minor robustness gap: a connection stuck in the TLS handshake is reaped only by --max-time, never by the per-slot --timeout.

In back_wait the per-slot timeout runs only when the local gestion_timeout flag is armed (htsback.c). That flag is set by the CONNECTING, WAIT_DNS and receiving handlers, but the STATUS_SSL_WAIT_HANDSHAKE handler sets neither it nor timeout_refresh. So when the only in-flight slots are stuck mid-handshake (peer completed the TCP connect but never finishes the TLS handshake), the per-slot timeout loop is skipped and SSL_connect keeps returning WANT_READ until --max-time fires.

Confirmed on POSIX: against a server that accepts the TCP connect and never starts the TLS handshake, --timeout=3 did not interrupt it and the crawl ran until --max-time.

Fix: arm gestion_timeout in the STATUS_SSL_WAIT_HANDSHAKE handler (and refresh timeout_refresh on entry). The existing generic check already reaps any status > 0 slot once armed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions