xftp: update http2 to remove workarounds with padding and delay (#667)

This commit is contained in:
Evgeny Poberezkin authored and GitHub committed 2023-03-02 16:00:46 +00:00
1 parent e764a51fc0
commit 914240108d
2 files changed
+2 -5

No files matched your search

+1 -4
View File
@@ -57,15 +57,12 @@ sendEncFile :: Handle -> (Builder -> IO ()) -> LC.SbState -> Word32 -> IO ()
sendEncFile h send = go
where
go sbState 0 = do
-- TODO padding somehow also solves timing issue in HTTP2 (?)
let authTag = BA.convert (LC.sbAuth sbState) <> B.replicate (fileBlockSize - C.authTagSize) '#'
let authTag = BA.convert (LC.sbAuth sbState)
send $ byteString authTag
go sbState sz =
getFileChunk h sz >>= \ch -> do
let (encCh, sbState') = LC.sbEncryptChunk sbState ch
send (byteString encCh) `E.catch` \(e :: E.SomeException) -> print e >> E.throwIO e
-- TODO remove delay when HTTP2 issue is fixed
threadDelay 500
go sbState' $ sz - fromIntegral (B.length ch)
getFileChunk :: Handle -> Word32 -> IO ByteString