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 | 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 } # |
︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 | 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 | 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 | 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 { |
︙ | |||
298 299 300 301 302 303 304 | 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 |
︙ | |||
457 458 459 460 461 462 463 | 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 { |
︙ |
Modified client/1.0/pkgd.eagle.asc from [86ffeca9c4] to [366ad7ed41].
1 2 3 4 | 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 |
Modified client/1.0/pkgd.eagle.harpy from [7288a419a5] to [1c0acbc585].
︙ | |||
17 18 19 20 21 22 23 | 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> |
Modified client/1.0/pkgd.eagle.harpy.asc from [06bf9ce747] to [2aa200d31c].
1 2 3 4 | 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 |