Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2f3f6b344780be653c14c83c2a3c85f2d9ef1467920eafeb27d014b50972cea9
Ticket: e5ed1bb28bd172a94930d7c7a190b4d524521f69
Issue if URL contains numeric IPv6 address
User & Date: anonymous on 2022-04-03 17:30:13
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    While procedure "::http::geturl" is working correctly with host names and numeric IPv4 addresses (e.g. loopback address "127.0.0.1"), it is failing with numeric IPv6 addresses (e.g. loopback address "::1").
    
    Example:
       package require http
       set url "http://\[::1\]:8080/0/0/0.png"
       set rc [catch {::http::geturl $url} token]
       set ncode [::http::ncode $token]
       set data  [::http::data $token]
    Result:
       rc    = 0
       token = ::http::1
       ncode = 400
       data  = "<h1>Bad Message 400</h1><pre>reason: Bad HostPort</pre>"
    
    Reason:
    URL's host and port parts are concatenated and saved in local variable "state(socketinfo)" by statement
       set state(socketinfo) $host:$port
    -> state(socketinfo) = ::1:8080
    and later on, host and port are restored from local variable by following statements
       set host [lindex [split $state(socketinfo) :] 0]
       set port [lindex [split $state(socketinfo) :] 1]
    -> host = ""
       port = ""
    Solution:
    Restoring host and port from local variable by statement
       regexp {(.+):([^:]+)} $state(socketinfo) {} host port
    -> host = "::1"
       port = "8080"
    is working with IPv4 and IPv6 addresses as well as with host names:
       set rc [catch {::http::geturl $url} token]
       set ncode [::http::ncode $token]
       set data  [::http::data $token]
    Result:
       rc    = 0
       token = ::http::1
       ncode = 200
       data  = <response as expected from web server>
    
  5. foundin changed to: "2.9.5, 2.10, ???"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "97cf2819eb5714572703833980f8863ede11fec8"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "29. http Package"
  15. title changed to: "Issue if URL contains numeric IPv6 address"
  16. type changed to: "Bug"