Ticket Change Details
Overview

Artifact ID: 7732bc8568044b5591bef91764eeb45acd14bb68acd1bdefa00030d6d68174a7
Ticket: 48eddca89ea79b5cb6477d5f9f46cc890873cf92
http:geturl https://localhost:8143/info hangs when server not running
User & Date: anonymous on 2026-02-04 09:06:13
Changes

  1. foundin changed to:
    2.0+, 1.8, commit ca1a846290, but affects older and newer commits as well
    
  2. icomment:
    The problem still occurs with V2.0 (tcltls-20260122101940-ba2ee7744c).
    
    The delivered patch has not bee integrated into the source. Here is an updated version of the patch (starting  around tlsIO.c:230).
    
    ```
    	if (ret <= 0) {
    	    /*
    	     * Problem here when socket is not async and still not
    	     * connected, avoid to loop endlessly. This happens to be the case
    	     * the the destination IP is reachable but no service responds on
    	     * the requested port. Tcl http does not put the socket in async
    	     * mode until connected so we need to allow the Tcl event loop to
    	     * catch the timeout and sit on a vwait for the http token.
    	     * Test case which yields hang in endless loop here without this patch is:
    	     * package require http;
    	     * package require tls;
    	     * ::http::register https 443 [list ::tls::socket -autoservername true]
    	     * set tok [http::geturl https://localhost:8143/info -timeout 3000]
    	     * http::status $tok;
    	     */
    	    if(statePtr->flags & TLS_TCL_ASYNC) {
    		if (rc == SSL_ERROR_WANT_CONNECT || rc == SSL_ERROR_WANT_ACCEPT) {
    		    bioShouldRetry = 1;
    		} else if (rc == SSL_ERROR_WANT_READ) {
    		    bioShouldRetry = 1;
    		    statePtr->want |= TCL_READABLE;
    		} else if (rc == SSL_ERROR_WANT_WRITE) {
    		    bioShouldRetry = 1;
    		    statePtr->want |= TCL_WRITABLE;
    		}
    	    }
    	}
    ```
    
    This fixes the described problem. Please integrate the patch in to 2.0+.
    
  3. login: "anonymous"
  4. mimetype: "text/x-markdown"
  5. resolution changed to: "Open"
  6. status changed to: "Open"