Diff
Not logged in

Differences From Artifact [50ec21baae]:

To Artifact [f5323e45b7]:


1284
1285
1286
1287
1288
1289
1290

























1291
1292
1293
1294
1295
1296
1297
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322







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







      }
      default {
        error "unsupported package platform"
      }
    }
  }

  #
  # NOTE: This procedure checks the current login cookie to make sure that
  #       it exists -AND- conforms to the correct format.
  #
  proc haveValidLoginCookie {} {
    variable loginCookie

    if {![info exists loginCookie]} then {
      return false
    }

    if {[isEagle] || \
        ([info exists tcl_version] && $tcl_version >= 8.5)} then {
      if {[string is list -strict $loginCookie]} then {
        return false
      }
    }

    if {[llength $loginCookie] != 2} then {
      return false
    }

    return true
  }

  #
  # NOTE: This procedure issues a request to an HTTP(S) server.  It returns
  #       the raw response data verbatim.  It may raise a script error.  It
  #       will always use the currently configured HTTP(S) login cookie, if
  #       any; therefore, it should really only be used for requests to the
  #       package file server.  The uri argument is the fully qualified URI
  #       to request.  The allowHtml argument should be non-zero if raw HTML
1324
1325
1326
1327
1328
1329
1330
1331

1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348

1349
1350
1351
1352
1353
1354
1355
1349
1350
1351
1352
1353
1354
1355

1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372

1373
1374
1375
1376
1377
1378
1379
1380







-
+
















-
+







            TestSetScriptNewWebClientCallback "" true true error]

        if {$code ne "Ok"} then {
          error [getStringFromObjectHandle $error]
        }
      }

      if {[info exists loginCookie] && [llength $loginCookie] == 2} then {
      if {[haveValidLoginCookie]} then {
        set script [object create String {
          if {[methodName ToString] eq "GetWebRequest"} then {
            webRequest Headers.Add Cookie [join $loginCookie =]
          }
        }]

        set data [uri download \
            -timeouttype network -inline \
            -webclientdata $script -- $uri]
      } else {
        set data [uri download \
            -timeouttype network -inline -- $uri]
      }
    } else {
      set options [list -binary true]

      if {[info exists loginCookie] && [llength $loginCookie] == 2} then {
      if {[haveValidLoginCookie]} then {
        lappend options -headers [list Cookie [join $loginCookie =]]
      }

      set data [eval ::PackageRepository::getFileViaHttp \
          [list $uri] [list 20] [list stdout] [list $quiet] $options]
    }

1413
1414
1415
1416
1417
1418
1419
1420

1421
1422
1423
1424
1425
1426
1427
1438
1439
1440
1441
1442
1443
1444

1445
1446
1447
1448
1449
1450
1451
1452







-
+







  proc maybeResetCookieAndLoginSimple {} {
    variable loginCookie

    #
    # NOTE: Attempt to verify that we are currently logged in.  If so, do
    #       nothing; otherwise, attempt to login.
    #
    if {![info exists loginCookie] || [llength $loginCookie] != 2} then {
    if {![haveValidLoginCookie]} then {
      resetCookieAndLoginSimple
    }
  }

  #
  # NOTE: This procedure resets the currently configured login cookie, if
  #       any, and then attempts to login using the specified user name and
1491
1492
1493
1494
1495
1496
1497
1498

1499
1500
1501
1502
1503
1504
1505
1516
1517
1518
1519
1520
1521
1522

1523
1524
1525
1526
1527
1528
1529
1530







-
+







    variable loginCookie
    variable logoutUri
    variable logoutUrn

    #
    # NOTE: Attempt to verify that we are currently logged in.
    #
    if {![info exists loginCookie] || [llength $loginCookie] != 2} then {
    if {![haveValidLoginCookie]} then {
      error "missing or invalid login cookie"
    }

    #
    # NOTE: Build the full URI for the logout request, performing any
    #       applicable substitutions in the URI prior to using it as
    #       the basis for logging out of the repository.