Skip to content

Commit

Permalink
adjusted stack YAMLs
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlix committed Dec 29, 2023
1 parent 550b14f commit 5be9e1a
Show file tree
Hide file tree
Showing 13 changed files with 63 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
args:
- "--resolver nightly --stack-yaml stack-nightly.yaml"
- "--resolver lts-21"
- "--resolver lts-22"
- "--resolver lts-21 --stack-yaml stack-lts-21.yaml"
- "--resolver lts-20 --stack-yaml stack-lts-20.yaml"
- "--resolver lts-19 --stack-yaml stack-lts-19.yaml"
- "--resolver lts-18 --stack-yaml stack-lts-18.yaml"
Expand Down
38 changes: 38 additions & 0 deletions stack-lts-21.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
resolver: lts-21.21
packages:
- ./auto-update
- ./mime-types
- ./recv
- ./time-manager
- ./wai
- ./wai-app-static
- ./wai-conduit
- ./wai-extra
- ./wai-frontend-monadcgi
- ./wai-http2-extra
- ./wai-websockets
- ./warp
- ./warp-quic
- ./warp-tls
flags:
wai-extra:
build-example: true
nix:
enable: false
packages:
- fcgi
- zlib
extra-deps:
- crypto-token-0.0.2
- crypton-0.34
- crypton-x509-1.7.6
- crypton-x509-store-1.6.9
- crypton-x509-system-1.6.7
- crypton-x509-validation-1.6.12
- http2-5.0.0
- http3-0.0.7
- network-control-0.0.2
- network-udp-0.0.0
- quic-0.1.12
- sockaddr-0.0.1
- tls-1.9.0
13 changes: 3 additions & 10 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolver: lts-21.21
resolver: lts-22.3
packages:
- ./auto-update
- ./mime-types
Expand All @@ -23,16 +23,9 @@ nix:
- fcgi
- zlib
extra-deps:
- crypto-token-0.0.2
- crypton-0.34
- crypton-x509-1.7.6
- crypton-x509-store-1.6.9
- crypton-x509-system-1.6.7
- crypton-x509-validation-1.6.12
- http2-5.0.0
- crypto-token-0.1.0
- http3-0.0.7
- network-control-0.0.2
- network-udp-0.0.0
- quic-0.1.12
- quic-0.1.14
- sockaddr-0.0.1
- tls-1.9.0
5 changes: 3 additions & 2 deletions wai-extra/Network/Wai/Handler/CGI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import Data.Monoid (mconcat, mempty, mappend)
#endif
import Control.Arrow ((***))
import Control.Monad (unless, void)
import Data.ByteString.Builder (byteString, char7, string8, toLazyByteString)
import Data.ByteString.Builder (byteString, char7, string8, toLazyByteString, word8)
import Data.ByteString.Builder.Extra (flush)
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy as L
Expand All @@ -26,6 +26,7 @@ import Data.IORef (newIORef, readIORef, writeIORef)
import Data.Maybe (fromMaybe)
import qualified Data.Streaming.ByteString.Builder as Builder
import qualified Data.String as String
import Data.Word8 (_space)
import Network.HTTP.Types (Status (..), hContentLength, hContentType, hRange)
import qualified Network.HTTP.Types as H
import Network.Socket (addrAddress, getAddrInfo)
Expand Down Expand Up @@ -145,7 +146,7 @@ runGeneric vars inputH outputH xsendfile app = do
headers s hs = mconcat (map header $ status s : map header' (fixHeaders hs))
status (Status i m) = (byteString "Status", mconcat
[ string8 $ show i
, char7 ' '
, word8 _space
, byteString m
])
header' (x, y) = (byteString $ CI.original x, byteString y)
Expand Down
6 changes: 3 additions & 3 deletions warp-tls/Network/Wai/Handler/WarpTLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ plainHTTP TLSSettings{..} set s bs0 = case onInsecure of
-- FIXME: Content-Length:
-- FIXME: TLS/<version>
sendAll s "HTTP/1.1 426 Upgrade Required\
\r\nUpgrade: TLS/1.0, HTTP/1.1\
\r\nConnection: Upgrade\
\r\nContent-Type: text/plain\r\n\r\n"
\\r\nUpgrade: TLS/1.0, HTTP/1.1\
\\r\nConnection: Upgrade\
\\r\nContent-Type: text/plain\r\n\r\n"
mapM_ (sendAll s) $ L.toChunks lbs
close s
throwIO InsecureConnectionDenied
Expand Down
4 changes: 1 addition & 3 deletions warp/Network/Wai/Handler/Warp/HTTP2/PushPromise.hs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ import Network.Wai.Handler.Warp.Types
fromPushPromises :: InternalInfo -> Request -> IO [H2.PushPromise]
fromPushPromises ii req = do
mh2data <- getHTTP2Data req
let pp = case mh2data of
Nothing -> []
Just h2data -> http2dataPushPromise h2data
let pp = maybe [] http2dataPushPromise mh2data
catMaybes <$> mapM (fromPushPromise ii) pp

fromPushPromise :: InternalInfo -> PushPromise -> IO (Maybe H2.PushPromise)
Expand Down
3 changes: 2 additions & 1 deletion warp/Network/Wai/Handler/Warp/IO.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE BangPatterns #-}
module Network.Wai.Handler.Warp.IO where

import Control.Exception (mask_)
Expand All @@ -19,7 +20,7 @@ toBufIOWith maxRspBufSize writeBufferRef io builder = do
size = bufSize writeBuffer
(len, signal) <- writer buf size
bufferIO buf len io
let totalBytesSent = toInteger len + bytesSent
let !totalBytesSent = toInteger len + bytesSent
case signal of
Done -> return totalBytesSent
More minSize next
Expand Down
1 change: 0 additions & 1 deletion warp/Network/Wai/Handler/Warp/ReadInt.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE BangPatterns #-}

-- Copyright : Erik de Castro Lopo <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion warp/Network/Wai/Handler/Warp/Request.hs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ push maxTotalHeaderLength src (THStatus totalLen chunkLen lines prepend) bs'
else do
-- no more bytes in this chunk, ask for more
bst <- readSource' src
when (S.null bs) $ throwIO IncompleteHeaders
when (S.null bst) $ throwIO IncompleteHeaders
push maxTotalHeaderLength src status bst
where
start = end + 1 -- start of next chunk
Expand Down
5 changes: 5 additions & 0 deletions warp/Network/Wai/Handler/Warp/RequestHeader.hs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ parseRequestLine :: ByteString
,ByteString -- Query
,H.HttpVersion)
parseRequestLine requestLine@(PS fptr off len) = withForeignPtr fptr $ \ptr -> do
-- FIXME: Is this still correct with 'HTTP/2' also being valid?
-- @
-- GET / HTTP/2
-- @
-- This is 12 characters long
when (len < 14) $ throwIO baderr
let methodptr = ptr `plusPtr` off
limptr = methodptr `plusPtr` len
Expand Down
2 changes: 1 addition & 1 deletion warp/Network/Wai/Handler/Warp/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ runSettingsSocket set@Settings{settingsAccept = accept'} socket app = do
--
-- Since 1.3.5
runSettingsConnection :: Settings -> IO (Connection, SockAddr) -> Application -> IO ()
runSettingsConnection set getConn app = runSettingsConnectionMaker set getConnMaker app
runSettingsConnection set getConn = runSettingsConnectionMaker set getConnMaker
where
getConnMaker = do
(conn, sa) <- getConn
Expand Down
2 changes: 1 addition & 1 deletion warp/Network/Wai/Handler/Warp/Settings.hs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ defaultFork io =
IO $ \s0 ->
case io unsafeUnmask of
IO io' ->
case (fork# io' s0) of
case fork# io' s0 of
(# s1, _tid #) ->
(# s1, () #)
#else
Expand Down
6 changes: 3 additions & 3 deletions warp/Network/Wai/Handler/Warp/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,10 @@ data Connection = Connection {
}

getConnHTTP2 :: Connection -> IO Bool
getConnHTTP2 conn = readIORef (connHTTP2 conn)
getConnHTTP2 = readIORef . connHTTP2

setConnHTTP2 :: Connection -> Bool -> IO ()
setConnHTTP2 conn b = writeIORef (connHTTP2 conn) b
setConnHTTP2 = writeIORef . connHTTP2

----------------------------------------------------------------

Expand Down Expand Up @@ -168,7 +168,7 @@ readSource' :: Source -> IO ByteString
readSource' (Source _ func) = func

leftoverSource :: Source -> ByteString -> IO ()
leftoverSource (Source ref _) bs = writeIORef ref bs
leftoverSource (Source ref _) = writeIORef ref

readLeftoverSource :: Source -> IO ByteString
readLeftoverSource (Source ref _) = readIORef ref
Expand Down

0 comments on commit 5be9e1a

Please sign in to comment.