Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
4102b0d2
Commit
4102b0d2
authored
May 29, 2013
by
Mikhail Glushenkov
Browse files
Fix a corner case in etag code.
parent
f89f6628
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/HttpUtils.hs
View file @
4102b0d2
...
...
@@ -103,8 +103,10 @@ downloadURI verbosity uri path | uriScheme uri == "file:" = do
-- hash matches to avoid unnecessary computation?
downloadURI
verbosity
uri
path
=
do
let
etagPath
=
path
<.>
"etag"
targetExists
<-
doesFileExist
path
etagPathExists
<-
doesFileExist
etagPath
etag
<-
if
etagPathExists
-- In rare cases the target file doesn't exist, but the etag does.
etag
<-
if
targetExists
&&
etagPathExists
then
liftM
Just
$
readFile
etagPath
else
return
Nothing
...
...
@@ -116,8 +118,8 @@ downloadURI verbosity uri path = do
(
3
,
0
,
4
)
->
Right
rsp
(
a
,
b
,
c
)
->
Left
err
where
err
=
ErrorMisc
$
"
Unsucessful
HTTP code: "
++
concatMap
show
[
a
,
b
,
c
]
err
=
ErrorMisc
$
"
Error
HTTP code: "
++
concatMap
show
[
a
,
b
,
c
]
-- Only write the etag if we get a 200 response code.
-- A 304 still sends us an etag header.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment