Completely OBSOLETE Rust HTTP library (server and client)

Overview

OBSOLETION NOTICE

This library is DEAD. It was a useful experiment and is now being replaced under the scope of the Teepee (experimentation grounds at the present) and Hyper (actual, usable HTTP stuff) projects.

For some more information on what’s happened/happening with it all, see http://chrismorgan.info/blog/introducing-teepee.html.

YOU SHOULD NOT USE THIS LIBRARY AT ALL. If you want to use HTTP, I recommend you use Hyper for the moment.

Comments
  • Switch to rust-url

    Switch to rust-url

    Fixes #57.

    I’m making a branch of Servo based on this. I’m not sure if you want it, but here it is.

    This adds a dependency on https://github.com/SimonSapin/rust-url , which itself depends on https://github.com/lifthrasiir/rust-encoding. The appropriate -L flags need to be passed in RUSTFLAGS.

    rust-url itself uses Cargo, but I’ve made a Makefile for Servo. (Servo wants cross-compiling, which is not supported by Cargo yet.) https://github.com/SimonSapin/servo/tree/rust-url/src/support/url

    opened by SimonSapin 24
  • Publicize ResponseWriter fields

    Publicize ResponseWriter fields

    Currently, Request and ResponseWriter do not impl Clone. As a workaround, a new Request can be made from the fields of an existing one, but there is no such workaround with ResponseWriter due to its private fields.

    This PR exposes writer and headers_written so that a new ResponseWriter can be made from an existing ResponseWriter that will write to the same BufferedStream.

    The use case for this is in extending rust-http to deal with multiple handlers, or a chain of handlers. Specifically, it helps to make frameworking more accessible by allowing wrapping of the Request and ResponseWriter into framework-defined structs, something that has been an issue for me.

    The only thing that is actually added here is prepending the field definitions with pub.

    opened by zzmp 16
  • Remove mut ~str, use std::strbuf::StrBuf

    Remove mut ~str, use std::strbuf::StrBuf

    Per mozilla/rust@d8e45ea7c054b4ad6fb82ec3a9fcf1736b4d7260 this ports all uses of ~str as temporary vectors to use StrBuf instead.

    There are places where I'm doing lots of really fiddly type juggling inside functions that could absolutely be ported to just use StrBuf as the interface, but this would break compatibility outside of them (insofar as it does already- this library totally explodes on a post d8e45ea7c rust)

    opened by richo 13
  • Consider unboxing Response::headers

    Consider unboxing Response::headers

    Currently, Response::headers is a Box<HeaderCollection> and I can't see why it should be rather than just a HeaderCollection stored in Response, which could be boxed or unboxed depending on the needs of the response consumer.

    opened by reem 11
  • Update README.rst

    Update README.rst

    I don't know what about your system but Arch, rust-git:

    $ ls target/examples 
    apache_fake  client  hello_world  info  one_time_server  request_uri
    $ ls target/test
    ls: cannot access target/test: No such file or directory
    
    opened by AlexTalker 6
  • Fix OpenSSL error when using HTTPS

    Fix OpenSSL error when using HTTPS

    There was an SSL handshake failure that occurred when attempting to perform an HTTP request to certain https addresses. I've been using rust-http in my version manager for the Rust compiler, and when I attempted to perform a HTTP GET on any Rust download the connection would fail with an OpenSSL error. (For example: https://static.rust-lang.org/*)

    I cleaned up the error messages in rust-openssl to make it more clear what was happening and then diagnosed that without the SNI the request would fail. It is a very simple fix, and setting the hostname on the SSL session seemed to be enough.

    The code that was failing can be found here: https://github.com/jroesch/rustv/blob/master/src/rustv/version.rs#L57.

    opened by jroesch 6
  • Build failure on Windows

    Build failure on Windows

    $ cargo build --verbose
         Running `rustc src\encoding\lib.rs --crate-name encoding --crate-type lib -
    g -C metadata=c1d6b666cb4ac9e8 -C extra-filename=-c1d6b666cb4ac9e8 --out-dir C:\
    Users\Austin\Documents\GitHub\rust-http\target\deps --dep-info C:\Users\Austin\D
    ocuments\GitHub\rust-http\target\.fingerprint\encoding-c1d6b666cb4ac9e8\dep-lib-
    encoding -L C:\Users\Austin\Documents\GitHub\rust-http\target\deps -L C:\Users\A
    ustin\Documents\GitHub\rust-http\target\deps`
         Running `rustc src\lib.rs --crate-name openssl --crate-type lib -g -C metad
    ata=f591436d05d56a5c -C extra-filename=-f591436d05d56a5c --out-dir C:\Users\Aust
    in\Documents\GitHub\rust-http\target\deps --dep-info C:\Users\Austin\Documents\G
    itHub\rust-http\target\.fingerprint\openssl-f591436d05d56a5c\dep-lib-openssl -L
    C:\Users\Austin\Documents\GitHub\rust-http\target\deps -L C:\Users\Austin\Docume
    nts\GitHub\rust-http\target\deps`
         Running `rustc C:\Users\Austin\.cargo\git\checkouts\rust-url-1e22af4233079a
    1e\master\src\lib.rs --crate-name url --crate-type lib -g -C metadata=f240ab718d
    c73e52 -C extra-filename=-f240ab718dc73e52 --out-dir C:\Users\Austin\Documents\G
    itHub\rust-http\target\deps --dep-info C:\Users\Austin\Documents\GitHub\rust-htt
    p\target\.fingerprint\url-f240ab718dc73e52\dep-lib-url -L C:\Users\Austin\Docume
    nts\GitHub\rust-http\target\deps -L C:\Users\Austin\Documents\GitHub\rust-http\t
    arget\deps --extern encoding=C:\Users\Austin\Documents\GitHub\rust-http\target\d
    eps/libencoding-c1d6b666cb4ac9e8.rlib`
         Running `rustc src\http\lib.rs --crate-name http --crate-type lib -g -C met
    adata=ea12ae0b12ae4f65 -C extra-filename=-ea12ae0b12ae4f65 --out-dir C:\Users\Au
    stin\Documents\GitHub\rust-http\target --dep-info C:\Users\Austin\Documents\GitH
    ub\rust-http\target\.fingerprint\http-ea12ae0b12ae4f65\dep-lib-http -L C:\Users\
    Austin\Documents\GitHub\rust-http\target -L C:\Users\Austin\Documents\GitHub\rus
    t-http\target\deps -L C:\Users\Austin\Documents\GitHub\rust-http\target\native\h
    ttp-ea12ae0b12ae4f65 --extern url=C:\Users\Austin\Documents\GitHub\rust-http\tar
    get\deps/liburl-f240ab718dc73e52.rlib --extern openssl=C:\Users\Austin\Documents
    \GitHub\rust-http\target\deps/libopenssl-f591436d05d56a5c.rlib`
           Fresh openssl v0.0.0 (https://github.com/sfackler/rust-openssl.git#e7e6ef
    5d)
           Fresh encoding v0.1.0 (https://github.com/lifthrasiir/rust-encoding#35f0d
    70f)
           Fresh url v0.1.0 (https://github.com/servo/rust-url#d894135c)
       Compiling http v0.1.0-pre (file:///C:/Users/Austin/Documents/GitHub/rust-http
    )
    Failed to run custom build command for `http v0.1.0-pre (file:///C:/Users/Austin
    /Documents/GitHub/rust-http)`
    Could not execute process `./prebuild.sh` (status=never executed)
    
    Caused by:
      OS Error 193: %1 is not a valid Win32 application.
    

    Tried in MinGW and MSYS. Fresh Rust and Cargo nightly:

    $ rustc --version
    rustc 0.12.0-pre-nightly (325808a33 2014-09-08 20:51:14 +0000)
    
    $ cargo --version
    cargo 0.0.1-pre-nightly (763e216 2014-09-08 22:28:48 +0000)
    

    Running ./prebuild.sh directly works just fine. Exits normally, no output.

    opened by abonander 6
  • Added Cargo

    Added Cargo

    This PR adds Cargo and also changes make to use target as a build directory to be consistent and to allow the two build systems to be interchangeable.

    Cargo.toml's treatment of the codegen step is not ideal right now, as it treats is as a ./configure-like step as opposed to treating it as code, which means that it runs every time you run cargo build. I don't see a way around this as Cargo is not extremely flexible right now (or at least is not documented as so).

    opened by reem 6
  • Use packaged openssl crate

    Use packaged openssl crate

    Using the git reference means users can't have e.g. rust-http and rust-postgres as dependencies as rust-postgres has already changed to the packaged version. This then leads to two 'different' crates linking the same native crate.

    opened by Ryman 5
  • testing nickel.rs and get this build error on rust-http

    testing nickel.rs and get this build error on rust-http

    cargo 0.0.1-pre-nightly (56852db 2014-11-14 23:33:33 +0000) rustc 0.13.0-nightly (d91a015ab 2014-11-14 23:37:27 +0000)

    did these $ cargo new myblabla.com --bin $ cd myblabla.com $ cargo build

    then this. screen shot 2014-11-17 at 3 15 41 am

    opened by talnetd 5
  • Build failed with error -  mismatched types: expected `collections::string::String`, found `time::TmFmt<'_>`

    Build failed with error - mismatched types: expected `collections::string::String`, found `time::TmFmt<'_>`

    eax@fujitsu:~/temp$ git clone https://github.com/chris-morgan/rust-http
    Cloning into 'rust-http'...
    remote: Counting objects: 3860, done.
    remote: Compressing objects: 100% (14/14), done.
    remote: Total 3860 (delta 1), reused 0 (delta 0)
    Receiving objects: 100% (3860/3860), 999.52 KiB | 210.00 KiB/s, done.
    Resolving deltas: 100% (2186/2186), done.
    Checking connectivity... done.
    eax@fujitsu:~/temp$ cd rust-http/
    eax@fujitsu:~/temp/rust-http$ ls
    Cargo.toml  codegen  comparisons  COPYRIGHT  documentation  examples  LICENSE-APACHE  LICENSE-MIT  prebuild.sh  README.rst  src
    eax@fujitsu:~/temp/rust-http$ cargo build -v
    warning: an arbitrary build command has now been deprecated.
             It has been replaced by custom build scripts.
             For more information, see http://doc.crates.io/build-script.html
        Updating git repository `https://github.com/sfackler/rust-openssl.git`
        Updating git repository `https://github.com/servo/rust-url`
        Updating git repository `https://github.com/lifthrasiir/rust-encoding`
       Compiling encoding-index-japanese v1.0.20140915 (https://github.com/lifthrasiir/rust-encoding#a06637cc)
         Running `rustc lib.rs --crate-name encoding-index-japanese --crate-type lib -g -C metadata=483043e85d4a33ad -C extra-filename=-483043e85d4a33ad --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/encoding-index-japanese-483043e85d4a33ad/dep-lib-encoding-index-japanese -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps -Awarnings`
       Compiling encoding-index-singlebyte v1.0.20140915 (https://github.com/lifthrasiir/rust-encoding#a06637cc)
         Running `rustc lib.rs --crate-name encoding-index-singlebyte --crate-type lib -g -C metadata=bea7b3e2495b3c3b -C extra-filename=-bea7b3e2495b3c3b --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/encoding-index-singlebyte-bea7b3e2495b3c3b/dep-lib-encoding-index-singlebyte -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps -Awarnings`
       Compiling openssl v0.0.0 (https://github.com/sfackler/rust-openssl.git#766ce4b7)
         Running `rustc src/lib.rs --crate-name openssl --crate-type lib -g -C metadata=fbe75530f7eda428 -C extra-filename=-fbe75530f7eda428 --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/openssl-fbe75530f7eda428/dep-lib-openssl -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps -Awarnings`
       Compiling encoding-index-korean v1.0.20140915 (https://github.com/lifthrasiir/rust-encoding#a06637cc)
         Running `rustc lib.rs --crate-name encoding-index-korean --crate-type lib -g -C metadata=deaa17992fade0b3 -C extra-filename=-deaa17992fade0b3 --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/encoding-index-korean-deaa17992fade0b3/dep-lib-encoding-index-korean -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps -Awarnings`
       Compiling encoding-index-simpchinese v1.0.20140915 (https://github.com/lifthrasiir/rust-encoding#a06637cc)
         Running `rustc lib.rs --crate-name encoding-index-simpchinese --crate-type lib -g -C metadata=2dc900f172f1b6eb -C extra-filename=-2dc900f172f1b6eb --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/encoding-index-simpchinese-2dc900f172f1b6eb/dep-lib-encoding-index-simpchinese -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps -Awarnings`
       Compiling encoding-index-tradchinese v1.0.20140915 (https://github.com/lifthrasiir/rust-encoding#a06637cc)
         Running `rustc lib.rs --crate-name encoding-index-tradchinese --crate-type lib -g -C metadata=31c5a3802fca9dba -C extra-filename=-31c5a3802fca9dba --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/encoding-index-tradchinese-31c5a3802fca9dba/dep-lib-encoding-index-tradchinese -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps -Awarnings`
       Compiling http v0.1.0-pre (file:///home/eax/temp/rust-http)
         Running sh prebuild.sh
       Compiling encoding v0.2.0 (https://github.com/lifthrasiir/rust-encoding#a06637cc)
         Running `rustc /home/eax/.cargo/git/checkouts/rust-encoding-aceee0e55a114022/master/src/lib.rs --crate-name encoding --crate-type lib -g -C metadata=8745cc083d450456 -C extra-filename=-8745cc083d450456 --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/encoding-8745cc083d450456/dep-lib-encoding -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps --extern encoding-index-simpchinese=/home/eax/temp/rust-http/target/deps/libencoding-index-simpchinese-2dc900f172f1b6eb.rlib --extern encoding-index-korean=/home/eax/temp/rust-http/target/deps/libencoding-index-korean-deaa17992fade0b3.rlib --extern encoding-index-tradchinese=/home/eax/temp/rust-http/target/deps/libencoding-index-tradchinese-31c5a3802fca9dba.rlib --extern encoding-index-japanese=/home/eax/temp/rust-http/target/deps/libencoding-index-japanese-483043e85d4a33ad.rlib --extern encoding-index-singlebyte=/home/eax/temp/rust-http/target/deps/libencoding-index-singlebyte-bea7b3e2495b3c3b.rlib -Awarnings`
       Compiling url v0.1.0 (https://github.com/servo/rust-url#8a61b765)
         Running `rustc /home/eax/.cargo/git/checkouts/rust-url-1e22af4233079a1e/master/src/lib.rs --crate-name url --crate-type lib -g -C metadata=921578b148f50e06 -C extra-filename=-921578b148f50e06 --out-dir /home/eax/temp/rust-http/target/deps --dep-info /home/eax/temp/rust-http/target/.fingerprint/url-921578b148f50e06/dep-lib-url -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/deps --extern encoding=/home/eax/temp/rust-http/target/deps/libencoding-8745cc083d450456.rlib -Awarnings`
         Running `rustc src/http/lib.rs --crate-name http --crate-type lib -g -C metadata=75bda6d0676a064c -C extra-filename=-75bda6d0676a064c --out-dir /home/eax/temp/rust-http/target --dep-info /home/eax/temp/rust-http/target/.fingerprint/http-75bda6d0676a064c/dep-lib-http -L /home/eax/temp/rust-http/target -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/native/http-75bda6d0676a064c --extern openssl=/home/eax/temp/rust-http/target/deps/libopenssl-fbe75530f7eda428.rlib --extern url=/home/eax/temp/rust-http/target/deps/liburl-921578b148f50e06.rlib`
    src/http/headers/mod.rs:733:9: 733:63 error: mismatched types: expected `collections::string::String`, found `time::TmFmt<'_>` (expected struct collections::string::String, found struct time::TmFmt)
    src/http/headers/mod.rs:733         self.to_utc().strftime("%a, %d %b %Y %T GMT").unwrap()
                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    error: aborting due to previous error
    Could not compile `http`.
    
    Caused by:
      Process didn't exit successfully: `rustc src/http/lib.rs --crate-name http --crate-type lib -g -C metadata=75bda6d0676a064c -C extra-filename=-75bda6d0676a064c --out-dir /home/eax/temp/rust-http/target --dep-info /home/eax/temp/rust-http/target/.fingerprint/http-75bda6d0676a064c/dep-lib-http -L /home/eax/temp/rust-http/target -L /home/eax/temp/rust-http/target/deps -L /home/eax/temp/rust-http/target/native/http-75bda6d0676a064c --extern openssl=/home/eax/temp/rust-http/target/deps/libopenssl-fbe75530f7eda428.rlib --extern url=/home/eax/temp/rust-http/target/deps/liburl-921578b148f50e06.rlib` (status=101)
    eax@fujitsu:~/temp/rust-http$ rustc --version
    rustc 0.13.0-nightly
    eax@fujitsu:~/temp/rust-http$ cargo --version
    cargo 0.0.1-pre-nightly (8cc600a 2014-11-07 21:15:52 +0000)
    eax@fujitsu:~/temp/rust-http$ uname -a
    Linux fujitsu 3.13.0-32-generic #57-Ubuntu SMP Tue Jul 15 03:51:08 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
    eax@fujitsu:~/temp/rust-http$ cat /etc/lsb-release 
    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=14.04
    DISTRIB_CODENAME=trusty
    DISTRIB_DESCRIPTION="Ubuntu 14.04.1 LTS"
    
    opened by afiskon 5
  • Poor performance when HTTP keep-alive is disabled

    Poor performance when HTTP keep-alive is disabled

    I observe that throughput for a simple 'Hello, world' server drops by about 10x when the client does not use or support HTTP keep-alive. My 8-core i7 manages about ~28k req/s with keep-alive and ~2.4k req/s without.

    I expected some TCP setup/teardown overhead but, according to perf record, most CPU time can be traced back to the spawn() call in src/http/server/mod.rs. I see expensive system calls to clone(), mmap(), mprotect(), and so on, all originating from imp::thread::create() from the standard library. A thread pool would probably help alleviate that.

    opened by bnoordhuis 0
  • Explain what limitations are there for posting

    Explain what limitations are there for posting

    The source code comment says:

    If you wish to send a request body (e.g. POST requests), I'm sorry to have to tell you that there is not good support for this yet. However, it can be done; here is an example:

    Please update the readme and/or documentation with a description of these limitations. The comments say that there are, but it's unclear what they are.

    opened by Valve 2
  • Case sensitivity of methods, and spec compliance

    Case sensitivity of methods, and spec compliance

    opened by Manishearth 2
Owner
Chris Morgan
Chris Morgan
OxHTTP is a very simple synchronous HTTP client and server

OxHTTP is a very simple synchronous implementation of HTTP 1.1 in Rust. It provides both a client and a server.

Oxigraph 13 Nov 29, 2022
Low level HTTP server library in Rust

tiny-http Documentation Tiny but strong HTTP server in Rust. Its main objectives are to be 100% compliant with the HTTP standard and to provide an eas

null 785 Dec 29, 2022
Archibald is my attempt at learning Rust and writing a HTTP 1.1 web server.

Archibald To be a butler, is to be able to maintain an even-temper, at all times. One must have exceptional personal hygiene and look sharp and profes

Daniel Cuthbert 4 Jun 20, 2022
Host These Things Please - a basic http server for hosting a folder fast and simply

http Host These Things Please - a basic HTTP server for hosting a folder fast and simply Selected features See the manpage for full list. Symlinks fol

thecoshman 367 Dec 23, 2022
Operator is a web server. You provide a directory and Operator serves it over HTTP.

Operator Operator is a web server. You provide a directory and Operator serves it over HTTP. It serves static files the way you'd expect, but it can a

Matt Kantor 6 Jun 6, 2022
Simple http server in Rust (Windows/Mac/Linux)

How it looks like? Screenshot Command Line Arguments Simple HTTP(s) Server 0.6.1 USAGE: simple-http-server [FLAGS] [OPTIONS] [--] [root] FLAGS:

LinFeng Qian 788 Dec 28, 2022
Akasio is a simple HTTP server that redirects traffic based on a JSON redirect table. This is its Rust implementation.

This page is inaccurate and is pending updates. Akasio (Rust) Description Akasio is a simple HTTP server that redirects traffic based on a JSON redire

K4YT3X 5 May 2, 2022
Fully async-await http server framework

Saphir is a fully async-await http server framework for rust The goal is to give low-level control to your web stack (as hyper does) without the time

Richer Archambault 83 Dec 19, 2022
Node.js http server framework powered by Hyper native binding.

hnsjs POC project. Install this test package yarn add @hnsjs/core Support matrix node10 node12 node14 node15 Windows x64 ✓ ✓ ✓ ✓ Windows x32 ✓ ✓ ✓ ✓

LongYinan 18 Nov 23, 2022
RUSTENGINE is the high-assurance HTTP server.

RUSTENGINE Table of Contents RUSTENGINE Table of Contents About RUSTENGINE Inspiration with Rust Features Compares with Nginx Build & Run About this R

FUNNY SYSTEMS 10 Aug 27, 2021
A synchronous HTTP server built on hyper.

Astra Astra is a synchronous HTTP server built on top of hyper. use astra::{Body, Response, Server}; fn main() { Server::bind("localhost:3000")

Ibraheem Ahmed 23 Nov 27, 2022
Static Web Server - a very small and fast production-ready web server suitable to serve static web files or assets

Static Web Server (or SWS abbreviated) is a very small and fast production-ready web server suitable to serve static web files or assets.

Jose Quintana 496 Jan 2, 2023
Live Server - Launch a local network server with live reload feature for static pages

Live Server - Launch a local network server with live reload feature for static pages

Lomirus 18 Nov 30, 2022
An HTTP library for Rust

hyper A fast and correct HTTP implementation for Rust. HTTP/1 and HTTP/2 Asynchronous design Leading in performance Tested and correct Extensive produ

null 11k Jan 7, 2023
Create, share, fetch and model Atomic Data! This project consists of a graph database + server, a CLI and a rust library.

Create, share, fetch and model Atomic Data! This repo consists of three components: A library, a server and a CLI. atomic-server Status: Beta. Breakin

Joep Meindertsma 195 Dec 28, 2022
Add Facebook and Google authentication to your HTTP REST API in Actix-web

I created this project while learning Rust. Project shows how to handle Facebook and Google token verification in Rust using Actix-Web. Hope this help

null 37 Dec 31, 2022
[OUTDATED] A light HTTP framework for Rust

Rustful A light HTTP framework for Rust, with REST-like features. The main purpose of Rustful is to create a simple, modular and non-intrusive foundat

Erik Hedvall 873 Nov 12, 2022
:zap: fast http framework for rust

zap ⚡ The mission of zap is, to deliver a basic, but fast rust web server library. Documentation About This code is based on tokio's minihttp project,

Daniel Oltmanns 51 Jun 7, 2022
service_policy_kit is a Rust based toolkit for verifying HTTP services against policies.

Service Policy Kit service_policy_kit is a Rust based toolkit for verifying HTTP services against policies. You can: Build a complete testing framewor

null 19 Dec 5, 2022