Overview
Comment: | Add Fossil login cookie support. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
be4962976f98dda3d9163e1479bfd646 |
User & Date: | mistachkin on 2016-08-21 08:01:49 |
Other Links: | manifest | tags |
Context
2016-08-21
| ||
21:16 | Add Fossil logout support. check-in: 9b4f8b3fdc user: mistachkin tags: trunk | |
08:01 | Add Fossil login cookie support. check-in: be4962976f user: mistachkin tags: trunk | |
04:47 | On second thought, rename the 'lookupPackage' procedure to 'getPackageFromRepository', to more closely reflect what it does. check-in: 6cd37c53a1 user: mistachkin tags: trunk | |
Changes
Modified client/1.0/pkgd.eagle from [1f3f84a892] to [e26961fb7d].
︙ | ︙ | |||
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # variable clientDirectory if {![info exists clientDirectory]} then { set clientDirectory [file dirname $script] } # # NOTE: Prevent progress messages from being displayed while downloading # from the repository, etc? By default, this is enabled. # variable quiet; # DEFAULT: true if {![info exists quiet]} then { set quiet true } # | > > > > > > > > > > | | | > > > > > > > > > > > > | > | > | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | # variable clientDirectory if {![info exists clientDirectory]} then { set clientDirectory [file dirname $script] } # # NOTE: This is the HTTP(S) login cookie to use when downloading files # from the package file server. # variable loginCookie; # DEFAULT: NONE if {![info exists loginCookie]} then { set loginCookie [list] } # # NOTE: Prevent progress messages from being displayed while downloading # from the repository, etc? By default, this is enabled. # variable quiet; # DEFAULT: true if {![info exists quiet]} then { set quiet true } # # NOTE: The base URI used to build the URIs for the package file server. # variable baseUri; # DEFAULT: https://urn.to/r if {![info exists baseUri]} then { set baseUri https://urn.to/r } # # NOTE: The URI where a login request may be sent. This should return a # payload containing the necessary HTTP(S) cookie information. # variable loginUri; # DEFAULT: ${baseUri}/pkgd_login?... if {![info exists loginUri]} then { set loginUri [string trim { ${baseUri}/pkgd_login?name=${userName}&password=${password} }] } # # NOTE: The URI where a single package file may be found. This file will # belong to a specific version of one package. # variable downloadUri; # DEFAULT: ${baseUri}/pkgd_file?... if {![info exists downloadUri]} then { set downloadUri [string trim { ${baseUri}/pkgd_file?download&ci=trunk&filename=${fileName} }] } # # NOTE: The root directory where any persistent packages will be saved. # variable persistentRootDirectory; # DEFAULT: [getPersistentRootDirectory] |
︙ | ︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | # # NOTE: This procedure returns non-zero if the specified file seems to be # a Harpy script certificate file. The fileName argument is the name # of the file to check, which may or may not exist. The nameOnly # argument should be non-zero to ignore the contents of the file. # proc isHarpyCertificateFileName { fileName nameOnly } { if {[string length $fileName] == 0} then { return false } set extension [file extension $fileName] | > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | # # NOTE: This procedure returns non-zero if the specified file seems to be # a Harpy script certificate file. The fileName argument is the name # of the file to check, which may or may not exist. The nameOnly # argument should be non-zero to ignore the contents of the file. # # <notUsed> proc isHarpyCertificateFileName { fileName nameOnly } { if {[string length $fileName] == 0} then { return false } set extension [file extension $fileName] |
︙ | ︙ | |||
228 229 230 231 232 233 234 235 236 237 238 239 240 241 | set isClient true } else { error "unsupported language" } } # # NOTE: This procedure checks if there is a higher version available of the # specified package on the package file server. The language argument # must be one of the literal strings "eagle", "tcl", or "client". The # version argument must be one of the literal strings "8.4", "8.5", or # "8.6" when the language is "tcl" -OR- the literal string "1.0" when # the language is either "eagle" or "client". The packageName argument | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | set isClient true } else { error "unsupported language" } } # # 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. # proc getPackageFile { uri } { variable loginCookie variable quiet if {[isEagle]} then { if {![object invoke Eagle._Tests.Default \ TestHasScriptNewWebClientCallback ""]} then { set error null set code [object invoke Eagle._Tests.Default \ TestSetScriptNewWebClientCallback "" true true error] if {$code ne "Ok"} then { error [getStringFromObjectHandle $error] } } if {[info exists loginCookie] && [llength $loginCookie] == 2} then { set script [object create String { if {[methodName ToString] eq "GetWebRequest"} then { webRequest Headers.Add Cookie [join $loginCookie =] } }] return [uri download -inline -webclientdata $script -- $uri] } else { return [uri download -inline -- $uri] } } else { set options [list -binary true] if {[info exists loginCookie] && [llength $loginCookie] == 2} then { lappend options -headers [list Cookie [join $loginCookie =]] } return [eval ::PackageRepository::getFileViaHttp \ [list $uri] [list 20] [list stdout] [list $quiet] $options] } } # # NOTE: This procedure resets the currently configured login cookie, if # any, and then attempts to login using the specified user name and # password. Upon success, it will set the login cookie to the one # from the raw response data. Upon failure, a script error will be # raised. The userName argument must be the name of a package file # server user with at least Fossil Check-Out (o) permissions on the # package file server. The password argument must be the plaintext # password that is associated with the specified user name. # # <public> proc resetCookieAndLogin { userName password } { variable baseUri variable loginCookie variable loginUri # # NOTE: Build the full URI for the login request. # set uri [subst $loginUri] # # NOTE: Reset the old login cookie, if any. Then, issue a new login # request, capturing the raw response data. # set loginCookie [list]; set data [getPackageFile $uri] # # NOTE: Attempt to extract the necessary values from the raw response # data. # set pattern(1) {"authToken":"(.*?)"}; # TODO: *HACK* Keep updated. if {![regexp -- $pattern(1) $data dummy authToken]} then { error "login response missing \"authToken\"" } set pattern(2) {"loginCookieName":"(.*?)"}; # TODO: *HACK* Keep updated. if {![regexp -- $pattern(2) $data dummy loginCookieName]} then { error "login response missing \"loginCookieName\"" } # # NOTE: Set the login cookie to the one freshly extracted from the raw # response data. # set loginCookie [list $loginCookieName $authToken] # # NOTE: Always return an empty string (i.e. and not the login data). # return "" } # # NOTE: This procedure checks if there is a higher version available of the # specified package on the package file server. The language argument # must be one of the literal strings "eagle", "tcl", or "client". The # version argument must be one of the literal strings "8.4", "8.5", or # "8.6" when the language is "tcl" -OR- the literal string "1.0" when # the language is either "eagle" or "client". The packageName argument |
︙ | ︙ | |||
274 275 276 277 278 279 280 | set localFileName [file join $persistentDirectory $fileName] set compare [package vcompare \ [string trim [readFile $downloadFileName]] \ [string trim [readFile $localFileName]]] | > > > | > > | 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | set localFileName [file join $persistentDirectory $fileName] set compare [package vcompare \ [string trim [readFile $downloadFileName]] \ [string trim [readFile $localFileName]]] if {[isEagle]} then { file delete -recursive -- $temporaryDirectory } else { file delete -force -- $temporaryDirectory } return [expr {$compare > 0}] } # # NOTE: This procedure downloads a single file from the package file server, # writing its contents to the specified local file name. It can also # verify the OpenPGP signatures. When an OpenPGP signature file is |
︙ | ︙ | |||
298 299 300 301 302 303 304 | # where the downloaded file should be written. The usePgp argument # should be non-zero when an OpenPGP signature file needs to be # downloaded and verified for the downloaded file. # proc downloadOneFile { language version fileName localFileName usePgp } { variable baseUri variable downloadUri | < < < < | < < | 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 | # where the downloaded file should be written. The usePgp argument # should be non-zero when an OpenPGP signature file needs to be # downloaded and verified for the downloaded file. # proc downloadOneFile { language version fileName localFileName usePgp } { variable baseUri variable downloadUri # # NOTE: First, build the full relative file name to download from # the remote package repository. # set fileName [file join $language $version $fileName] set uri [subst $downloadUri] # # NOTE: Then, in one step, download the file from the package file # server and write it to the specified local file. # writeFile $localFileName [getPackageFile $uri] # # NOTE: Is use of OpenPGP for signature verification enabled? Also, # did we just download an OpenPGP signature file? # if {$usePgp && [isPgpSignatureFileName $localFileName true]} then { # |
︙ | ︙ | |||
457 458 459 460 461 462 463 | if {$useAutoPath} then { foreach downloadDirectory $downloadDirectories { addToAutoPath $language $downloadDirectory } } if {$persistent} then { | > > > | > | 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | if {$useAutoPath} then { foreach downloadDirectory $downloadDirectories { addToAutoPath $language $downloadDirectory } } if {$persistent} then { if {[isEagle]} then { file delete -recursive -- $temporaryDirectory } else { file delete -force -- $temporaryDirectory } } return $downloadDirectories } # # NOTE: This package requires the package repository client package. |
︙ | ︙ |
Modified client/1.0/pkgd.eagle.asc from [86ffeca9c4] to [366ad7ed41].
1 2 3 4 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Eagle Package Repository | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Eagle Package Repository iQIcBAABCAAGBQJXuV/cAAoJEFAslq9JXcLZTIoQALdsxhprLPHT9pQCm02Gzc+g ruhWk4FYThLYOJPWF/R2K+X9M2HjCGEdoY1x/VDkMbArn6iE7gndZz6NMyZL7gbK Y2lQf7eBW/U/eF63xFeVsgWdU5wRB9SVOkghIO0LRH6hO3zZvKTFNf9rU88kD5KI o4/RY60UTWgx8rBniI9gj5v5V6qvpmtLBlMTT6hLq7PU1STKsMof2UkDYHNxZcC2 Z86xHJI0LS3LV8sM2Ey6BpuS6GXPCApg2IeRJs2M/NRVRJLV1HcbmiMBrzNH0Av9 t64Yv49hGX043nGbw7SnAQbltFlWjXSoHqiyaoe+okVT19u9RwdcEESOVDA1L9vm ajk/R/QmrW1p75rncjlo9yCyd+BLupoWC1vftbQoWomrptgmqcMuevO2PniDcaO6 zPACXpD+w3XIk9kSpgibm4edIxvT+bztUBMhyNg2W1kT6zwGyyrrLDpnUcgz8u+j wTmgTbHnbC2GSDbI3dU33ZBDrxEp6B8ZqFHoMIdPOD1EUdXKoEOww7hyEtXv3mnj vapl6529XogSr7CVTtXg1VpiJUpA526szANmP8XCJrtQBEbDheN6REHtzs8cNFvM o2ndOjC3Ox+BZSLHB9Kt88+h7TN87OOcEJcahbvmJXpzcTBwr+9ox2vvMxMAXowI qGP+7UdKk2U5p7l7XJV4 =k7R4 -----END PGP SIGNATURE----- |
Modified client/1.0/pkgd.eagle.harpy from [7288a419a5] to [1c0acbc585].
︙ | ︙ | |||
17 18 19 20 21 22 23 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> | | | | | | | | | | | | | | | | | | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | THE ASSOCIATED SOFTWARE MAY NOT WORK PROPERLY IF THIS FILE IS ALTERED. --> <Certificate xmlns="https://eagle.to/2011/harpy" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Protocol>None</Protocol> <Vendor>Mistachkin Systems</Vendor> <Id>e5f21c61-7d36-4135-ac77-068ef196d385</Id> <HashAlgorithm>SHA512</HashAlgorithm> <EntityType>Script</EntityType> <TimeStamp>2016-08-21T08:01:24.6709453Z</TimeStamp> <Duration>-1.00:00:00</Duration> <Key>0x2c322765603b5278</Key> <Signature> Q7YmI3Roa1bStxX36LkJhVj9b8+oRfvAskfltfVifv24I0j6mGYEWg8YvhNm8W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of42s5KP2HK80hCgE 5YI7k8ficYEye2OaIuHKWhORvv4yY1v7Z4UGyD7AF+5l5c0/mCRobZ2q7o145IyREd3drorI249g HyFSELt6GH9f5sPXAYoFS+Nt8SlVzylL71zh6POJXWwKpq7qaaQSLGR/gZrwJh3QFuBzRX4nAZ2R D9T3Y/B4V5jorpI3ODv0y0INb6x9+O2qBLb19AshJNxu5rMBgchj7xKK2vdn0/myhp2ehet63Q== </Signature> </Certificate> |
Modified client/1.0/pkgd.eagle.harpy.asc from [06bf9ce747] to [2aa200d31c].
1 2 3 4 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Eagle Package Repository | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Eagle Package Repository iQIcBAABCAAGBQJXuV/eAAoJEFAslq9JXcLZvSsP/2KjJk+ZlEti+gIcGN1+p7Kg c8KU6XywO47u8kiJ9Lasc/i8cegjRFXJEsy3EcAi3ZRQ2UVK2WnnHIB74dtLhuh3 Wp9no0qJGMAnPmAtCQYeaNboEcErfcTgdKAxRly9S6g4ynCFDjkAMWJFM5eW6p0D N2FXJ3iveQIG0RkWFIdUF/s0GhKi9834uhyK91D4AKwLaol25SKHwiqCQf4KNnPK MQYEF9ZMXRbxL+lV8mutBmRv7hQbKWWxB/WcuFcdwftVin8b+hoihXBLXcQ3dCXs EuRKBoRqgvcLCmkj6SJP/JoiO5jqH71isJTbppcedkmRXFpiRYLCV2nXYTcpljV1 ObR9dVj0MN/cS/IjZk65723HgtUqmdAseBexL0043TxV7z0o3/GjuThWr6Fs0HQJ Rn5uNvFSkF/dSJZi5SDUGKDCqwQfOMMMZWHaircvrzNVTMR9P1wlb+ikX/s9iiE1 5ScMSZsRZ4pFuoAg6Y1tFYAg6lpHLUrRw+tRF2PfnRFSNaQlWTrewiHemYbk2enp xKmjNHmfeq9LWXKowMj2MQ3C+esVee02IhCvxngySEfHIbz472j40bi04cnAH1Sy Rf0IaDitvm4yP6k1YMA0yf9YMhL8OHXJU5sVqQBit3HKs5FayJGRd+zzI5Y0wZqh kYzNQBTVZJvpFhyw7MTz =XiGw -----END PGP SIGNATURE----- |