Issue with upload files to routes

119 views
Skip to first unread message

Poz

unread,
Feb 12, 2012, 6:23:13 PM2/12/12
to Goliath.io
Hello all,

I'm writing a file upload proxy with goliath and I've run into a
problem. My server works perfectly as a single class but when I put
some routes in front of my server i get:

[7683:ERROR] 2012-02-12 15:20:33 :: bad content body

Here is the code in question: https://gist.github.com/1811712

When I run: $ ruby with_routes.rb -sv

I get the bad content body error

When I run: $ ruby upload_proxy.rb -sv

Everything works great.

I need to have some routes for this server any help would be greatly
appricated.

Poz

Paweł Pacana

unread,
Feb 12, 2012, 7:11:46 PM2/12/12
to golia...@googlegroups.com
2012/2/13 Poz <jpoz...@gmail.com>:

> I'm writing a file upload proxy with goliath and I've run into a
> problem. My server works perfectly as a single class but when I put
> some routes in front of my server i get:
>
>    [7683:ERROR] 2012-02-12 15:20:33 :: bad content body

As far as I remember http router is not handling multipart POSTs well.

Poz

unread,
Feb 13, 2012, 2:13:11 PM2/13/12
to Goliath.io
I've done a little bit more digging into this. The offending line is
in Rack.

/gems/rack-1.4.1/lib/rack/multipart/parser.rb:73:in `block in
fast_forward_to_first_boundary'

But I don't believe this is a Rack bug. When you inspect the IO object
given to Rack from Goliath isn't empty.

If we look into the parse method in Goliath::Request the body is given
to the ASYNC_BODY method but not kept in the instance @body variable.

From the looks of it this means that if you define a on_body method
you can't use any Rack middleware?

Is this true?


On Feb 12, 4:11 pm, Paweł Pacana <pawel.pac...@gmail.com> wrote:
> 2012/2/13 Poz <jpozd...@gmail.com>:
Reply all
Reply to author
Forward
0 new messages