srctree

Robin Linden parent b39e3ca8 8b2399c2
browser: Move fixing bad uris into the common engine

inlinesplit
browser/engine.cpp added: 7, removed: 11, total 0
@@ -35,6 +35,10 @@ protocol::Error Engine::navigate(uri::Uri uri) {
return status_code == 301 || status_code == 302;
};
 
if (uri.path.empty()) {
uri.path = "/";
}
 
uri_ = uri;
response_ = protocol::get(uri_);
while (response_.err == protocol::Error::Ok && is_redirect(response_.status_line.status_code)) {
 
browser/gui/app.cpp added: 7, removed: 11, total 0
@@ -131,10 +131,6 @@ void App::navigate() {
return;
}
 
if (uri->path.empty()) {
uri->path = "/";
}
 
engine_.navigate(std::move(*uri));
 
// Make sure the displayed url is still correct if we followed any redirects.
 
browser/tui.cpp added: 7, removed: 11, total 0
@@ -27,10 +27,6 @@ int main(int argc, char **argv) {
return 1;
}
 
if (uri->path.empty()) {
uri->path = "/";
}
 
browser::Engine engine;
if (auto err = engine.navigate(*uri); err != protocol::Error::Ok) {
spdlog::error("Got error {} from {}", err, uri->uri);