Index: client/1.0/neutral/pkgd.eagle ================================================================== --- client/1.0/neutral/pkgd.eagle +++ client/1.0/neutral/pkgd.eagle @@ -1263,13 +1263,14 @@ # 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. + # to request. The allowHtml argument should be non-zero if raw HTML + # should be allowed in the response data. # - proc getPackageFile { uri } { + proc getPackageFile { uri {allowHtml false} } { variable loginCookie variable quiet if {[isEagle]} then { if {![info exists ::eagle_platform(compileOptions)]} then { @@ -1303,24 +1304,35 @@ if {[methodName ToString] eq "GetWebRequest"} then { webRequest Headers.Add Cookie [join $loginCookie =] } }] - return [uri download -inline -webclientdata $script -- $uri] + set data [uri download -inline -webclientdata $script -- $uri] } else { - return [uri download -inline -- $uri] + set data [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 \ + set data [eval ::PackageRepository::getFileViaHttp \ [list $uri] [list 20] [list stdout] [list $quiet] $options] } + + # + # HACK: Check for the typical Fossil error response(s), which is an + # HTML page that may contain something like "Artifact 'X' does + # not exist in this repository"). + # + if {!$allowHtml && [string range $data 0 14] eq ""} then { + error "bad package file response data, appears to be HTML page" + } + + return $data } # # NOTE: This procedure returns the prefix for fully qualified variable # names that MAY be present in the global namespace. There are