Got shock to milestone 0

main
silverwizard 1 year ago
parent 4648d7fcf4
commit 37f6134682
  1. 24
      index.md
  2. 25
      src/main.rs

@ -1,24 +0,0 @@
# Obscuritus
Hello!
I hope you're not looking for anything too cool here - as this is mostly my musing regarding RPGs, Sysadminning, or homegames. The more I end up doing, the happier I'll be - at some point I'll do more of this.
If you're looking for old issues of the [Obscuritus](RPGs/Obscuritus_Mag.html) magazine I printed for my ancient Dresden Files game - I still have them, at that link.
If you're looking for things I've made for print:
I've currently got nothing to put out - hopefully will change
If you're interested - my [h-card](https://indieweb.org/h-card) is:
<p class="h-card">
<img class="u-photo" src="/Images/Photo.gif" align="left" height="50" width="50" />
<br />
<a rel="me" class="u-url">http://obscuritus.ca</a>
<br />
<a class="h-card" href="http://www.obscuritus.ca" />
<a rel="me" class="u-email">silverwizard@obscuritus.ca</a>
<br />
<a rel="me" class="u-impp">xmpp:silverwizard@obscuritus.ca</a>
<br />
<a rel="me" class="u-url">http://convenient.email/profile/silverwizard?tab=profile</a>
</p>

@ -23,27 +23,30 @@ fn handle_connection(mut stream: TcpStream) {
let buf_reader = BufReader::new(&mut stream);
let request_line = buf_reader.lines().next().unwrap().unwrap();
let mut content = "<html><head><strong>Error 404</strong><br /></head><body><img src=\"https://http.cat/404\"></img><br /><p>Not Found</p></body></html>";
let mut page;
let mut status_line = "HTTP/1.1 404 NOT FOUND";
let end = request_line.len()-9;
let keyword = &request_line[0..3];
let path = &request_line[5..end];
let mut path = &request_line[5..end];
let version = &request_line[(end+1)..request_line.len()];
println!("Line length: {}{}{}", keyword, path, version);
let page: rust_embed::EmbeddedFile;
if keyword == "GET" {
if version == "HTTP/1.1" {
if path == "index.html" || path == "" {
status_line = "HTTP/1.1 200 OK";
page = Asset::get("index.html").unwrap();
content = std::str::from_utf8(page.data.as_ref()).unwrap();
}else if path == "style.css" {
if version == "HTTP/1.1" || version == "HTTP/2.0" || version == "HTTP/1.0" {
if path == "" {
path = "index.html";
}
if Asset::iter().any(|x| x.as_ref().eq(path)) {
page = Asset::get(path).unwrap();
status_line = "HTTP/1.1 200 OK";
page = Asset::get("style.css").unwrap();
content = std::str::from_utf8(page.data.as_ref()).unwrap();
}
}else{
status_line = "HTTP/1.1 505 NOT IMPLEMENTED";
content = "<html><head><strong>Error 505</strong><br /></head><body><br /><p>HTTP Version Not Supported</p></body></html>";
}
}else{
status_line = "HTTP/1.1 501 Not Implemented";
content = "<html><head><strong>Error 501</strong><br /></head><body><img src=\"https://http.cat/501\"></img><br /><p>Not Implemented</p></body></html>";
}
let status_line = "HTTP/1.1 200 OK";
let length = content.len();
let response = format!(
"{}\r\nContent-Length: {}\r\n\r\n{}"

Loading…
Cancel
Save