mirror of
https://github.com/guilhermewerner/http
synced 2025-06-15 19:24:19 +00:00
Update cargo project
This commit is contained in:
11
Cargo.toml
11
Cargo.toml
@ -1,21 +1,20 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "Http"
|
name = "Http"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
description = "TribuFu Http"
|
description = "Http Server"
|
||||||
repository = "https://github.com/TribuFu/Http"
|
repository = "https://github.com/GuilhermeWerner/Http"
|
||||||
authors = ["TribuFu <contact@tribufu.com>"]
|
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
publish = false
|
publish = false
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name="Http"
|
name="Http"
|
||||||
crate-type = ["rlib"]
|
crate-type = ["rlib"]
|
||||||
path = "Source/Http.rs"
|
path = "Source/lib.rs"
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name="HttpServer"
|
name="HttpServer"
|
||||||
path = "Source/Main.rs"
|
path = "Source/main.rs"
|
||||||
doc = false
|
doc = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
// Copyright (c) TribuFu. All Rights Reserved.
|
|
||||||
|
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
|
use std::net::TcpListener;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
Http::Main();
|
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
|
||||||
|
|
||||||
|
for stream in listener.incoming() {
|
||||||
|
Http::HandleConnection(stream.unwrap());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,24 +1,10 @@
|
|||||||
// Copyright (c) TribuFu. All Rights Reserved.
|
|
||||||
|
|
||||||
#![allow(non_snake_case)]
|
#![allow(non_snake_case)]
|
||||||
|
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::net::TcpListener;
|
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
|
|
||||||
#[doc(hidden)]
|
pub fn HandleConnection(mut stream: TcpStream) {
|
||||||
pub fn Main() {
|
|
||||||
let listener = TcpListener::bind("127.0.0.1:7878").unwrap();
|
|
||||||
|
|
||||||
for stream in listener.incoming() {
|
|
||||||
let stream = stream.unwrap();
|
|
||||||
|
|
||||||
HandleConnection(stream);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn HandleConnection(mut stream: TcpStream) {
|
|
||||||
let mut buffer = [0; 1024];
|
let mut buffer = [0; 1024];
|
||||||
stream.read(&mut buffer).unwrap();
|
stream.read(&mut buffer).unwrap();
|
||||||
|
|
Reference in New Issue
Block a user