mirror of
https://github.com/simplex-chat/simplexmq.git
synced 2026-11-04 06:33:14 +00:00
agent: known host, smp protocol: parse empty messages (#1953)
Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
This commit is contained in:
1 parent
8bc4d36012
commit
fa0d1be801
4 files changed
+10
-6
No files matched your search
@@ -1194,10 +1194,10 @@ sendOrProxySMPCommand c nm userId destSrv@ProtocolServer {host = destHosts} conn
|
||||
cfg <- getNetworkConfig c
|
||||
case smpProxyMode cfg of
|
||||
SPMAlways -> pure True
|
||||
SPMUnknown -> unknownServer
|
||||
SPMUnknown -> unknownServer cfg
|
||||
SPMUnprotected
|
||||
| ipAddressProtected cfg destSrv -> pure False
|
||||
| otherwise -> unknownServer
|
||||
| otherwise -> unknownServer cfg
|
||||
SPMNever -> pure False
|
||||
directAllowed = do
|
||||
cfg <- getNetworkConfig c
|
||||
@@ -1205,7 +1205,7 @@ sendOrProxySMPCommand c nm userId destSrv@ProtocolServer {host = destHosts} conn
|
||||
SPFAllow -> True
|
||||
SPFAllowProtected -> ipAddressProtected cfg destSrv
|
||||
SPFProhibit -> False
|
||||
unknownServer = liftIO $ maybe True (\srvs -> all (`S.notMember` knownHosts srvs) destHosts) <$> TM.lookupIO userId (smpServers c)
|
||||
unknownServer cfg = liftIO $ maybe True (\srvs -> either (const True) (`S.notMember` knownHosts srvs) $ chooseTransportHost cfg destHosts) <$> TM.lookupIO userId (smpServers c)
|
||||
sendViaProxy :: Maybe SMPServerWithAuth -> SMPTransportSession -> AM (Maybe SMPServer, a)
|
||||
sendViaProxy proxySrv_ destSess@(_, _, connId_) = do
|
||||
r <- tryAllErrors . withProxySession c nm proxySrv_ destSess entId ("PFWD " <> cmdStr) $ \(SMPConnectedClient smp _, proxySess@ProxiedRelay {prBasicAuth}) -> do
|
||||
|
||||
@@ -884,7 +884,7 @@ instance StrEncoding Message where
|
||||
msgQuotaP msgId msgTs = "quota" $> MessageQuota {msgId, msgTs}
|
||||
msgP msgId msgTs = do
|
||||
msgFlags <- ("flags=" *> strP_) <|> pure noMsgFlags
|
||||
msgBody <- strP
|
||||
msgBody <- strP <|> (C.unsafeMaxLenBS "" <$ A.endOfInput)
|
||||
pure Message {msgId, msgTs, msgFlags, msgBody}
|
||||
|
||||
type EncNMsgMeta = ByteString
|
||||
|
||||
Reference in new issue
Block a user