[BUGFIX] Expect a space after the "+" in Client::authenticate.
RFC 3501: A continue-req from the server starts with "+" SP.
This commit is contained in:
parent
28e4201eb3
commit
de5a38366c
2 changed files with 3 additions and 3 deletions
|
|
@ -390,7 +390,7 @@ impl<T: Read + Write> Client<T> {
|
||||||
// early (see also comment on `login`)
|
// early (see also comment on `login`)
|
||||||
ok_or_unauth_client_err!(self.readline(&mut line), self);
|
ok_or_unauth_client_err!(self.readline(&mut line), self);
|
||||||
|
|
||||||
if line.starts_with(b"+") {
|
if line.starts_with(b"+ ") {
|
||||||
let data = ok_or_unauth_client_err!(
|
let data = ok_or_unauth_client_err!(
|
||||||
parse_authenticate_response(String::from_utf8(line).unwrap()),
|
parse_authenticate_response(String::from_utf8(line).unwrap()),
|
||||||
self
|
self
|
||||||
|
|
@ -947,7 +947,7 @@ mod tests {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn authenticate() {
|
fn authenticate() {
|
||||||
let response = b"+YmFy\r\n\
|
let response = b"+ YmFy\r\n\
|
||||||
a1 OK Logged in\r\n".to_vec();
|
a1 OK Logged in\r\n".to_vec();
|
||||||
let command = "a1 AUTHENTICATE PLAIN\r\n\
|
let command = "a1 AUTHENTICATE PLAIN\r\n\
|
||||||
Zm9v\r\n";
|
Zm9v\r\n";
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use super::error::{Error, ParseError, Result};
|
||||||
use super::types::*;
|
use super::types::*;
|
||||||
|
|
||||||
pub fn parse_authenticate_response(line: String) -> Result<String> {
|
pub fn parse_authenticate_response(line: String) -> Result<String> {
|
||||||
let authenticate_regex = Regex::new("^\\+(.*)\r\n").unwrap();
|
let authenticate_regex = Regex::new("^\\+ (.*)\r\n").unwrap();
|
||||||
|
|
||||||
if let Some(cap) = authenticate_regex.captures_iter(line.as_str()).next() {
|
if let Some(cap) = authenticate_regex.captures_iter(line.as_str()).next() {
|
||||||
let data = cap.get(1).map(|x| x.as_str()).unwrap_or("");
|
let data = cap.get(1).map(|x| x.as_str()).unwrap_or("");
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue