Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

darkirc: empty IRC messages causes server disconnect #280

Open
easye opened this issue Oct 10, 2024 · 0 comments
Open

darkirc: empty IRC messages causes server disconnect #280

easye opened this issue Oct 10, 2024 · 0 comments

Comments

@easye
Copy link

easye commented Oct 10, 2024

An empty IRC message causes the darkirc server to disconnect.

From https://www.rfc-editor.org/rfc/rfc1459

2.3.1 Message format in 'pseudo' BNF

[…] Empty messages are silently ignored, which permits use of the sequence CR-LF between messages without extra problems. […]

The following patch seems to work. Untested with an encrypted TLS connection to darkirc:

diff --git a/bin/darkirc/src/irc/client.rs b/bin/darkirc/src/irc/client.rs
index d54621427..854887410 100644
--- a/bin/darkirc/src/irc/client.rs
+++ b/bin/darkirc/src/irc/client.rs
@@ -317,7 +317,14 @@ impl Client {
         W: AsyncWrite + Unpin,
     {
         if line.is_empty() || line == "\n" || line == "\r\n" {
-            return Err(Error::ParseFailed("Line is empty"))
+            //            return Err(Error::ParseFailed("Line is empty"))
+            // <https://www.rfc-editor.org/rfc/rfc1459> sez 
+            // "2.3.1 Message format in 'pseudo' BNF
+            //
+            // "[…] Empty messages are silently ignored, which permits use
+            // of the sequence CR-LF between messages without extra
+            // problems. […]"
+            return Ok(None); 
         }
 
         let mut line = line.to_string();
easye added a commit to easye/darkfi that referenced this issue Oct 10, 2024
<https://www.rfc-editor.org/rfc/rfc1459> sez in "2.3.1 Message format
in 'pseudo' BNF":

"[…] Empty messages are silently ignored, which permits use of the
sequence CR-LF between messages without extra problems. […]"

Addresses <darkrenaissance#280>.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant