jonhoo / jonhoo/rust-imap

[Question] Way to readline from underlying stream

Open
#211 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
583
Forks
94
PR merge metrics
No merged PRs in 30d

Description

I'm trying to perform an [IMAP4 ID extension](https://datatracker.ietf.org/doc/html/rfc2971) command manually.

command and response sequence would be like this:
```
C: a2 ID NIL
S: * ID ("name" "Coremail Imap" "vendor" "Mailtech" "TransID" "I186cXsAACfQ+GDj71IA")
S: a2 OK ID completed
```
code like this:
```rust
// by Client::login()
type ImapSession = imap::Session>;

pub fn id(s: &mut ImapSession) -> Result<(), Box> {
let id = "ID NIL";

// Err(Parse(Invalid([...])))
// [...] is [u8] of * ID ("name" "Coremail Imap" "vendor" "Mailtech" "TransID" "I186cXsAACfQ+GDj71IA")
let res = s.run(id);

// panicked at 'assertion failed: `(left == right)` src\client.rs:1335:25
let res2 = s.run("NOOP");

Ok(())
}
```
failing to parse `* ID ("name" "Coremail Imap" "vendor" "Mailtech" "TransID" "I186cXsAACfQ+GDj71IA")` can be ignored,
but tagged `a2 OK ID completed` is left in the stream, and following commands will panic immediately as [assertion](https://docs.rs/imap/3.0.0-alpha.4/src/imap/client.rs.html#1335) failed.

sequence of crate's view:
```
C: a2 ID NIL
S: * ID ("name" "Coremail Imap" "vendor" "Mailtech" "TransID" "I186cXsAACfQ+GDj71IA")
C: a3 NOOP
S: a2 OK ID completed
```

So am I missing anything to get workaround to this?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.