chris-morgan / rust-http

Completely OBSOLETE Rust HTTP library (server and client)
Other
390 stars 110 forks source link

change request body from String to Vec<u8> for binary request body #164

Closed pavlov-dmitry closed 10 years ago

pavlov-dmitry commented 10 years ago

Trying to do to upload images from the client to the server.

this is my html code:

    <form action="/upload" method="post" enctype="multipart/form-data">
        <input type=file name=upload_img value="" />
        <input type=submit name="sub" value=" Upload " />
    </form>

On uploading images 400 Bad Request always happend, because src/http/server/request.rs line 381 String::from_utf8(body)

I think request body must be Vec< u8 >. What you think about this?

P.S.: sorry for my bad english.

Ogeon commented 10 years ago

Oh, this is embarrassing... Looks like I'm the one to blame. I don't know how I could forget about other data than text. Anyway, you are right. It's impossible to upload binary data with the current code.

I wonder why Travis hasn't tested this pull request... It looks fine, but I will check again when I get home, unless anyone else does it first.

Ogeon commented 10 years ago

It looks good. Thank you!