melib/jmap: add HTTP redirect policy to client

Meli currently uses the .well-known/jmap URL and the RFC8620 requires that any redirects are followed (https://tools.ietf.org/html/rfc8620#section-2.2). This small change allows redirects to happen.
jmap-eventsource
Rudi Horn 2020-11-03 22:12:08 +00:00 committed by Manos Pitsidianakis
parent 6cc43540d6
commit f1bdae65ee
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
2 changed files with 2 additions and 0 deletions

View File

@ -24,6 +24,7 @@ use crate::conf::AccountSettings;
use crate::email::*;
use crate::error::{MeliError, Result};
use futures::lock::Mutex as FutureMutex;
use isahc::config::RedirectPolicy;
use isahc::prelude::HttpClient;
use isahc::ResponseExt;
use serde_json::Value;

View File

@ -35,6 +35,7 @@ impl JmapConnection {
pub fn new(server_conf: &JmapServerConf, store: Arc<Store>) -> Result<Self> {
let client = HttpClient::builder()
.timeout(std::time::Duration::from_secs(10))
.redirect_policy(RedirectPolicy::Limit(10))
.authentication(isahc::auth::Authentication::basic())
.credentials(isahc::auth::Credentials::new(
&server_conf.server_username,