Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Cabal
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Haskell
Cabal
Commits
8563dfeb
Commit
8563dfeb
authored
10 years ago
by
Duncan Coutts
Committed by
Mikhail Glushenkov
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Force cabal upload to always use digest auth and never basic auth.
(cherry picked from commit
3d1e7dbd
)
parent
87b7129c
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cabal-install/Distribution/Client/HttpUtils.hs
+6
-6
6 additions, 6 deletions
cabal-install/Distribution/Client/HttpUtils.hs
cabal-install/Distribution/Client/Upload.hs
+5
-22
5 additions, 22 deletions
cabal-install/Distribution/Client/Upload.hs
with
11 additions
and
28 deletions
cabal-install/Distribution/Client/HttpUtils.hs
+
6
−
6
View file @
8563dfeb
...
...
@@ -18,8 +18,8 @@ import Network.URI
import
Network.Stream
(
Result
,
ConnError
(
..
)
)
import
Network.Browser
(
Proxy
(
..
),
Authority
(
..
),
BrowserAction
,
browse
,
setOutHandler
,
setErrHandler
,
setProxy
,
setAuthorityGen
,
request
)
(
Proxy
(
..
),
Authority
(
..
),
BrowserAction
,
browse
,
setAllowBasicAuth
,
setAuthorityGen
,
setOutHandler
,
setErrHandler
,
setProxy
,
request
)
import
Control.Monad
(
mplus
,
join
,
liftM
,
liftM2
)
import
qualified
Data.ByteString.Lazy.Char8
as
ByteString
...
...
@@ -153,10 +153,10 @@ mkRequest uri = Request{ rqURI = uri
-- |Carry out a GET request, using the local proxy settings
getHTTP
::
Verbosity
->
URI
->
IO
(
Result
(
Response
ByteString
))
getHTTP
verbosity
uri
=
liftM
(
\
(
_
,
resp
)
->
Right
resp
)
$
cabalBrowse
verbosity
(
return
()
)
(
request
(
mkRequest
uri
))
cabalBrowse
verbosity
Nothing
(
request
(
mkRequest
uri
))
cabalBrowse
::
Verbosity
->
BrowserAction
s
(
)
->
Maybe
(
String
,
String
)
->
BrowserAction
s
a
->
IO
a
cabalBrowse
verbosity
auth
act
=
do
...
...
@@ -165,8 +165,8 @@ cabalBrowse verbosity auth act = do
setProxy
p
setErrHandler
(
warn
verbosity
.
(
"http error: "
++
))
setOutHandler
(
debug
verbosity
)
auth
setAuthorityGen
(
\
_
_
->
return
Nothing
)
setAllowBasicAuth
False
setAuthorityGen
(
\
_
_
->
return
auth
)
act
downloadURI
::
Verbosity
...
...
This diff is collapsed.
Click to expand it.
cabal-install/Distribution/Client/Upload.hs
+
5
−
22
View file @
8563dfeb
...
...
@@ -15,12 +15,10 @@ import qualified Distribution.Client.BuildReports.Anonymous as BuildReport
import
qualified
Distribution.Client.BuildReports.Upload
as
BuildReport
import
Network.Browser
(
BrowserAction
,
request
,
Authority
(
..
),
addAuthority
)
(
request
)
import
Network.HTTP
(
Header
(
..
),
HeaderName
(
..
),
findHeader
,
Request
(
..
),
RequestMethod
(
..
),
Response
(
..
)
)
import
Network.TCP
(
HandleStream
)
import
Network.URI
(
URI
(
uriPath
),
parseURI
)
import
Data.Char
(
intToDigit
)
...
...
@@ -51,12 +49,7 @@ upload verbosity repos mUsername mPassword paths = do
else
targetRepoURI
{
uriPath
=
uriPath
targetRepoURI
`
FilePath
.
Posix
.
combine
`
"upload"
}
Username
username
<-
maybe
promptUsername
return
mUsername
Password
password
<-
maybe
promptPassword
return
mPassword
let
auth
=
addAuthority
AuthBasic
{
auRealm
=
"Hackage"
,
auUsername
=
username
,
auPassword
=
password
,
auSite
=
uploadURI
}
let
auth
=
Just
(
username
,
password
)
flip
mapM_
paths
$
\
path
->
do
notice
verbosity
$
"Uploading "
++
path
++
"... "
handlePackage
verbosity
uploadURI
auth
path
...
...
@@ -82,17 +75,9 @@ promptPassword = do
report
::
Verbosity
->
[
Repo
]
->
Maybe
Username
->
Maybe
Password
->
IO
()
report
verbosity
repos
mUsername
mPassword
=
do
let
uploadURI
=
if
isOldHackageURI
targetRepoURI
then
legacyUploadURI
else
targetRepoURI
{
uriPath
=
""
}
Username
username
<-
maybe
promptUsername
return
mUsername
Password
password
<-
maybe
promptPassword
return
mPassword
let
auth
=
addAuthority
AuthBasic
{
auRealm
=
"Hackage"
,
auUsername
=
username
,
auPassword
=
password
,
auSite
=
uploadURI
}
let
auth
=
Just
(
username
,
password
)
forM_
repos
$
\
repo
->
case
repoKind
repo
of
Left
remoteRepo
->
do
dotCabal
<-
defaultCabalDir
...
...
@@ -111,16 +96,14 @@ report verbosity repos mUsername mPassword = do
cabalBrowse
verbosity
auth
$
BuildReport
.
uploadReports
(
remoteRepoURI
remoteRepo
)
[(
report'
,
Just
buildLog
)]
return
()
Right
{}
->
return
()
where
targetRepoURI
=
remoteRepoURI
$
last
[
remoteRepo
|
Left
remoteRepo
<-
map
repoKind
repos
]
--FIXME: better error message when no repos are given
check
::
Verbosity
->
[
FilePath
]
->
IO
()
check
verbosity
paths
=
do
flip
mapM_
paths
$
\
path
->
do
notice
verbosity
$
"Checking "
++
path
++
"... "
handlePackage
verbosity
checkURI
(
return
()
)
path
handlePackage
verbosity
checkURI
Nothing
path
handlePackage
::
Verbosity
->
URI
->
BrowserAction
(
HandleStream
String
)
()
handlePackage
::
Verbosity
->
URI
->
Maybe
(
String
,
String
)
->
FilePath
->
IO
()
handlePackage
verbosity
uri
auth
path
=
do
req
<-
mkRequest
uri
path
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment