rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
* Consider reverting multipart parsing change
@ 2010-07-04 22:20 Jeremy Kemper
  2010-07-05 22:57 ` Mark Goris
  0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Kemper @ 2010-07-04 22:20 UTC (permalink / raw)
  To: rack-devel

I think acffe8ef5 should be reverted.

To support an edge casey user-agent it removed the metadata from all
MIME parts with a Content-Type but no filename.

The idea was to have text/plain parts parse as regular params instead
of file uploads. That's reasonable, but it should be limited to
text/plain parts.

The original issue: http://rack.lighthouseapp.com/projects/22435-rack/tickets/79

jeremy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Consider reverting multipart parsing change
  2010-07-04 22:20 Consider reverting multipart parsing change Jeremy Kemper
@ 2010-07-05 22:57 ` Mark Goris
  2010-07-06  7:54   ` Jeremy Kemper
  0 siblings, 1 reply; 5+ messages in thread
From: Mark Goris @ 2010-07-05 22:57 UTC (permalink / raw)
  To: Rack Development

Hi Jeremy,

It's been a long time since I created the initial ticket, so I've lost
some of the context (especially in the subsequent discussion that led
to this change that you've suggested to revert).  It seemed best to me
that tempfiles only be used in the case of having a filename attribute
be present, regardless of content-type.  Your suggestion seems to
focus on the specific type of content-type driving logic regarding
whether or not a part is treated as a file upload.  I guess my
question is, why not just use the filename attribute to drive this
logic?  I don't know of a downside to this approach (meaning, I'm not
exactly clear on the intention for the change that prompted ticket 79
in the first place).

JMG

On Jul 4, 3:20 pm, Jeremy Kemper <jer...@bitsweat.net> wrote:
> I think acffe8ef5 should be reverted.
>
> To support an edge casey user-agent it removed the metadata from all
> MIME parts with a Content-Type but no filename.
>
> The idea was to have text/plain parts parse as regular params instead
> of file uploads. That's reasonable, but it should be limited to
> text/plain parts.
>
> The original issue:http://rack.lighthouseapp.com/projects/22435-rack/tickets/79
>
> jeremy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Consider reverting multipart parsing change
  2010-07-05 22:57 ` Mark Goris
@ 2010-07-06  7:54   ` Jeremy Kemper
  2010-07-08  5:03     ` Joshua Ballanco
  0 siblings, 1 reply; 5+ messages in thread
From: Jeremy Kemper @ 2010-07-06  7:54 UTC (permalink / raw)
  To: rack-devel

On Mon, Jul 5, 2010 at 3:57 PM, Mark Goris <mark.goris@gmail.com> wrote:
> It's been a long time since I created the initial ticket, so I've lost
> some of the context (especially in the subsequent discussion that led
> to this change that you've suggested to revert).  It seemed best to me
> that tempfiles only be used in the case of having a filename attribute
> be present, regardless of content-type.  Your suggestion seems to
> focus on the specific type of content-type driving logic regarding
> whether or not a part is treated as a file upload.  I guess my
> question is, why not just use the filename attribute to drive this
> logic?  I don't know of a downside to this approach (meaning, I'm not
> exactly clear on the intention for the change that prompted ticket 79
> in the first place).

Checking for filename works for file uploads from web browsers. All
other MIME parts are flattened to a "normal" form parameter even it it
was neither a form param or a file upload. For example, see the
multipart/mixed regression on #79.

The fix for #79 restricts what may be considered a file upload rather
than broadening what may be considered a normal form param to include
MIME parts with a text/plain Content-Type.

Rather than treating all MIME parts as form params and making a
special case for file uploads by looking for a filename, we should be
doing the opposite, making a special case to identify form param MIME
parts by their missing filename and missing or text/plain
Content-Type.

jeremy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Consider reverting multipart parsing change
  2010-07-06  7:54   ` Jeremy Kemper
@ 2010-07-08  5:03     ` Joshua Ballanco
  2010-07-10  2:26       ` Mateo Murphy
  0 siblings, 1 reply; 5+ messages in thread
From: Joshua Ballanco @ 2010-07-08  5:03 UTC (permalink / raw)
  To: rack-devel

On Jul 6, 2010, at 12:54 AM, Jeremy Kemper wrote:

> On Mon, Jul 5, 2010 at 3:57 PM, Mark Goris <mark.goris@gmail.com> wrote:
>> It's been a long time since I created the initial ticket, so I've lost
>> some of the context (especially in the subsequent discussion that led
>> to this change that you've suggested to revert).  It seemed best to me
>> that tempfiles only be used in the case of having a filename attribute
>> be present, regardless of content-type.  Your suggestion seems to
>> focus on the specific type of content-type driving logic regarding
>> whether or not a part is treated as a file upload.  I guess my
>> question is, why not just use the filename attribute to drive this
>> logic?  I don't know of a downside to this approach (meaning, I'm not
>> exactly clear on the intention for the change that prompted ticket 79
>> in the first place).
> 
> Checking for filename works for file uploads from web browsers. All
> other MIME parts are flattened to a "normal" form parameter even it it
> was neither a form param or a file upload. For example, see the
> multipart/mixed regression on #79.
> 
> The fix for #79 restricts what may be considered a file upload rather
> than broadening what may be considered a normal form param to include
> MIME parts with a text/plain Content-Type.
> 
> Rather than treating all MIME parts as form params and making a
> special case for file uploads by looking for a filename, we should be
> doing the opposite, making a special case to identify form param MIME
> parts by their missing filename and missing or text/plain
> Content-Type.

Just wanted to give my +1 to this solution. I actually have a real-life use case where this becomes an issue. I have a client (not a web browser) which generates data dynamically to upload to an HTTP server as a file upload. Because there was no original file from which to extract a filename parameter (and because the server has logic to assign filenames based on other parameters), my client does a multipart-upload without a filename parameter. However, the file parts can be rather large (up to 100s of MB). Having these passed in as strings instead of using tempfiles seems less than ideal.

Cheers,

Josh

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Consider reverting multipart parsing change
  2010-07-08  5:03     ` Joshua Ballanco
@ 2010-07-10  2:26       ` Mateo Murphy
  0 siblings, 0 replies; 5+ messages in thread
From: Mateo Murphy @ 2010-07-10  2:26 UTC (permalink / raw)
  To: rack-devel


On 8-Jul-10, at 1:03 AM, Joshua Ballanco wrote:

> On Jul 6, 2010, at 12:54 AM, Jeremy Kemper wrote:
>
>> On Mon, Jul 5, 2010 at 3:57 PM, Mark Goris <mark.goris@gmail.com>  
>> wrote:
>>> It's been a long time since I created the initial ticket, so I've  
>>> lost
>>> some of the context (especially in the subsequent discussion that  
>>> led
>>> to this change that you've suggested to revert).  It seemed best  
>>> to me
>>> that tempfiles only be used in the case of having a filename  
>>> attribute
>>> be present, regardless of content-type.  Your suggestion seems to
>>> focus on the specific type of content-type driving logic regarding
>>> whether or not a part is treated as a file upload.  I guess my
>>> question is, why not just use the filename attribute to drive this
>>> logic?  I don't know of a downside to this approach (meaning, I'm  
>>> not
>>> exactly clear on the intention for the change that prompted ticket  
>>> 79
>>> in the first place).
>>
>> Checking for filename works for file uploads from web browsers. All
>> other MIME parts are flattened to a "normal" form parameter even it  
>> it
>> was neither a form param or a file upload. For example, see the
>> multipart/mixed regression on #79.
>>
>> The fix for #79 restricts what may be considered a file upload rather
>> than broadening what may be considered a normal form param to include
>> MIME parts with a text/plain Content-Type.
>>
>> Rather than treating all MIME parts as form params and making a
>> special case for file uploads by looking for a filename, we should be
>> doing the opposite, making a special case to identify form param MIME
>> parts by their missing filename and missing or text/plain
>> Content-Type.
>
> Just wanted to give my +1 to this solution. I actually have a real- 
> life use case where this becomes an issue. I have a client (not a  
> web browser) which generates data dynamically to upload to an HTTP  
> server as a file upload. Because there was no original file from  
> which to extract a filename parameter (and because the server has  
> logic to assign filenames based on other parameters), my client does  
> a multipart-upload without a filename parameter. However, the file  
> parts can be rather large (up to 100s of MB). Having these passed in  
> as strings instead of using tempfiles seems less than ideal.
>
> Cheers,
>
> Josh

Looking at the relevant RFC (http://www.ietf.org/rfc/rfc1867.txt), the  
filename is clearly optional, so relying on it is not a good idea.  
Treating everything that has a filename or a content-type other than  
text/plain as a file would be a sensible solution, although that  
creates a problem when trying to upload very large text files; in that  
case I think also added a content-length check might be wise?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-07-10  2:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-07-04 22:20 Consider reverting multipart parsing change Jeremy Kemper
2010-07-05 22:57 ` Mark Goris
2010-07-06  7:54   ` Jeremy Kemper
2010-07-08  5:03     ` Joshua Ballanco
2010-07-10  2:26       ` Mateo Murphy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).