diff --git a/Cargo.toml b/Cargo.toml index 4b2998c..da5d3eb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] name = "packeteer" description = "An attempt at a Rust library that can be used to assist in programmatically analysing, serving and handling received protocol packets." -version = "0.5.1" +version = "0.5.2" edition = "2021" -authors = ["Celeste "] +authors = ["abbieoverflight "] license = "MPL-2.0" homepage = "https://git.colean.cc/threeoh6000/packeteer/" repository = "https://git.colean.cc/threeoh6000/packeteer/" diff --git a/README b/README deleted file mode 100644 index fa3778d..0000000 --- a/README +++ /dev/null @@ -1,25 +0,0 @@ -Packeteer -------------- -Packeteer is a library that can handle structurally organising protocol packets like HTTP 1.x requests and responses as well as generating, structuring, unpacking and potentially more features depending on the protocol. - -Supported protocols ------------------------ -* HTTP/1.x -* Gemini -* FTP -* DNS - -What Packeteer is not -------------------------- -* a TCP/UDP stream handling library -* a server -* a protocol client -* the only way to do this, probably - -A note on licensing ------------------------ -This library changed from the LGPLv3 to MPLv2 as a result of LGPL's requirements for freedom of source on static linking which rustc does. - -I've chosen to use the MPL as it is a weaker but still copyleft license that allows you to statically link. - -The MPL applies retroactively to all previous versions of this library and will be used for all future versions. diff --git a/README.html b/README.html deleted file mode 100644 index 69c9dc2..0000000 --- a/README.html +++ /dev/null @@ -1,25 +0,0 @@ -

Packeteer

-

Packeteer is a library that can handle structurally organising protocol packets like HTTP 1.x requests and responses as well as generating, structuring, unpacking and potentially more features depending on the protocol.

- -

Supported protocols

- - -

What Packeteer is not

- - -

A note on licensing

-

This library changed from the LGPLv3 to MPLv2 as a result of LGPL's requirements for freedom of source on static linking which rustc does.

- -

I've chosen to use the MPL as it is a weaker but still copyleft license that allows you to statically link.

- -

The MPL applies retroactively to all previous versions of this library and will be used for all future versions.

diff --git a/src/http1.rs b/src/http1.rs index 2bfd491..a918f03 100644 --- a/src/http1.rs +++ b/src/http1.rs @@ -45,7 +45,7 @@ pub fn generate_response(code: i32, body: &str) -> Http1Response { } /// A function for converting HTTP/1.x request strings into Http1Request. /// Construction functions aim to be as transparent as possible so apart from turning it into a structure, the request stays relatively unchanged. -pub fn construct_request(request: &str) -> Http1Request { +pub fn construct_request(request: &str) -> Option { let split = request.split("\r\n"); let mut request = Http1Request { method: "".to_string(), location: wrap_url("https://example.com"), version: "".to_string(), headers: vec![], body: "".to_string() }; let mut reachedbody = false; @@ -64,6 +64,9 @@ pub fn construct_request(request: &str) -> Http1Request { } else if v == "" { reachedbody = true; } else { + if request.version == "".to_string() { + return None; + } let split1: Vec<&str> = v.split(": ").collect(); let header = generate_kvheader(split1[0], split1[1]); request.headers.push(header) @@ -72,7 +75,7 @@ pub fn construct_request(request: &str) -> Http1Request { request.body = v.to_string(); } } - return request + return Some(request) } /// A function for converting HTTP/1.x response strings into Http1Response. /// Construction functions aim to be as transparent as possible so apart from turning it into a structure, the response stays relatively unchanged.