| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> | 3 * Copyright (C) 2005-2007 Alexey Proskuryakov <ap@webkit.org> |
| 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> | 4 * Copyright (C) 2007, 2008 Julien Chaffraix <jchaffraix@webkit.org> |
| 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. | 5 * Copyright (C) 2008, 2011 Google Inc. All rights reserved. |
| 6 * Copyright (C) 2012 Intel Corporation | 6 * Copyright (C) 2012 Intel Corporation |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 if (contentType.isEmpty()) { | 566 if (contentType.isEmpty()) { |
| 567 // FIXME: this should include the charset used for encoding. | 567 // FIXME: this should include the charset used for encoding. |
| 568 setRequestHeaderInternal("Content-Type", "application/xml"); | 568 setRequestHeaderInternal("Content-Type", "application/xml"); |
| 569 } | 569 } |
| 570 | 570 |
| 571 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum
ent.innerHTML algorithm | 571 // FIXME: According to XMLHttpRequest Level 2, this should use the Docum
ent.innerHTML algorithm |
| 572 // from the HTML5 specification to serialize the document. | 572 // from the HTML5 specification to serialize the document. |
| 573 String body = createMarkup(document); | 573 String body = createMarkup(document); |
| 574 | 574 |
| 575 // FIXME: This should use value of document.inputEncoding to determine t
he encoding to use. | 575 // FIXME: This should use value of document.inputEncoding to determine t
he encoding to use. |
| 576 m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF::
EntitiesForUnencodables)); | 576 m_requestEntityBody = FormData::create(UTF8Encoding().normalizeAndEncode
(body, WTF::EntitiesForUnencodables)); |
| 577 if (m_upload) | 577 if (m_upload) |
| 578 m_requestEntityBody->setAlwaysStream(true); | 578 m_requestEntityBody->setAlwaysStream(true); |
| 579 } | 579 } |
| 580 | 580 |
| 581 createRequest(ec); | 581 createRequest(ec); |
| 582 } | 582 } |
| 583 | 583 |
| 584 void XMLHttpRequest::send(const String& body, ExceptionCode& ec) | 584 void XMLHttpRequest::send(const String& body, ExceptionCode& ec) |
| 585 { | 585 { |
| 586 if (!initSend(ec)) | 586 if (!initSend(ec)) |
| 587 return; | 587 return; |
| 588 | 588 |
| 589 if (!body.isNull() && m_method != "GET" && m_method != "HEAD" && m_url.proto
colIsInHTTPFamily()) { | 589 if (!body.isNull() && m_method != "GET" && m_method != "HEAD" && m_url.proto
colIsInHTTPFamily()) { |
| 590 String contentType = getRequestHeader("Content-Type"); | 590 String contentType = getRequestHeader("Content-Type"); |
| 591 if (contentType.isEmpty()) { | 591 if (contentType.isEmpty()) { |
| 592 setRequestHeaderInternal("Content-Type", "application/xml"); | 592 setRequestHeaderInternal("Content-Type", "application/xml"); |
| 593 } else { | 593 } else { |
| 594 replaceCharsetInMediaType(contentType, "UTF-8"); | 594 replaceCharsetInMediaType(contentType, "UTF-8"); |
| 595 m_requestHeaders.set("Content-Type", contentType); | 595 m_requestHeaders.set("Content-Type", contentType); |
| 596 } | 596 } |
| 597 | 597 |
| 598 m_requestEntityBody = FormData::create(UTF8Encoding().encode(body, WTF::
EntitiesForUnencodables)); | 598 m_requestEntityBody = FormData::create(UTF8Encoding().normalizeAndEncode
(body, WTF::EntitiesForUnencodables)); |
| 599 if (m_upload) | 599 if (m_upload) |
| 600 m_requestEntityBody->setAlwaysStream(true); | 600 m_requestEntityBody->setAlwaysStream(true); |
| 601 } | 601 } |
| 602 | 602 |
| 603 createRequest(ec); | 603 createRequest(ec); |
| 604 } | 604 } |
| 605 | 605 |
| 606 void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) | 606 void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) |
| 607 { | 607 { |
| 608 if (!initSend(ec)) | 608 if (!initSend(ec)) |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 { | 1242 { |
| 1243 return &m_eventTargetData; | 1243 return &m_eventTargetData; |
| 1244 } | 1244 } |
| 1245 | 1245 |
| 1246 EventTargetData* XMLHttpRequest::ensureEventTargetData() | 1246 EventTargetData* XMLHttpRequest::ensureEventTargetData() |
| 1247 { | 1247 { |
| 1248 return &m_eventTargetData; | 1248 return &m_eventTargetData; |
| 1249 } | 1249 } |
| 1250 | 1250 |
| 1251 } // namespace WebCore | 1251 } // namespace WebCore |
| OLD | NEW |