Merge pull request #98 from kmkaplan/issue-95-authenticate-base64
[BUGFIX] Expect a space after the "+" in Client::authenticate.
This commit is contained in:
commit
bddfab357f
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`)
|
||||
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!(
|
||||
parse_authenticate_response(String::from_utf8(line).unwrap()),
|
||||
self
|
||||
|
|
@ -947,7 +947,7 @@ mod tests {
|
|||
|
||||
#[test]
|
||||
fn authenticate() {
|
||||
let response = b"+YmFy\r\n\
|
||||
let response = b"+ YmFy\r\n\
|
||||
a1 OK Logged in\r\n".to_vec();
|
||||
let command = "a1 AUTHENTICATE PLAIN\r\n\
|
||||
Zm9v\r\n";
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ use super::error::{Error, ParseError, Result};
|
|||
use super::types::*;
|
||||
|
||||
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() {
|
||||
let data = cap.get(1).map(|x| x.as_str()).unwrap_or("");
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue