[PATCH] Do not handle form enctype="text/html" as enctype="text/plain"

Aurélien Gâteau agateau at dental-on-line.fr
Thu May 11 17:55:15 BST 2006


David Faure wrote:

> On Thursday 11 May 2006 15:16, Aurélien Gâteau wrote:
>> -    } else if (type.string().find("text", 0, false) != -1 ||
>> type.string().find("plain", 0, false) != -1) +    } else if
>> (type.string().find("text", 0, false) != -1 &&
>> type.string().find("plain", 0, false) != -1)
> 
> Shouldn't this become type.string() == "text/plain" then? It seems strange
> to do two substring matches if the only possibility that makes sense is
> "text/plain" anyway...
> 
I thought this would help handling broken html like this:

<form enctype="plain/text"...>

but I agree it would be simpler to do it this way.

For what it's worth, Firefox [1] doesn't bother trying to match broken
enctypes.  It just checks if the enctype matches either:
- multipart/form-data
- application/x-www-form-urlencoded
- text/plain

Anything else will get sent as "application/x-www-form-urlencoded".

It would be trivial to follow this behavior.  If you want to, I can submit
the patch.

Aurélien

[1] From Firefox source in content/html/content/src/, in files
nsHTMLFormElement.cpp and nsFormSubmission.cpp





More information about the kfm-devel mailing list