mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Remove unnecessary steps from "multipart/form-data encoding algorithm"
The specifications for the "multipart/form-data encoding algorithm" has
changed [1], and the "_charset_" is not now handled here.
Remove no longer necessary steps from the "multipart/form-data encoding
algorithm".
Similar to the "text/plain encoding algorithm" case fixed by f0818aa3
(Remove unnecessary steps from "text/plain encoding algorithm").
[1]: https://github.com/whatwg/html/pull/3645
Signed-off-by: Yutaro Ohno <yutaro.ono.418@gmail.com>
This commit is contained in:
parent
cfef75c99b
commit
f7449da485
1 changed files with 3 additions and 9 deletions
|
@ -1744,17 +1744,10 @@ pub fn encode_multipart_form_data(
|
|||
let mut result = vec![];
|
||||
|
||||
// Step 2
|
||||
let charset = encoding.name();
|
||||
|
||||
// Step 3
|
||||
for entry in form_data.iter_mut() {
|
||||
// 3.1
|
||||
if entry.name.to_ascii_lowercase() == "_charset_" && entry.ty == "hidden" {
|
||||
entry.value = FormDatumValue::String(DOMString::from(charset.clone()));
|
||||
}
|
||||
// TODO: 3.2
|
||||
// TODO: Step 2.1
|
||||
|
||||
// Step 4
|
||||
// Step 3
|
||||
// https://tools.ietf.org/html/rfc7578#section-4
|
||||
// NOTE(izgzhen): The encoding here expected by most servers seems different from
|
||||
// what spec says (that it should start with a '\r\n').
|
||||
|
@ -1772,6 +1765,7 @@ pub fn encode_multipart_form_data(
|
|||
result.append(&mut bytes);
|
||||
},
|
||||
FormDatumValue::File(ref f) => {
|
||||
let charset = encoding.name();
|
||||
let extra = if charset.to_lowercase() == "utf-8" {
|
||||
format!(
|
||||
"filename=\"{}\"",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue