aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar JustAnotherArchivist2025-12-19 20:36:08 +0000
committerGravatar JustAnotherArchivist2025-12-19 20:36:08 +0000
commitb300d8230a57d0430181bf902a684d7b901f3043 (patch)
tree2e5cb21e166dbd727551b4ca17c836e51aba50f8
parentAdd logging section to example config (diff)
signature
Trim spaces from CAP responses
The spec technically even requires a trailing space when a single capability is listed. This accepts multiple and leading spaces, too.
-rw-r--r--http2irc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/http2irc.py b/http2irc.py
index 8037cb7..da47dc2 100644
--- a/http2irc.py
+++ b/http2irc.py
@@ -632,7 +632,7 @@ class IRCClientProtocol(asyncio.Protocol):
# IRCv3 and SASL
elif line.command == 'CAP':
if line.params[1] == 'ACK':
- for cap in line.params[2].split(' '):
+ for cap in line.params[2].strip(' ').split(' '):
self.logger.debug(f'CAP ACK: {cap}')
self.caps.add(cap)
if cap == 'sasl' and self.sasl:
@@ -641,7 +641,7 @@ class IRCClientProtocol(asyncio.Protocol):
self.capReqsPending.remove(cap)
elif line.params[1] == 'NAK':
self.logger.warning(f'Failed to activate CAP(s): {line.params[2]}')
- for cap in line.params[2].split(' '):
+ for cap in line.params[2].strip(' ').split(' '):
self.capReqsPending.remove(cap)
if len(self.capReqsPending) == 0:
self.send(b'CAP END')