Edgewall Software
Modify

Opened 18 years ago

Closed 18 years ago

Last modified 18 years ago

#2509 closed enhancement (worksforme)

Patch to consolidate all FieldStorage variants

Reported by: trac-form@… Owned by: Christopher Lenz
Priority: normal Milestone:
Component: version control/browser Version: devel
Severity: normal Keywords:
Cc: Branch:
Release Notes:
API Changes:
Internal Changes:

Description

After a discussion with cmlenz related to issues I was having with an XML-RPC plugin, he suggested using cgi.FieldStorage for all Request subclasses.

This patch implements that proposal by moving web.cgi.TracFieldStorage into web.api and removing the redundant implementations.

Without this patch mod_pythons fake FieldStorage fails if an XML-RPC client POSTs to an IRequestHandler.

Attachments (3)

trac-field-storage.diff (4.8 KB ) - added by trac-form@… 18 years ago.
Implementation of patch
trac-field-storage-2.diff (5.2 KB ) - added by trac-form@… 18 years ago.
Updated patch
trac-field-storage-3.diff (5.2 KB ) - added by trac-form@… 18 years ago.
Some final tweaks

Download all attachments as: .zip

Change History (13)

by trac-form@…, 18 years ago

Attachment: trac-field-storage.diff added

Implementation of patch

comment:1 by Christopher Lenz, 18 years ago

Component: browsermod_python frontend
Milestone: 0.9.31.0
Owner: changed from Jonas Borgström to Christopher Lenz
Status: newassigned

To put this in some context, I suggested using the cgi.FieldStorage class everywhere, instead of using the mod_python provided implementation in the mod_python frontend, which has causes various subtle problems in the past.

Also, when we migrate to WSGI, we'll be not be using the mod_python FieldStorage implementation anyway.

comment:2 by trac-form@…, 18 years ago

Component: mod_python frontendbrowser
Milestone: 1.00.9.3

I have updated the patch to better emulate the CGI environment under mod_python by setting envCONTENT_TYPE and envCONTENT_LENGTH if available.

I also added a check to the constructor of trac.web.api.FieldStorage for the case where no fields are parsed, which previously caused an exception in popluate_hdf().

by trac-form@…, 18 years ago

Attachment: trac-field-storage-2.diff added

Updated patch

comment:3 by trac-form@…, 18 years ago

I'm not 100% convinced that overriding read_single() is a good idea, but without it cgi.FieldStorage consumes all of the input stream if the content-type is unexpected (eg. text/xml).

comment:4 by Matthew Good, 18 years ago

I encountered some similar problems with the FieldStorage when I was experimenting with XML-RPC a while back. I'll take another look at how I was addressing it to see if it helps at all.

comment:5 by trac-form@…, 18 years ago

I've created an XmlRpcPlugin for Trac. Permission enforcement is not implemented yet, and only a couple of ticket manipulation functions are exported, but it is looking promising.

by trac-form@…, 18 years ago

Attachment: trac-field-storage-3.diff added

Some final tweaks

comment:6 by trac-form@…, 18 years ago

This last patch has some minor changes, passing the mod_python headers directly to FieldStorage. I haven't noticed any issues as yet.

comment:7 by Alec Thomas <alec@…>, 18 years ago

Milestone: 0.9.31.0

comment:8 by Alec Thomas <alec@…>, 18 years ago

Third patch does not seem to work. Don't use it'''

comment:9 by Alec Thomas <alec@…>, 18 years ago

Resolution: worksforme
Status: assignedclosed

Use the WSGI branch instead. This will be merged into 0.10.

comment:10 by anonymous, 18 years ago

Milestone: 1.0

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Christopher Lenz.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Christopher Lenz to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.