Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: Source/core/xml/XMLHttpRequest.cpp

Issue 22601002: Correct the default Content-Type for XHR Post with string data as per XHR specification. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « LayoutTests/platform/win/http/tests/xmlhttprequest/workers/methods-async-expected.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 } 587 }
588 588
589 void XMLHttpRequest::send(const String& body, ExceptionCode& ec) 589 void XMLHttpRequest::send(const String& body, ExceptionCode& ec)
590 { 590 {
591 if (!initSend(ec)) 591 if (!initSend(ec))
592 return; 592 return;
593 593
594 if (!body.isNull() && areMethodAndURLValidForSend()) { 594 if (!body.isNull() && areMethodAndURLValidForSend()) {
595 String contentType = getRequestHeader("Content-Type"); 595 String contentType = getRequestHeader("Content-Type");
596 if (contentType.isEmpty()) { 596 if (contentType.isEmpty()) {
597 setRequestHeaderInternal("Content-Type", "application/xml"); 597 setRequestHeaderInternal("Content-Type", "text/plain;charset=UTF-8") ;
598 } else { 598 } else {
599 replaceCharsetInMediaType(contentType, "UTF-8"); 599 replaceCharsetInMediaType(contentType, "UTF-8");
600 m_requestHeaders.set("Content-Type", contentType); 600 m_requestHeaders.set("Content-Type", contentType);
601 } 601 }
602 602
603 m_requestEntityBody = FormData::create(UTF8Encoding().normalizeAndEncode (body, WTF::EntitiesForUnencodables)); 603 m_requestEntityBody = FormData::create(UTF8Encoding().normalizeAndEncode (body, WTF::EntitiesForUnencodables));
604 if (m_upload) 604 if (m_upload)
605 m_requestEntityBody->setAlwaysStream(true); 605 m_requestEntityBody->setAlwaysStream(true);
606 } 606 }
607 607
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
1249 { 1249 {
1250 return &m_eventTargetData; 1250 return &m_eventTargetData;
1251 } 1251 }
1252 1252
1253 EventTargetData* XMLHttpRequest::ensureEventTargetData() 1253 EventTargetData* XMLHttpRequest::ensureEventTargetData()
1254 { 1254 {
1255 return &m_eventTargetData; 1255 return &m_eventTargetData;
1256 } 1256 }
1257 1257
1258 } // namespace WebCore 1258 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/platform/win/http/tests/xmlhttprequest/workers/methods-async-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698