OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 { | 65 { |
66 String body = data.flattenToString(); | 66 String body = data.flattenToString(); |
67 | 67 |
68 if (equalIgnoringCase(encodingType, "text/plain")) { | 68 if (equalIgnoringCase(encodingType, "text/plain")) { |
69 // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are enc
oded as %20. | 69 // Convention seems to be to decode, and s/&/\r\n/. Also, spaces are enc
oded as %20. |
70 body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', '
') + "\r\n"); | 70 body = decodeURLEscapeSequences(body.replace('&', "\r\n").replace('+', '
') + "\r\n"); |
71 } | 71 } |
72 | 72 |
73 Vector<char> bodyData; | 73 Vector<char> bodyData; |
74 bodyData.append("body=", 5); | 74 bodyData.append("body=", 5); |
75 FormDataEncoder::encodeStringAsFormData(bodyData, body.utf8()); | 75 FormDataEncoder::encodeStringAsFormData(bodyData, body.utf8(), FormDataEncod
er::NormalizeCRLF); |
76 body = String(bodyData.data(), bodyData.size()).replace('+', "%20"); | 76 body = String(bodyData.data(), bodyData.size()).replace('+', "%20"); |
77 | 77 |
78 StringBuilder query; | 78 StringBuilder query; |
79 query.append(url.query()); | 79 query.append(url.query()); |
80 if (!query.isEmpty()) | 80 if (!query.isEmpty()) |
81 query.append('&'); | 81 query.append('&'); |
82 query.append(body); | 82 query.append(body); |
83 url.setQuery(query.toString()); | 83 url.setQuery(query.toString()); |
84 } | 84 } |
85 | 85 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 if (m_boundary.isEmpty()) | 283 if (m_boundary.isEmpty()) |
284 frameRequest.resourceRequest().setHTTPContentType(m_contentType); | 284 frameRequest.resourceRequest().setHTTPContentType(m_contentType); |
285 else | 285 else |
286 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); | 286 frameRequest.resourceRequest().setHTTPContentType(m_contentType + ";
boundary=" + m_boundary); |
287 } | 287 } |
288 | 288 |
289 frameRequest.resourceRequest().setURL(requestURL()); | 289 frameRequest.resourceRequest().setURL(requestURL()); |
290 } | 290 } |
291 | 291 |
292 } // namespace blink | 292 } // namespace blink |
OLD | NEW |