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]
|
||||
name = "Http"
|
||||
version = "0.0.1"
|
||||
description = "TribuFu Http"
|
||||
repository = "https://github.com/TribuFu/Http"
|
||||
authors = ["TribuFu <contact@tribufu.com>"]
|
||||
description = "Http Server"
|
||||
repository = "https://github.com/GuilhermeWerner/Http"
|
||||
license = "MIT"
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
publish = false
|
||||
|
||||
[lib]
|
||||
name="Http"
|
||||
crate-type = ["rlib"]
|
||||
path = "Source/Http.rs"
|
||||
path = "Source/lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name="HttpServer"
|
||||
path = "Source/Main.rs"
|
||||
path = "Source/main.rs"
|
||||
doc = false
|
||||
|
||||
[dependencies]
|
||||
|
@ -1,7 +1,11 @@
|
||||
// Copyright (c) TribuFu. All Rights Reserved.
|
||||
|
||||
#![allow(non_snake_case)]
|
||||
|
||||
use std::net::TcpListener;
|
||||
|
||||
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)]
|
||||
|
||||
use std::fs;
|
||||
use std::io::prelude::*;
|
||||
use std::net::TcpListener;
|
||||
use std::net::TcpStream;
|
||||
|
||||
#[doc(hidden)]
|
||||
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) {
|
||||
pub fn HandleConnection(mut stream: TcpStream) {
|
||||
let mut buffer = [0; 1024];
|
||||
stream.read(&mut buffer).unwrap();
|
||||
|
Reference in New Issue
Block a user