Opened 23 months ago

Last modified 11 months ago

#6112 task new

Make twisted.web.test.test_http.ParsingTestCase.testMissingContentDisposition pass on Python 3

Reported by: exarkun Owned by:
Priority: normal Milestone: Python-3.x
Component: web Keywords:
Cc: jknight, thijs Branch:
Author: Launchpad Bug:

Description

Presently this test is skipped on Python 3 because it will fail or go into an infinite loop. cgi.parse_multipart is currently broken on Python 3. We may need to implement our own multipart/form-data parser (might be a good opportunity to use Parsley?). Or we could try to fix the stdlib code and then ship a backport (or depend on Python 3.4 instead of Python 3.3).

Note also our test coverage for handling of multipart/form-data is really awful - #6111.

Change History (4)

comment:1 Changed 23 months ago by DefaultCC Plugin

  • Cc jknight added

comment:2 Changed 22 months ago by itamar

web2.fileupload and corresponding tests should at the very least provide a basis (and some useful tests) for what an implementation needs to do. Also a reference for what browser stupidity needs working around.

comment:3 follow-up: Changed 11 months ago by thijs

  • Cc thijs added
  • Type changed from enhancement to task

Replying to exarkun:

Presently this test is skipped on Python 3 because it will fail or go into an infinite loop. cgi.parse_multipart is currently broken on Python 3.

That ticket was fixed and changes were introduced in Python 3.3.1.

Or we could try to fix the stdlib code and then ship a backport (or depend on Python 3.4 instead of Python 3.3).

Can we still depend on 3.3 now it's in 3.3.1?

comment:4 in reply to: ↑ 3 Changed 11 months ago by thijs

Replying to thijs:

Can we still depend on 3.3 now it's in 3.3.1?

Testing with 3.3.1 shows it's still broken:

  File "/Twisted/trunk/twisted/web/http.py", line 1730, in allContentReceived
    req.requestReceived(command, path, version)
  File "/Twisted/trunk/twisted/web/http.py", line 812, in requestReceived
    args.update(cgi.parse_multipart(self.content, pdict))
  File "/usr/local/lib/python3.3/cgi.py", line 233, in parse_multipart
    nextpart = b"--" + boundary
TypeError: can't concat bytes to str
Note: See TracTickets for help on using tickets.