Overview
Comment: | More refactoring of the native Tcl 'getFileViaHttp' helper procedure. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
af1f55998294f86412e6c6c5bf9574bd |
User & Date: | mistachkin on 2016-09-18 03:32:44 |
Other Links: | manifest | tags |
Context
2016-09-18
| ||
04:03 | Add the HTTP status code 300 as 'unsupported' instead of 'unrecognized'. check-in: 36c123618c user: mistachkin tags: trunk | |
03:32 | More refactoring of the native Tcl 'getFileViaHttp' helper procedure. check-in: af1f559982 user: mistachkin tags: trunk | |
2016-09-17
| ||
23:58 | Re-sign the 'client/1.0/pkgIndex.eagle.harpy.asc' file with GPG. check-in: da23537a44 user: mistachkin tags: trunk | |
Changes
Modified client/1.0/pkgr.eagle from [2617b2dd5b] to [383b0cc171].
︙ | ︙ | |||
1470 1471 1472 1473 1474 1475 1476 | # proc setupPackageUnknownVars {} { # # NOTE: Should the HTTP request processor attempt to force the use of # HTTPS for URIs that were originally HTTP? This setting is only # applicable to native Tcl. # | | | | | | | > > > > > > > > > > > | 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 | # proc setupPackageUnknownVars {} { # # NOTE: Should the HTTP request processor attempt to force the use of # HTTPS for URIs that were originally HTTP? This setting is only # applicable to native Tcl. # variable forceSecureUri; # DEFAULT: true if {![info exists forceSecureUri]} then { set forceSecureUri true } # # NOTE: Is this HTTP request processor allowed to use plain HTTP if/when # the "tls" package is not available? This should only be changed # if the "tls" package cannot be easily installed for use with the # native Tcl interpreter in use. It should be noted here that the # official package repository server reserves the right to refuse # plain HTTP connections, which means that changing this setting # may be totally pointless. # variable allowInsecureUri; # DEFAULT: false if {![info exists allowInsecureUri]} then { set allowInsecureUri false } # # NOTE: Is this HTTP request processor allowed to use plain HTTP if/when # the server responds with an HTTP redirect location to an original # URI that was HTTPS? Otherwise, a script error will result. # variable allowInsecureRedirect; # DEFAULT: false if {![info exists allowInsecureRedirect]} then { set allowInsecureRedirect false } # # NOTE: What is the default set of API keys if none were set explicitly? # This list is subject to change at any time -AND- may be empty or # may contain non-working API keys, please do not rely on it. # |
︙ | ︙ | |||
1708 1709 1710 1711 1712 1713 1714 | } } # # NOTE: This procedure was stolen from the "getEagle.tcl" script. It is # designed to process a single HTTP request, including any HTTP # 3XX redirects (up to the specified limit), and return the raw | | < | > > > > > > > | | > | | | > | 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 | } } # # NOTE: This procedure was stolen from the "getEagle.tcl" script. It is # designed to process a single HTTP request, including any HTTP # 3XX redirects (up to the specified limit), and return the raw # HTTP response data. It may raise any number of script errors. # # <public> proc getFileViaHttp { uri redirectLimit channel quiet args } { # # NOTE: This variable is used to determine if plain HTTP URIs should be # converted to HTTPS, if the "tls" package is available. # variable forceSecureUri # # NOTE: This variable is used to determine if plain HTTP is allowed if # the "tls" package is not available. # variable allowInsecureUri # # NOTE: This variable is used to determine if plain HTTP is allowed if # an HTTP redirect response contains an HTTP URI and the original # URI was HTTPS. # variable allowInsecureRedirect # # NOTE: This variable is used to keep track of the currently scheduled # (i.e. pending) [after] event. # variable afterForPageProgress # # NOTE: This procedure requires the modern version of the HTTP package, # which is typically included with the Tcl core distribution. # package require http 2.0 # # NOTE: If the 'tls' package is available, always attempt to use HTTPS; # otherwise, only attempt to use HTTP if explicitly allowed. # if {[catch {package require tls}] == 0} then { ::http::register https 443 [list ::tls::socket -tls1 true] if {$forceSecureUri} then { if {[string range $uri 0 6] eq "http://"} then { set uri [appendArgs https:// [string range $uri 7 end]] } } } else { if {$allowInsecureUri} then { if {[string range $uri 0 7] eq "https://"} then { set uri [appendArgs http:// [string range $uri 8 end]] } } } # # NOTE: Unless the caller forbids it, display progress messages during # the download. # |
︙ | ︙ | |||
1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 | while {1} { # # NOTE: Issue the HTTP request now, grabbing the resulting token. # set token [eval [list ::http::geturl $uri] $args] # # NOTE: Check the HTTP response code, in order to follow any HTTP # redirect responses. # | > > > > > > | > > > > > > > > > > > > > > > > > > > > > > > | > | | < < | > | | > > | | < < | > > | < | > > > > > > > | > > | > > > > > > > > > < < < < < < | > > | 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 | while {1} { # # NOTE: Issue the HTTP request now, grabbing the resulting token. # set token [eval [list ::http::geturl $uri] $args] # # NOTE: Grab the HTTP response code and data now as they are needed # in almost all cases. # set code [::http::ncode $token]; set data [::http::data $token] # # NOTE: Check the HTTP response code, in order to follow any HTTP # redirect responses. # switch -glob -- $code { 100 - 101 - 102 { ::http::cleanup $token; error [appendArgs \ "unsupported informational HTTP response status code " \ $code ", data: " $data] } 200 - 201 - 202 - 203 - 204 - 205 - 206 - 207 - 208 - 226 { # # NOTE: Ok, the HTTP response is actual data of some kind (which # may be empty). # ::http::cleanup $token; break } 301 - 302 - 303 - 307 - 308 { # # NOTE: Unless the caller forbids it, display progress messages # when an HTTP redirect is returned. # if {!$quiet} then { pageProgress $channel > 0 } # # NOTE: We hit another HTTP redirect. Stop if there are more # than X. # incr redirectCount # # TODO: Maybe make this limit more configurable? # if {$redirectCount > $redirectLimit} then { # # NOTE: Just "give up" and raise a script error. # ::http::cleanup $token; error [appendArgs \ "redirection limit of " $redirectLimit " exceeded"] } # # NOTE: Grab the metadata associated with this HTTP response. # array set meta [::http::meta $token] # # NOTE: Is there actually a new URI (location) to use? # if {[info exist meta(Location)]} then { # # NOTE: Ok, grab it now. Later, at the top of the loop, # it will be used in the subsequent HTTP request. # set location $meta(Location); unset meta # # NOTE: For security, by default, do NOT follow an HTTP # redirect if it attempts to redirect from HTTPS # to HTTP. # if {!$allowInsecureRedirect && \ [string range $uri 0 7] eq "https://" && \ [string range $location 0 7] ne "https://"} then { # # NOTE: Just "give up" and raise a script error. # ::http::cleanup $token; error [appendArgs \ "refused insecure redirect from \"" $uri "\" to \"" \ $location \"] } # # NOTE: Replace the original URI with the new one, for # use in the next HTTP request. # set uri $location # # NOTE: Cleanup the current HTTP token now beause a new # one will be created for the next request. # ::http::cleanup $token } else { # # NOTE: Just "give up" and raise a script error. # ::http::cleanup $token; error [appendArgs \ "redirect from \"" $uri "\" missing location, code " \ $code ", data: " $data] } } 304 - 305 - 306 { ::http::cleanup $token; error [appendArgs \ "unsupported redirection HTTP response status code " $code \ ", data: " $data] } 4?? { ::http::cleanup $token; error [appendArgs \ "client error HTTP response status code " $code ", data: " \ $data] } 5?? { ::http::cleanup $token; error [appendArgs \ "server error HTTP response status code " $code ", data: " \ $data] } default { ::http::cleanup $token; error [appendArgs \ "unrecognized HTTP response status code " $code ", data: " \ $data] } } } # # NOTE: If there is a currently scheduled [after] event, cancel it. # |
︙ | ︙ |
Modified client/1.0/pkgr.eagle.asc from [f042d36cae] to [25ea328ced].
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 iQIcBAABCAAGBQJX3gq5AAoJEFAslq9JXcLZ4kYP/i7cwkZGs0fSCnG9hlcHsF1R 2RQLxSxMKvslZC8wG7kjBEl4kEFornaKEvrBcNi4cH62kixU7kaXai40bhTDdRfx wCovFa3Ie+ES/+uEBSeA7Ju7bn3l8tWaktwSqqwEhCgiW4eXFUWLgqqMZmxVn2Yb aBk07FKci+vfFm5akZ23pVzz8IUCzh2y6AavFgE/0xkIibFrUQNn8yc4dAqM1VrB 2gZ7rvkrzF10sNGzmK5cb/F6owN9Cq4A7Rr+hsixh3KUF2Smws8tQuOEHlDa17ln 98n35Gbp34JqTaXwyUBgAWtel4SvQc36SXQoG7jH5hLtMnlhyAVnZPiiB8TgfJUU GpQPxhd4dhLkMeg8u55ZlRbzlAcClBsQyxkzFjk7rKe0Y82ZnAPWioqtMgj0LjNG EOLPdJG+v7wJD/yfpvkNiBbwq2DTZq5V4uDub95RS+Ck3QxX5MF8LlIX9D6v7f/O QznTyMChbM6A4E96NLsFEHcqz85GXtSwMqez3rfX+wRlSFKXNxqYUFXFpVOWoTrS jVrs/xeLBStdGK/a5W8vhEWuyF8SrOIXBxPO1Tn/Yzjp1sY18JCvJYckC2962+7m ZD0nJS8KE6L5jrTA53iXU+0OVvjdhYzaMVcbKy9l/UUxo2YThdGaqah+42Ezoo56 kDLy5eoJLZ7XfE9kP40B =tpBZ -----END PGP SIGNATURE----- |
Modified client/1.0/pkgr.eagle.harpy from [dbc42f4ac7] to [a9721b5b62].
︙ | ︙ | |||
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 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>4eac20d8-450e-4bf5-80ce-3d7e3cdd6bdf</Id> <HashAlgorithm>SHA512</HashAlgorithm> <EntityType>Script</EntityType> <TimeStamp>2016-09-18T03:31:28.6953125Z</TimeStamp> <Duration>-1.00:00:00</Duration> <Key>0x9559f6017247e3e2</Key> <Signature> fOsyQrGCTEiM/7pYRKzObjASFHD24S1+Lxkb/VjwrJ4OH5zQV3swwPHgw7GjRFmsC+Tlp6J5/YMB 75m9ZMO1OjPp7VNRDKPupmcxZ650zciiTbA8ZdOE6qkyrxfK+xIZVrv1WZfdRvf5VDinpeFXb+I0 fH+m6TwkDnOK713yoLvZ38YWQoJtOOsYHfESEdlEHk1e5CWa4SagGwmFf/wuQXN0J0ECTMYKhuVJ gXegileFuiPIYyu6zun++bC1zly6fbSlCZ+hE6/R6hnLnh7XEY1+2UGaO/rHbY8amRsoYhib0SHR 2ygGvg0zEmLdCdLGper8RBjsRPGZ6q0pNuhOh+nlKRl3K85jeqVjBly8gQYXSDKSJ4WrB4CN+CvM Dr74OGrOA8JALsSbNkyO3VV506bPn+Y2BV/jzsb5pUNCMFhiflBy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9HshltBNDb4jBtKBg6alhk69gI3t/5jTTlCgkVlxD+ZRVxy96VC+93gwlXdWPhuF8qyQ4ozh DDqvq5V2Uu0Fr/5NUFTi+yISkVUaHhiLHATQ+ergN8PmtpkG0v0GsX+ytCD9LRaQkN4ZQLY= </Signature> </Certificate> |
Modified client/1.0/pkgr.eagle.harpy.asc from [c099261db1] to [fd1c824126].
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 iQIcBAABCAAGBQJX3gq8AAoJEFAslq9JXcLZSdAQALgMLzDQtG/AhqDxfMAtG0GL J76zelZDVOU+WCSERIQYcBmbkNfYqVV9dCGBz/joOBIzsTIFbKpKhShCo0JoJzdo zcG3vNVEw6BUdanbMUjhPiPwcsyu0qLsaZH1R+GS6g9ASKU2Z4FuDn8e+4awfX3Z 2GJKcpcE5QknNMIpUQnnNpZQvgPAS950GqpfUe8AHyaOc/JFQvBCd8h5wVoolkMZ TmiTVt12JDbQn5yDFyVy+YYmEstxhw+bPvEYbiXYQnUAl/H+FjKmfNLwyKDsYr3H 1foS2bTFRePOwDT6AOS4LWZ/4oiz4p9iryCPjQxx66pcWx8mOWvQdI3hi3G1C0TH CUSEoIMpu7LRwo1lgG7Pxe4MrSnHyKL/Yh0yoPsYyLNXMuUNXkpsb6JeWHFd7ItO kUc59PplzGeX7sCDF6TCOidqzpahFOoetWYEyLWdYXO4+BDUT/UU5ibvELfdrpdX EQU2sXSyjl/9qe4pAfObCUoY+ybk1UFkRCxnJ+YjzP+Jmg9xThyzVkC4PaGbL4hT gTh+wh2AGtAqergPMcDacHRCO2NF808kagQhdPfsPWxCYYxN3o4e1OGr7f83xp1f GoQGWJ5VQWR5hvy3KZyjxPebXVYHtM2/rg6Xk37AA+F0Ofwm323gijl0Lc7lm1kL 1R7gkkyQ1FV2JqNSbLCX =TNp1 -----END PGP SIGNATURE----- |