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 maj::{self, Response};
|
||||||
use rustls::ClientConfig;
|
use rustls::ClientConfig;
|
||||||
use std::str;
|
use std::str;
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
/// The state of the browser.
|
/// The state of the browser.
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -153,13 +154,17 @@ pub fn show(siv: &mut Cursive, url: &str, resp: Response) {
|
||||||
TemporaryRedirect => {
|
TemporaryRedirect => {
|
||||||
let st = siv.user_data::<State>().unwrap();
|
let st = siv.user_data::<State>().unwrap();
|
||||||
st.history.pop();
|
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 => {
|
PermanentRedirect => {
|
||||||
let st = siv.user_data::<State>().unwrap();
|
let st = siv.user_data::<State>().unwrap();
|
||||||
st.history.pop();
|
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 => {
|
Input => {
|
||||||
|
|
Loading…
Reference in New Issue