Skip to content
Tcl Source Code History Of Ticket 218904
Login

History Of Ticket 218904

Artifacts Associated With Ticket 218904

  1. Ticket change [e173925a46] (rid 87452) by nobody on 2000-10-26 01:07:36:

    1. assignee initialized to: "nobody"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      OriginalBugID: 2617 RFE
      Version: 8.2
      SubmitDate: '1999-08-31'
      LastModified: '1999-11-18'
      Severity: MED
      Status: Released
      Submitter: techsupp
      ChangedBy: hobbs
      OS: Windows NT
      Machine: X86
      FixedDate: '1999-11-18'
      FixedInVersion: 8.2.3
      ClosedDate: '2000-10-25'
      
      
      Name:
      
      Matt Newman
      
      
      Extensions:
      
      TLS, LDAP, TCLODBC, ITCL, TCLHTTPD etc etc
      
      
      CustomShell:
      
      Extended http module to support open-end extension for additional transport mechanisms.
      
      
      Comments:
      
      Please accept the patches - I will be making a new release of TLS (aka
      
          SSL for Tcl) shortly, and I belive this patch is important to the future
      
          acceptance and usability of Tcl and SSL. (Not that I really need to
      
          preach to the converted!)
      
      
      DesiredBehavior:
      
      These patches provide two changes:
      
          1. Allow user to override default Content-Type encoding for a POST
      
          operation, which a *MUST*.
      
          2. Allow one to register new protocol handlers to support HTTP over
      
          something other than the default socket channels, e.g. for SSL, or
      
          potentially for doing HTTP over protocols *other* than TCP/IP.
      
      
          E.g.
      
          package require tls
      
          package require http
      
      
          http::register https 443 ::tls::socket
      
      
          set tok [http::geturl https://my.secure.site/foo.htm]
      
      
      Patch:
      
      Index: http.tcl
      
      ===================================================================
      
      RCS file: /cvs/tcl/tcl8.2/library/http2.1/http.tcl,v
      
      retrieving revision 1.1.1.1
      
      diff -c -r1.1.1.1 http.tcl
      
      *** http.tcl1999/08/19 12:32:031.1.1.1
      
      --- http.tcl1999/08/21 15:57:23
      
      ***************
      
      *** 39,48 ****
      
        " " +   \n %0d%0a
      
            }
      
      
      !     namespace export geturl config reset wait formatQuery 
      
            # Useful, but not exported: data size status code
      
        }
      
      
        # http::config --
      
        #
      
        #See documentaion for details.
      
      --- 39,88 ----
      
        " " +   \n %0d%0a
      
            }
      
      
      !     # Supported URL Types
      
      !     variable urlTypes
      
      !     array set urlTypes {
      
      ! http{80 ::socket}
      
      !     }
      
      !     namespace export geturl config reset wait formatQuery register unregister
      
            # Useful, but not exported: data size status code
      
        }
      
      
      + # http::register --
      
      + #
      
      + #See documentaion for details.
      
      + #
      
      + # Arguments:
      
      + #protoURL protocol prefix, e.g. https
      
      + #portDefault port for protocol
      
      + #commandCommand to use to create socket
      
      + # Results:
      
      + #list of port and command that was registered.
      
      + 
      
      + proc http::register {proto port command} {
      
      +     variable urlTypes
      
      +     set urlTypes($proto) [list $port $command]
      
      + }
      
      + 
      
      + # http::unregister --
      
      + #
      
      + #Unregisters URL protocol handler
      
      + #
      
      + # Arguments:
      
      + #protoURL protocol prefix, e.g. https
      
      + # Results:
      
      + #list of port and command that was unregistered.
      
      + 
      
      + proc http::unregister {proto} {
      
      +     variable urlTypes
      
      +     if {![info exists urlTypes($proto)]} {
      
      + return -code error "unsupported url type \"$proto\""
      
      +     }
      
      +     set old $urlTypes($proto)
      
      +     unset urlTypes($proto)
      
      +     return $old
      
      + }
      
      + 
      
        # http::config --
      
        #
      
        #See documentaion for details.
      
      ***************
      
      *** 145,150 ****
      
      --- 185,191 ----
      
      
        proc http::geturl { url args } {
      
            variable http
      
      +     variable urlTypes
      
      
            # Initialize the state variable, an array.  We'll return the
      
            # name of this array as the token for the transaction.
      
      ***************
      
      *** 164,169 ****
      
      --- 205,211 ----
      
        -validate 0
      
        -headers {}
      
        -timeout 0
      
      + -typeapplication/x-www-form-urlencoded
      
        stateheader
      
        meta{}
      
        currentsize0
      
      ***************
      
      *** 173,179 ****
      
        status""
      
            }
      
            set options {-blocksize -channel -command -handler -headers \
      
      ! -progress -query -validate -timeout}
      
            set usage [join $options ", "]
      
            regsub -all -- - $options {} options
      
            set pat ^-([join $options |])$
      
      --- 215,221 ----
      
        status""
      
            }
      
            set options {-blocksize -channel -command -handler -headers \
      
      ! -progress -query -validate -timeout -type}
      
            set usage [join $options ", "]
      
            regsub -all -- - $options {} options
      
            set pat ^-([join $options |])$
      
      ***************
      
      *** 192,210 ****
      
            return -code error "Unknown option $flag, can be: $usage"
      
        }
      
            }
      
      !     if {! [regexp -nocase {^(http://)?([^/:]+)(:([0-9]+))?(/.*)?$} $url \
      
      !     x proto host y port srvurl]} {
      
        error "Unsupported URL: $url"
      
            }
      
            if {[string length $port] == 0} {
      
      ! set port 80
      
            }
      
            if {[string length $srvurl] == 0} {
      
        set srvurl /
      
            }
      
      -     if {[string length $proto] == 0} {
      
      - set url http://$url
      
      -     }
      
            set state(url) $url
      
            if {![catch {$http(-proxyfilter) $host} proxy]} {
      
        set phost [lindex $proxy 0]
      
      --- 234,259 ----
      
            return -code error "Unknown option $flag, can be: $usage"
      
        }
      
            }
      
      !     if {! [regexp -nocase {^(([^:]*)://)?([^/:]+)(:([0-9]+))?(/.*)?$} $url \
      
      !     x prefix proto host y port srvurl]} {
      
        error "Unsupported URL: $url"
      
            }
      
      +     if {[string length $proto] == 0} {
      
      + set proto http
      
      + set url ${proto}://$url
      
      +     }
      
      +     if {![info exists urlTypes($proto)]} {
      
      + return -code error "unsupported url type \"$proto\""
      
      +     }
      
      +     set defport [lindex $urlTypes($proto) 0]
      
      +     set defcmd [lindex $urlTypes($proto) 1]
      
      + 
      
            if {[string length $port] == 0} {
      
      ! set port $defport
      
            }
      
            if {[string length $srvurl] == 0} {
      
        set srvurl /
      
            }
      
            set state(url) $url
      
            if {![catch {$http(-proxyfilter) $host} proxy]} {
      
        set phost [lindex $proxy 0]
      
      ***************
      
      *** 227,235 ****
      
      
            if {[info exists phost] && [string length $phost]} {
      
        set srvurl $url
      
      ! set s [eval socket $async {$phost $pport}]
      
            } else {
      
      ! set s [eval socket $async {$host $port}]
      
            }
      
            set state(sock) $s
      
      
      --- 276,284 ----
      
      
            if {[info exists phost] && [string length $phost]} {
      
        set srvurl $url
      
      ! set s [eval $defcmd $async {$phost $pport}]
      
            } else {
      
      ! set s [eval $defcmd $async {$host $port}]
      
            }
      
            set state(sock) $s
      
      
      ***************
      
      *** 277,283 ****
      
            }
      
            if {$len > 0} {
      
        puts $s "Content-Length: $len"
      
      ! puts $s "Content-Type: application/x-www-form-urlencoded"
      
        puts $s ""
      
        fconfigure $s -translation {auto binary}
      
        puts $s $state(-query)
      
      --- 326,332 ----
      
            }
      
            if {$len > 0} {
      
        puts $s "Content-Length: $len"
      
      ! puts $s "Content-Type: $state(-type)"
      
        puts $s ""
      
        fconfigure $s -translation {auto binary}
      
        puts $s $state(-query)
      
      Index: http.n
      
      ===================================================================
      
      RCS file: /cvs/tcl/tcl8.2/doc/http.n,v
      
      retrieving revision 1.1.1.1
      
      diff -c -r1.1.1.1 http.n
      
      *** http.n1999/08/19 12:32:081.1.1.1
      
      --- http.n1999/08/21 15:57:43
      
      ***************
      
      *** 35,40 ****
      
      --- 35,44 ----
      
        \fB::http::data \fItoken\fR
      
        .sp
      
        \fB::http::cleanup \fItoken\fR
      
      + .sp
      
      + \fB::http::register \fIproto port command\fR
      
      + .sp
      
      + \fB::http::unregister \fIproto\fR
      
        .BE
      
      
        .SH DESCRIPTION
      
      ***************
      
      *** 44,50 ****
      
        of HTTP/1.0.  It allows configuration of a proxy host to get through
      
        firewalls.  The package is compatible with the \fBSafesock\fR security
      
        policy, so it can be used by untrusted applets to do URL fetching from
      
      ! a restricted set of hosts.
      
        .PP
      
        The \fB::http::geturl\fR procedure does a HTTP transaction.
      
        Its \fIoptions \fR determine whether a GET, POST, or HEAD transaction
      
      --- 48,56 ----
      
        of HTTP/1.0.  It allows configuration of a proxy host to get through
      
        firewalls.  The package is compatible with the \fBSafesock\fR security
      
        policy, so it can be used by untrusted applets to do URL fetching from
      
      ! a restricted set of hosts. This package can be extened to support
      
      ! additional HTTP transport protocols, such as HTTPS, by providing
      
      ! a custom \fBsocket\fR command, via \fBhttp::register\fR.
      
        .PP
      
        The \fB::http::geturl\fR procedure does a HTTP transaction.
      
        Its \fIoptions \fR determine whether a GET, POST, or HEAD transaction
      
      ***************
      
      *** 207,212 ****
      
      --- 213,223 ----
      
        The return value of \fB::http::status\fP is \fBtimeout\fP
      
        after a timeout has occurred.
      
        .TP
      
      + \fB\-type\fP \fImime-type\fP
      
      + Use \fImime-type\fR as the \fBContent-Type\fR value, instead of the
      
      + default value (\fBapplication/x-www-form-urlencoded\fR) during a
      
      + POST operation.
      
      + .TP
      
        \fB\-validate\fP \fIboolean\fP
      
        If \fIboolean\fR is non-zero, then \fB::http::geturl\fR does an HTTP HEAD
      
        request.  This request returns meta information about the URL, but the
      
      ***************
      
      *** 252,257 ****
      
      --- 263,287 ----
      
        identified by \fItoken\fP.  After this call, the procedures
      
        like \fB::http::data\fP cannot be used to get information
      
        about the operation.
      
      + .TP
      
      + \fB::http::register\fP \fIproto port command\fP
      
      + This procedure allows one to provide custom HTTP transport types
      
      + such as HTTPS, by registering a prefix, the default port, and the
      
      + command to execute to create the Tcl \fBchannel\fR. E.g.:
      
      + .RS
      
      + .CS
      
      + package require http
      
      + package require tls
      
      + 
      
      + http::register https 443 ::tls::socket
      
      + 
      
      + set tok [http::geturl https://my.secure.site/]
      
      + .CE
      
      + .RE
      
      + .TP
      
      + \fB::http::unregister\fP \fIproto\fP
      
      + This procedure unregisters a protocol handler that was previously
      
      + registered via \fBhttp::register\fR.
      
      
        .SH "STATE ARRAY"
      
        The \fB::http::geturl\fR procedure returns a \fItoken\fR that can be used to
      
      
      PatchFiles:
      
      library/http2.1/http.tcl
      
          doc/http.n
      
      
      
      
      Added to 8.2.3/8.3b1. 
      -- 11/18/1999 hobbs
      
    4. foundin initialized to: "obsolete: 8.2"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "nobody"
    9. subsystem initialized to: "69. Other"
    10. title initialized to: "SSL Support for HTTP module"
    11. type initialized to: "RFE"
  2. Ticket change [3983712ac9] (rid 112406) by welch on 2000-10-26 08:31:15:

    1. closedate changed to: "2000-10-26T01:31:15"
    2. closer changed to: "welch"
    3. priority changed to: "2"
    4. resolution changed to: "Fixed"
    5. status changed to: "Closed"
  3. Ticket change [bab044e4a9] (rid 129364) by dgp on 2001-04-19 03:06:15:

    1. foundin changed to: "None"
    2. status changed to: "Open"
    3. subsystem changed to: "None"
  4. Ticket change [468e1fbf76] (rid 99539) by dgp on 2001-04-19 03:13:01:

    1. closedate changed to: "2001-04-18T20:13:01"
    2. closer changed to: "dgp"
    3. status changed to: "Deleted"
    4. subsystem changed to: "29. http Package"