Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: db91024c6924ae6bf2c6dcfa1df5a07e95764312
Ticket: 219235ffffffffffffffffffffffffffffffffff
Get broken pipe error while making a https connection to a n
User & Date: nobody on 2000-10-26 05:03:57
Changes

  1. assignee changed to: "nobody"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    OriginalBugID: 4653 Bug
    Version: 8.3
    SubmitDate: '2000-03-28'
    LastModified: '2000-04-04'
    Severity: LOW
    Status: Assigned
    Submitter: mroe
    ChangedBy: sandeep
    OS: Solaris
    FixedDate: '2000-10-25'
    ClosedDate: '2000-10-25'
    
    
    Sample script:
    
    # httpsConnect.tcl -
    #
    #    Short tcl test script for tcl TLS and OpenSSL.
    #    Open socket connection to secure web server.
    
    package require http
    package require tls
    package require base64
    
    set ::tls::debug 1
    
    set headers [list Authorization "Basic [base64::encode mroe:mroe]"]
    set url https://elche:8016
    
    set cvsPath   [file join / home mroe cvs]
    set certFile  [file join $cvsPath xmlserver modules x509 certs client.pem]
    set keyFile   [file join $cvsPath xmlserver modules x509 certs ckey.pem]
    set caFile    [file join $cvsPath xmlserver modules x509 certs cacert.pem]
    set caDir     [file join $cvsPath xmlserver modules x509 certs]
    
    http::register https 443 [list ::tls::socket  -request  1  -require  1  -certfile $certFile  -keyfile  $keyFile   -cafile   $caFile    ]
    
    http::geturl $url  -query   "test"  -headers $headers  -timeout 15000
    
    exit 0
    
    Run the above script while the server is not running.
    
    Expected result:
        Same as when running this command without running http::register first,
        http::status = ioerror.
    
    Actual result:
        error flushing "sock4": broken pipe
        while executing
    "flush $s"
        ("eval" body line 35)
        (procedure "wait" line 35)
        invoked from within
    "wait $token"
        (procedure "http::geturl" line 219)
        invoked from within
    "http::geturl $url  -query   "test"  -headers $headers  -timeout 15000"
        (file "httpsConnect.tcl" line 53)
    
    
    
    The problem is that we open a socket to the remote server using tls::socket, but the normal way we check whether a socket is "good" doesn't work on tls sockets.  (The normal way is to check eof on the socket and do fconfigure $sock -error.}  One way to figure out if the socket is invalid early on is to call tls::handshake on the tls socket.  But the http package currently has no way to know this when checking the connection in http::Connect.  I believe the right thing to do is to register two tls methods for doing https: tls::socket for establishing the connection and tls::handshake for checking if the connection is good.  Then http::Connect can call tls::handshake to check if the socket is good for tls sockets while doing what it usually does for normal sockets.
    
    
    I believe this approach would also solve some other annoying problems that pop up due to lack of communication between the http package and tls.
    
    
    For now, the work-around is to catch the geturl and massage the error message. 
    
    -- 04/04/2000 sandeep
    
    
    
  4. foundin changed to: "obsolete: 8.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "nobody"
  9. subsystem changed to: "62. (unused)"
  10. title changed to:
    Get broken pipe error while making a https connection to a n
    
  11. type changed to: "Bug"