Quantcast

Errors parsing multipart form data

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Errors parsing multipart form data

Carles Barrobés
Hi all,

I'm using Django-on-Jython and after uploading a WAR file to my local
Tomcat server my app works fine. Then I upload it to a production server
and the forms that use multipart/form-data encoding fail (e.g. the admin
forms, plus my app's file uploads...). The multipart data is not parsed
correctly, it's like the boundaries is not identified correctly and some
of the form fields get weird data (like "-----------", which is part of
the value of the boundary string).

Jython version is 2.5.1

I'm at a loss as of where to start looking for the error, is it Jython
issue or a Django-on-Jython thing. The weird thing is these machines
have the same WAR file running.

Any hints will be appreciated, thanks!
Carles.


This is a sample of the POST data as copied from Firebug's Net tab:

|Content-Type: multipart/form-data;
boundary=---------------------------35477648733731327546524994
||
Content-Length: 1791

||||-----------------------------35477648733731327546524994
||Content-Disposition: form-data; name="username"

||||gerard
||-----------------------------35477648733731327546524994
||Content-Disposition: form-data; name="password"

||||sha1$a557e$f70ced402f9ffd79dc06b733d52edd26ae4ce328
||-----------------------------35477648733731327546524994
||Content-Disposition: form-data; name="first_name"


||||||-----------------------------35477648733731327546524994
||Content-Disposition: form-data; name="last_name"


||||-----------------------------35477648733731327546524994
||Content-Disposition: form-data; name="email"


||||||||-----------------------------35477648733731327546524994-- |


------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Errors parsing multipart form data

sven.klemm@tschitschereengreen.com
Hi Charles,

> I'm using Django-on-Jython and after uploading a WAR file to my local
> Tomcat server my app works fine. Then I upload it to a production server
> and the forms that use multipart/form-data encoding fail (e.g. the admin
> forms, plus my app's file uploads...). The multipart data is not parsed
> correctly, it's like the boundaries is not identified correctly and some
> of the form fields get weird data (like "-----------", which is part of
> the value of the boundary string).
>
> Jython version is 2.5.1

I stumbled across the same problem and found the cause. This is a bug in
the django multipart parser. It assumes read works non-blocking which is
obviously not the case under tomcat. You can find the patch in the
django bugtracker:

http://code.djangoproject.com/ticket/13756

Cheers,
Sven

--

Tschitschereengreen - Agile Enterprise Class Web App Development
http://tschitschereengreen.com

°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°°
Tschitschereengreen, a brand of the Yoosic Technology GmbH ||
Handelsregister: HRB 24727 beim Amtsgericht Dresden || Pulsnitzer Str.
52 || 01936 Großnaundorf || Tel.: +49 (351) 404 5507  || Fax: +49 (351)
404 5517 || eMail: [hidden email] || Steuernummer:
213/123/00246 || USTIdentNr.: DE251133999

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Errors parsing multipart form data

Carles Barrobés
Thanks Sven, you saved my life :)
I applied the patch to my Django 1.1 I use with Jython and it worked
like a charm.

I owe you a beer.
Carles

Sven Klemm wrote:

> Hi Carles,
>
>> I'm using Django-on-Jython and after uploading a WAR file to my local
>> Tomcat server my app works fine. Then I upload it to a production
>> server and the forms that use multipart/form-data encoding fail (e.g.
>> the admin forms, plus my app's file uploads...). The multipart data
>> is not parsed correctly, it's like the boundaries is not identified
>> correctly and some of the form fields get weird data (like
>> "-----------", which is part of the value of the boundary string).
>>
>> Jython version is 2.5.1
>
> I stumbled across the same problem and found the cause. This is a bug
> in the django multipart parser. It assumes read works non-blocking
> which is obviously not the case under tomcat. You can find the patch
> in the django bugtracker:
>
> http://code.djangoproject.com/ticket/13756
>
> Cheers,
> Sven
>

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit.  See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Loading...