Diff
Not logged in

Differences From Artifact [e31e1d5419]:

To Artifact [4a9eb76edf]:


289
290
291
292
293
294
295
296

297

298

299
300
301
302
303
304
305
289
290
291
292
293
294
295

296
297
298

299
300
301
302
303
304
305
306







-
+

+
-
+







    #       which is typically included with the Tcl core distribution.
    #
    package require http 2.0

    #
    # NOTE: Tcl 8.6 added support for IPv6; however, on some machines this
    #       support can cause sockets to hang for a long time.  Therefore,
    #       for now, always force the use of IPv4.
    #       for now, by default, always force the use of IPv4.
    #
    if {![info exists ::no(tclSocketAfInet)] && \
    if {[info exists tcl_version] && $tcl_version >= 8.6} then {
        [info exists tcl_version] && $tcl_version >= 8.6} then {
      namespace eval ::tcl::unsupported {}
      set ::tcl::unsupported::socketAF inet
    }

    #
    # NOTE: Setup lowercase URI scheme prefixes used within this procedure
    #       to detect and/or change the URI scheme used.  By default, this
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383













384
385
386
387
388
389
390
354
355
356
357
358
359
360












361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392







-
-
-
-
-
-
-
-
-
-
-
-












+
+
+
+
+
+
+
+
+
+
+
+
+







    # NOTE: All downloads are handled synchronously, which is not ideal;
    #       however, it is simple.  Keep going as long as there are less
    #       than X redirects.
    #
    set redirectCount 0

    while {1} {
      #
      # NOTE: Issue the HTTP request now, grabbing the resulting token.
      #
      if {$verboseGetUrl} then {
        #
        # NOTE: Emit important diagnostic information related to this
        #       HTTP request here.  This may be enhanced in the future.
        #
        pageLog [appendArgs \
            "attempting to download URL \"" $uri \"...]
      }

      #
      # NOTE: Build the (optional?) list of options for the HTTP call.
      #
      set localArgs [list]

      if {$timeoutGetUrl != 0} then {
        lappend localArgs -timeout $timeoutGetUrl; # milliseconds
      }

      if {[llength $args] > 0} then {
        eval lappend localArgs $args
      }

      #
      # NOTE: Issue the HTTP request now, grabbing the resulting token.
      #
      if {$verboseGetUrl} then {
        #
        # NOTE: Emit important diagnostic information related to this
        #       HTTP request here.  This may be enhanced in the future.
        #
        pageLog [appendArgs \
            "attempting to download URL \"" $uri "\" with arguments \"" \
            $localArgs \"...]
      }

      #
      # NOTE: Attempt to perform the actual HTTP request.  This can fail
      #       in an almost unlimited number of ways, which is fun.
      #
      set token [eval ::http::geturl [list $uri] $localArgs]