Distribution.Client.HttpUtils

cabal-install-3.12.1.0: The command-line interface for Cabal and Hackage.

Safe Haskell | None
Language | Haskell2010

Distribution.Client.HttpUtils

Description

Separate module for HTTP actions, using a proxy server if one exists.

Synopsis

- data DownloadResult
  - = FileAlreadyInCache
  - | FileDownloaded FilePath
- configureTransport :: Verbosity -> [FilePath] -> Maybe String -> IO HttpTransport
- data HttpTransport = HttpTransport {
  - getHttp :: Verbosity -> URI -> Maybe ETag -> FilePath -> [Header] -> IO (HttpCode, Maybe ETag)
  - postHttp :: Verbosity -> URI -> String -> Maybe Auth -> IO (HttpCode, String)
  - postHttpFile :: Verbosity -> URI -> FilePath -> Maybe Auth -> IO (HttpCode, String)
  - putHttpFile :: Verbosity -> URI -> FilePath -> Maybe Auth -> [Header] -> IO (HttpCode, String)
  - transportSupportsHttps :: Bool
  - transportManuallySelected :: Bool
  }
- type HttpCode = Int
- downloadURI :: HttpTransport -> Verbosity -> URI -> FilePath -> IO DownloadResult
- transportCheckHttps :: Verbosity -> HttpTransport -> URI -> IO ()
- remoteRepoCheckHttps :: Verbosity -> HttpTransport -> RemoteRepo -> IO ()
- remoteRepoTryUpgradeToHttps :: Verbosity -> HttpTransport -> RemoteRepo -> IO RemoteRepo
- isOldHackageURI :: URI -> Bool

# Documentation

data DownloadResult #

Constructors

FileAlreadyInCache |
FileDownloaded FilePath |

#### Instances

Instances details

Eq DownloadResult # |
Instance details Defined in Distribution.Client.HttpUtils Methods (==) :: DownloadResult -> DownloadResult -> Bool # (/=) :: DownloadResult -> DownloadResult -> Bool #

configureTransport :: Verbosity -> [FilePath] -> Maybe String -> IO HttpTransport #

data HttpTransport #

Constructors

HttpTransport |
Fields getHttp :: Verbosity -> URI -> Maybe ETag -> FilePath -> [Header] -> IO (HttpCode, Maybe ETag) GET a URI, with an optional ETag (to do a conditional fetch), write the resource to the given file and return the HTTP status code, and optional ETag. postHttp :: Verbosity -> URI -> String -> Maybe Auth -> IO (HttpCode, String) POST a resource to a URI, with optional `Auth` and return the HTTP status code and any redirect URL. postHttpFile :: Verbosity -> URI -> FilePath -> Maybe Auth -> IO (HttpCode, String) POST a file resource to a URI using multipart/form-data encoding, with optional `Auth` and return the HTTP status code and any error string. putHttpFile :: Verbosity -> URI -> FilePath -> Maybe Auth -> [Header] -> IO (HttpCode, String) PUT a file resource to a URI, with optional `Auth`, extra headers and return the HTTP status code and any error string. transportSupportsHttps :: Bool Whether this transport supports https or just http. transportManuallySelected :: Bool Whether this transport implementation was specifically chosen by the user via configuration, or whether it was automatically selected. Strictly speaking this is not a property of the transport itself but about how it was chosen. Nevertheless it's convenient to keep here.

type HttpCode = Int #

downloadURI #

Arguments

:: HttpTransport |
-> Verbosity |
-> URI | What to download
-> FilePath | Where to put it
-> IO DownloadResult |

transportCheckHttps :: Verbosity -> HttpTransport -> URI -> IO () #

remoteRepoCheckHttps :: Verbosity -> HttpTransport -> RemoteRepo -> IO () #

remoteRepoTryUpgradeToHttps :: Verbosity -> HttpTransport -> RemoteRepo -> IO RemoteRepo #

isOldHackageURI :: URI -> Bool #

Utility function for legacy support.