Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
Packages
Cabal
Commits
03c134d5
Commit
03c134d5
authored
Jul 26, 2014
by
nkaretnikov
Committed by
Mikhail Glushenkov
Jul 26, 2014
Browse files
Print a more friendly message when http_proxy is down.
Fixes #1962.
parent
440fe65e
Changes
1
Hide whitespace changes
Inline
Side-by-side
cabal-install/Distribution/Client/HttpUtils.hs
View file @
03c134d5
...
...
@@ -21,8 +21,10 @@ import Network.Browser
,
setOutHandler
,
setErrHandler
,
setProxy
,
setAuthorityGen
,
request
)
import
Network.Stream
(
Result
,
ConnError
(
..
)
)
import
Control.Exception
(
handleJust
)
import
Control.Monad
(
liftM
)
(
liftM
,
guard
)
import
qualified
Data.ByteString.Lazy.Char8
as
ByteString
import
Data.ByteString.Lazy
(
ByteString
)
...
...
@@ -42,6 +44,8 @@ import System.FilePath
(
(
<.>
)
)
import
System.Directory
(
doesFileExist
)
import
System.IO.Error
(
isDoesNotExistError
)
data
DownloadResult
=
FileAlreadyInCache
|
FileDownloaded
FilePath
deriving
(
Eq
)
...
...
@@ -88,13 +92,16 @@ cabalBrowse :: Verbosity
->
IO
a
cabalBrowse
verbosity
auth
act
=
do
p
<-
proxy
verbosity
browse
$
do
setProxy
p
setErrHandler
(
warn
verbosity
.
(
"http error: "
++
))
setOutHandler
(
debug
verbosity
)
auth
setAuthorityGen
(
\
_
_
->
return
Nothing
)
act
handleJust
(
guard
.
isDoesNotExistError
)
(
const
$
die
"Cannot connect to uri. Is http_proxy set?"
)
$
browse
$
do
setProxy
p
setErrHandler
(
warn
verbosity
.
(
"http error: "
++
))
setOutHandler
(
debug
verbosity
)
auth
setAuthorityGen
(
\
_
_
->
return
Nothing
)
act
downloadURI
::
Verbosity
->
URI
-- ^ What to download
...
...
Write
Preview
Supports
Markdown
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