8000 Fix #3112 serve docs on localhost:{random port} by brettearle · Pull Request #3697 · rust-lang/rustup · GitHub
[go: up one dir, main page]

Skip to content

Fix #3112 serve docs on localhost:{random port} #3697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 13 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
server running, using tiny http
  • Loading branch information
brettearle committed Feb 25, 2024
commit c18c1650b8f6a3b4c56772f7c6910a252616f57c
21 changes: 19 additions & 2 deletions src/cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use clap::{
};
use clap_complete::Shell;
use itertools::Itertools;
use tiny_http::{Response, Server};

use crate::{
cli::{
Expand Down Expand Up @@ -1597,9 +1598,25 @@ fn doc(cfg: &Cfg, m: &ArgMatches) -> Result<utils::ExitCode> {
};

//get servedoc argument out of m
let servedoc = m.subcommand();
println!("servedoc: {:?}", servedoc);
if let Some(servedoc) = m.subcommand_matches("servedoc") {
println!("servedoc: {:?}", servedoc);

println!("hehe");
loop {
let server = Server::http("127.0.0.1:3000").unwrap();
for request in server.incoming_requests() {
println!(
"received request! method: {:?}, url: {:?}, headers: {:?}",
request.method(),
request.url(),
request.headers()
);

let response = Response::from_string("hello world");
request.respond(response);
}
}
}
let topical_path: PathBuf;

let doc_url = if let Some(topic) = m.get_one::<String>("topic") {
Expand Down
0