forked from cadey/maj
majc: fix redirects
This commit is contained in:
parent
1429602370
commit
6b9070e200
|
@ -8,6 +8,7 @@ use cursive::{
|
|||
use maj::{self, Response};
|
||||
use rustls::ClientConfig;
|
||||
use std::str;
|
||||
use url::Url;
|
||||
|
||||
/// The state of the browser.
|
||||
#[derive(Clone)]
|
||||
|
@ -153,13 +154,17 @@ pub fn show(siv: &mut Cursive, url: &str, resp: Response) {
|
|||
TemporaryRedirect => {
|
||||
let st = siv.user_data::<State>().unwrap();
|
||||
st.history.pop();
|
||||
open(siv, resp.meta.as_str());
|
||||
let u = Url::parse(url).unwrap();
|
||||
let u = u.join(resp.meta.as_str()).unwrap();
|
||||
open(siv, u.as_str());
|
||||
}
|
||||
|
||||
PermanentRedirect => {
|
||||
let st = siv.user_data::<State>().unwrap();
|
||||
st.history.pop();
|
||||
open(siv, resp.meta.as_str());
|
||||
let u = Url::parse(url).unwrap();
|
||||
let u = u.join(resp.meta.as_str()).unwrap();
|
||||
open(siv, u.as_str());
|
||||
}
|
||||
|
||||
Input => {
|
||||
|
|
Loading…
Reference in New Issue