Put content types and charsets on the text/plain parts of the form submissionfor multipart POST submissions. Bug 116346, patch by David Nesting<david@fastolfe.net>, r=bzbarsky, sr=sicking

This commit is contained in:
bzbarsky@mit.edu 2007-05-13 21:00:49 -07:00
parent 5b2ec7d443
commit 95764e882c

View File

@ -770,6 +770,9 @@ nsFSMultipartFormData::AddNameValuePair(nsIDOMHTMLElement* aSource,
// RFC 2388 specifies that RFC 2047 be used, but I think it's not // RFC 2388 specifies that RFC 2047 be used, but I think it's not
// consistent with MIME standard. // consistent with MIME standard.
mPostDataChunk += NS_LITERAL_CSTRING("--") + mBoundary mPostDataChunk += NS_LITERAL_CSTRING("--") + mBoundary
+ NS_LITERAL_CSTRING(CRLF)
+ NS_LITERAL_CSTRING("Content-Type: text/plain; charset=")
+ mCharset
+ NS_LITERAL_CSTRING(CRLF) + NS_LITERAL_CSTRING(CRLF)
+ NS_LITERAL_CSTRING("Content-Disposition: form-data; name=\"") + NS_LITERAL_CSTRING("Content-Disposition: form-data; name=\"")
+ nameStr + NS_LITERAL_CSTRING("\"" CRLF CRLF) + nameStr + NS_LITERAL_CSTRING("\"" CRLF CRLF)
@ -1161,6 +1164,9 @@ GetSubmissionFromForm(nsGenericHTMLElement* aForm,
nsCOMPtr<nsISaveAsCharset> encoder; nsCOMPtr<nsISaveAsCharset> encoder;
nsFormSubmission::GetEncoder(aForm, charset, getter_AddRefs(encoder)); nsFormSubmission::GetEncoder(aForm, charset, getter_AddRefs(encoder));
if (!encoder)
charset.AssignLiteral("UTF-8");
// Get form processor // Get form processor
nsCOMPtr<nsIFormProcessor> formProcessor = nsCOMPtr<nsIFormProcessor> formProcessor =
do_GetService(kFormProcessorCID, &rv); do_GetService(kFormProcessorCID, &rv);