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 David Levin <levin@chromium.org> | 5 * Copyright (C) 2008 David Levin <levin@chromium.org> |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Lesser General Public | 8 * modify it under the terms of the GNU Lesser General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 471 |
472 void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) | 472 void XMLHttpRequest::send(Blob* body, ExceptionCode& ec) |
473 { | 473 { |
474 if (!initSend(ec)) | 474 if (!initSend(ec)) |
475 return; | 475 return; |
476 | 476 |
477 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily())
{ | 477 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily())
{ |
478 // FIXME: Should we set a Content-Type if one is not set. | 478 // FIXME: Should we set a Content-Type if one is not set. |
479 // FIXME: add support for uploading bundles. | 479 // FIXME: add support for uploading bundles. |
480 m_requestEntityBody = FormData::create(); | 480 m_requestEntityBody = FormData::create(); |
481 #if ENABLE(BLOB_SLICE) | 481 m_requestEntityBody->appendItems(body->items()); |
482 m_requestEntityBody->appendFileRange(body->path(), body->start(), body->
length(), body->modificationTime()); | |
483 #else | |
484 m_requestEntityBody->appendFile(body->path(), false); | |
485 #endif | |
486 } | 482 } |
487 | 483 |
488 createRequest(ec); | 484 createRequest(ec); |
489 } | 485 } |
490 | 486 |
491 void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) | 487 void XMLHttpRequest::send(DOMFormData* body, ExceptionCode& ec) |
492 { | 488 { |
493 if (!initSend(ec)) | 489 if (!initSend(ec)) |
494 return; | 490 return; |
495 | 491 |
496 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily())
{ | 492 if (m_method != "GET" && m_method != "HEAD" && m_url.protocolInHTTPFamily())
{ |
497 m_requestEntityBody = FormData::createMultiPart(*body, document()); | 493 m_requestEntityBody = FormData::createMultiPart(body->items(), body->enc
oding(), document()); |
498 | 494 |
499 // We need to ask the client to provide the generated file names if need
ed. When FormData fills the element | 495 // We need to ask the client to provide the generated file names if need
ed. When FormData fills the element |
500 // for the file, it could set a flag to use the generated file name, i.e
. a package file on Mac. | 496 // for the file, it could set a flag to use the generated file name, i.e
. a package file on Mac. |
501 m_requestEntityBody->generateFiles(document()); | 497 m_requestEntityBody->generateFiles(document()); |
502 | 498 |
503 String contentType = getRequestHeader("Content-Type"); | 499 String contentType = getRequestHeader("Content-Type"); |
504 if (contentType.isEmpty()) { | 500 if (contentType.isEmpty()) { |
505 contentType = "multipart/form-data; boundary="; | 501 contentType = "multipart/form-data; boundary="; |
506 contentType += m_requestEntityBody->boundary().data(); | 502 contentType += m_requestEntityBody->boundary().data(); |
507 setRequestHeaderInternal("Content-Type", contentType); | 503 setRequestHeaderInternal("Content-Type", contentType); |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1025 { | 1021 { |
1026 return &m_eventTargetData; | 1022 return &m_eventTargetData; |
1027 } | 1023 } |
1028 | 1024 |
1029 EventTargetData* XMLHttpRequest::ensureEventTargetData() | 1025 EventTargetData* XMLHttpRequest::ensureEventTargetData() |
1030 { | 1026 { |
1031 return &m_eventTargetData; | 1027 return &m_eventTargetData; |
1032 } | 1028 } |
1033 | 1029 |
1034 } // namespace WebCore | 1030 } // namespace WebCore |
OLD | NEW |