Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/Snap/Internal/Http/Server/Socket.hs
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,14 @@ sendFileFunc :: Socket -> SendFileHandler
sendFileFunc sock !_ builder fPath offset nbytes = bracket acquire closeFd go
where
acquire = openFd fPath ReadOnly Nothing defaultFileFlags
go fileFd = do
#if MIN_VERSION_network(3,0,0)
go fileFd = do sockFd <- Fd `fmap` fdSocket sock
sendHeaders builder sockFd
sendFile sockFd fileFd offset nbytes
sockFd <- Fd `fmap` fdSocket sock
#else
go fileFd = do let sockFd = Fd $ fdSocket sock
let sockFd = Fd $ fdSocket sock
#endif
sendHeaders builder sockFd
sendFile sockFd fileFd offset nbytes
#endif

#else
sendFileFunc sock buffer builder fPath offset nbytes =
Streams.unsafeWithFileAsInputStartingAt (fromIntegral offset) fPath $
Expand Down
4 changes: 4 additions & 0 deletions src/Snap/Internal/Http/Server/TLS.hs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ bindHttps bindAddress bindPort cert chainCert key =
(Socket.close . fst)
$ \(sock, addr) -> do
Socket.setSocketOption sock Socket.ReuseAddr 1
#if MIN_VERSION_network(2,7,0)
Socket.bind sock addr
#else
Socket.bindSocket sock addr
#endif
Socket.listen sock 150

ctx <- SSL.context
Expand Down