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
Glasgow Haskell Compiler
Packages
Cabal
Commits
3d1e7dbd
Commit
3d1e7dbd
authored
9 years ago
by
Duncan Coutts
Browse files
Options
Downloads
Patches
Plain Diff
Force cabal upload to always use digest auth and never basic auth
parent
f2d01e5a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
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
-17
5 additions, 17 deletions
cabal-install/Distribution/Client/Upload.hs
with
11 additions
and
23 deletions
cabal-install/Distribution/Client/HttpUtils.hs
+
6
−
6
View file @
3d1e7dbd
...
...
@@ -17,8 +17,8 @@ import Network.HTTP.Proxy ( Proxy(..), fetchProxy)
import
Network.URI
(
URI
(
..
),
URIAuth
(
..
)
)
import
Network.Browser
(
BrowserAction
,
browse
,
setOutHandler
,
setErrHandler
,
setProxy
,
setAuthorityGen
,
request
)
(
BrowserAction
,
browse
,
setAllowBasicAuth
,
setAuthorityGen
,
setOutHandler
,
setErrHandler
,
setProxy
,
request
)
import
Network.Stream
(
Result
,
ConnError
(
..
)
)
import
Control.Exception
...
...
@@ -84,10 +84,10 @@ getHTTP :: Verbosity
->
Maybe
String
-- ^ Optional etag to check if we already have the latest file.
->
IO
(
Result
(
Response
ByteString
))
getHTTP
verbosity
uri
etag
=
liftM
(
\
(
_
,
resp
)
->
Right
resp
)
$
cabalBrowse
verbosity
(
return
()
)
(
request
(
mkRequest
uri
etag
))
cabalBrowse
verbosity
Nothing
(
request
(
mkRequest
uri
etag
))
cabalBrowse
::
Verbosity
->
BrowserAction
s
(
)
->
Maybe
(
String
,
String
)
->
BrowserAction
s
a
->
IO
a
cabalBrowse
verbosity
auth
act
=
do
...
...
@@ -100,8 +100,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
−
17
View file @
3d1e7dbd
...
...
@@ -18,12 +18,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
)
...
...
@@ -53,12 +51,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
...
...
@@ -89,12 +82,7 @@ report verbosity repos mUsername mPassword = do
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
...
...
@@ -120,9 +108,9 @@ 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
Byte
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