Browse Source

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 1 year ago
committed by Manos Pitsidianakis
parent
commit
f1bdae65ee
Signed by: epilys GPG Key ID: 73627C2F690DF710
  1. 1
      melib/src/backends/jmap.rs
  2. 1
      melib/src/backends/jmap/connection.rs

1
melib/src/backends/jmap.rs

@ -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;

1
melib/src/backends/jmap/connection.rs

@ -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,

Loading…
Cancel
Save