Follow HTTP redirects (#328)

- Change HttpClient to follow all redirects except HTTPS to HTTP.
- Run language snippet tests with --no-cache and real PackageServer
  instead of pre-seeded cache.
  This increases HTTP test coverage and enables testing of package redirects.
- Change PackageServer to return 301 for request paths starting with /HTTP301/
  and 307 for request paths starting with /HTTP307/.
- Update some outdated test package checksums that apparently weren't verified.
This commit is contained in:
translatenix
2024-03-21 10:26:07 -07:00
committed by GitHub
parent 60bcd56672
commit deaf6983c4
10 changed files with 105 additions and 16 deletions
@@ -16,7 +16,7 @@ examples {
import("package://localhost:0/birds@0.5.0#/catalog/Ostritch.pkl")
}
["importing while specifying checksum"] {
import("package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl")
import("package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/Swallow.pkl")
}
["reads"] {
read("package://localhost:0/birds@0.5.0#/Bird.pkl")
@@ -20,6 +20,6 @@ examples {
import("package://localhost:0/birds@0.5.0#/allFruit.pkl").fruitFiles
}
["glob import while specifying checksum"] {
import*("package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/*.pkl")
import*("package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/*.pkl")
}
}
@@ -0,0 +1,15 @@
amends ".../snippetTest.pkl"
examples {
["permanent redirect is followed"] {
import("package://localhost:0/HTTP301/birds@0.5.0#/catalog/Swallow.pkl")
}
["temporary redirect is followed"] {
import("package://localhost:0/HTTP307/birds@0.5.0#/catalog/Swallow.pkl")
}
["double redirect is followed"] {
import("package://localhost:0/HTTP301/HTTP307/birds@0.5.0#/catalog/Swallow.pkl")
}
}
@@ -118,13 +118,13 @@ examples {
}
["glob import while specifying checksum"] {
new {
["package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Ostritch.pkl"] {
["package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/Ostritch.pkl"] {
name = "Ostritch"
favoriteFruit {
name = "Orange"
}
}
["package://localhost:0/birds@0.5.0::sha256:3f19ab9fcee2f44f93a75a09e531db278c6d2cd25206836c8c2c4071cd7d3118#/catalog/Swallow.pkl"] {
["package://localhost:0/birds@0.5.0::sha256:bfaf5281613d170a740505cc87561041f4e0cad1f0e6938bf94f7609f9a4673d#/catalog/Swallow.pkl"] {
name = "Swallow"
favoriteFruit {
name = "Apple"
@@ -0,0 +1,26 @@
examples {
["permanent redirect is followed"] {
new {
name = "Swallow"
favoriteFruit {
name = "Apple"
}
}
}
["temporary redirect is followed"] {
new {
name = "Swallow"
favoriteFruit {
name = "Apple"
}
}
}
["double redirect is followed"] {
new {
name = "Swallow"
favoriteFruit {
name = "Apple"
}
}
}
}