Version: (using KDE KDE 3.4.2) Installed from: Debian testing/unstable Packages OS: Linux I think KHTML is doing the wrong thing when a form has method="GET" *AND* enctype="multipart/form-data". Using method="GET" implies that the enctype MUST be enctype="application/x-www-form-urlencoded". At the same time, "multipart/form-data" is only sensible for use with POST. So, the html is not really that sensible in the first place, but I still think khtml is doing the wrong thing when it runs across it. (And, unfortunately, a popular(?) perl CGI library is broken and sets enctype="multipart/form-data" for all forms when outputting xhtml). If you specify both, khtml currently decides to POST the data as multipart/form-data. I believe the correct thing to do is to GET the formdata as application/x-www-form-urlencoded. According to the HTML 4.01 spec, section 17.13.3 http://www.w3.org/TR/1999/REC-html401-19991224/interact/forms.html#h-17.13.3 + If the method is "get" and the action is an HTTP URI, the user agent takes the value of action, appends a `?' to it, then appends the form data set, encoded using the "application/x-www-form-urlencoded" content type. The user agent then traverses the link to this URI. In this scenario, form data are restricted to ASCII codes. + If the method is "post" and the action is an HTTP URI, the user agent conducts an HTTP "post" transaction using the value of the action attribute and a message created according to the content type specified by the enctype attribute. Looking at the code, It appears that khtml tries do the right thing: from kdelibs/khtml/khtml_part.cpp -> KHTMLPart::submitForm(): if ( strcmp( action, "get" ) == 0 ) { if (u.protocol() != "mailto") u.setQuery( QString::fromLatin1( formData.data(), formData.size() ) ); args.setDoPost( false ); } else { args.postData = formData; args.setDoPost( true ); <snip> } However, it may be getting messed up in this section of code: from khtml/html/html_formimpl.cpp -> HTMLFormElementImpl::setEnctype() if(type.string().find("multipart", 0, false) != -1 || type.string().find("form-data", 0, false) != -1) { m_enctype = "multipart/form-data"; m_multipart = true; m_post = true; } It sets m_post to true, regardless of what METHOD is set to. Fixing it appears to be a bit tricky, because setEnctype() needs to know what METHOD is really set to -- but setEnctype() currently has no way of knowing that.
Bug confirmed under KDE 3.5.5 / Kubuntu 6.10. Test case available online at: http://localhost/kde/bug111585.php - simply hit the submit button & the script will return success/failure. Firefox passes this test.
Oh dear. Correct url: http://www.mutube.com/x/kde/bug111585.php
In 4.0.3 Konqueror passes this test. Can someone confirm for 3.5.9 to close? Thanks.
Bug is still remaining in 3.5.9.
SVN commit 1135189 by orlovich: Don't force POST for multipart, rather ignore multipart when not in POST BUG:111585 BUG:240380 M +5 -4 html_formimpl.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=1135189
*** Bug 265082 has been marked as a duplicate of this bug. ***