[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
mjs
mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 08:14:19 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 8f9d52f170416b69930054c79d6971b9b6181308
Author: mjs <mjs at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Nov 20 22:45:40 2003 +0000
Reviewed by Ken.
- fixed 3490086 - support http post for XMLHttpRequest
* kwq/KWQKJobClasses.h:
* kwq/KWQKJobClasses.mm:
(KIO::TransferJobPrivate::TransferJobPrivate):
(KIO::TransferJob::TransferJob):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a2546c6..48b6d1f 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,14 @@
+2003-11-19 Maciej Stachowiak <mjs at apple.com>
+
+ Reviewed by Ken.
+
+ - fixed 3490086 - support http post for XMLHttpRequest
+
+ * kwq/KWQKJobClasses.h:
+ * kwq/KWQKJobClasses.mm:
+ (KIO::TransferJobPrivate::TransferJobPrivate):
+ (KIO::TransferJob::TransferJob):
+
2003-11-20 Richard Williamson <rjw at apple.com>
Cleaned up synchronous applet lookup and initialization.
diff --git a/WebCore/khtml/ecma/xmlhttprequest.cpp b/WebCore/khtml/ecma/xmlhttprequest.cpp
index d5a53b2..01e5999 100644
--- a/WebCore/khtml/ecma/xmlhttprequest.cpp
+++ b/WebCore/khtml/ecma/xmlhttprequest.cpp
@@ -175,7 +175,9 @@ XMLHttpRequest::XMLHttpRequest(ExecState *exec, const DOM::Document &d)
XMLHttpRequest::~XMLHttpRequest()
{
- delete decoder;
+ if (decoder) {
+ decoder->deref();
+ }
}
void XMLHttpRequest::changeState(XMLHttpRequestState newState)
@@ -203,6 +205,7 @@ void XMLHttpRequest::open(const QString& _method, const KURL& _url, bool _async)
void XMLHttpRequest::send(const QString& _body)
{
if (method.lower() == "post" && (url.protocol().lower() == "http" || url.protocol().lower() == "https") ) {
+ // FIXME: determine post encoding correctly by looking in headers for charset
job = KIO::http_post( url, QCString(_body.utf8()), false );
job->addMetaData("content-type", "text/plain" );
}
@@ -234,8 +237,17 @@ void XMLHttpRequest::send(const QString& _body)
void XMLHttpRequest::slotFinished(KIO::Job *)
{
+ if (decoder) {
+ response += decoder->flush();
+ }
+
changeState(Completed);
job = 0;
+
+ if (decoder) {
+ decoder->deref();
+ decoder = 0;
+ }
}
void XMLHttpRequest::slotRedirection(KIO::Job*, const KURL& url)
@@ -274,9 +286,6 @@ void XMLHttpRequest::slotData(KIO::Job*, const QByteArray &_data)
QString decoded = decoder->decode(data, len);
- if (decoded.isEmpty())
- return;
-
response += decoded;
changeState(Interactive);
diff --git a/WebCore/kwq/KWQKJobClasses.h b/WebCore/kwq/KWQKJobClasses.h
index f59d8ea..11f0f12 100644
--- a/WebCore/kwq/KWQKJobClasses.h
+++ b/WebCore/kwq/KWQKJobClasses.h
@@ -73,6 +73,8 @@ public:
void emitResult();
void emitReceivedResponse(void *);
+ QByteArray postData() const;
+ QString method() const;
private:
TransferJobPrivate *d;
diff --git a/WebCore/kwq/KWQKJobClasses.mm b/WebCore/kwq/KWQKJobClasses.mm
index 693aac2..e31deda 100644
--- a/WebCore/kwq/KWQKJobClasses.mm
+++ b/WebCore/kwq/KWQKJobClasses.mm
@@ -40,11 +40,22 @@ namespace KIO {
class TransferJobPrivate
{
public:
- TransferJobPrivate(const KURL &kurl)
+ TransferJobPrivate(const KURL& kurl)
: status(0)
, metaData([[NSMutableDictionary alloc] initWithCapacity:17])
- , URL(kurl)
- , loader(nil)
+ , URL(kurl)
+ , loader(nil)
+ , method("GET")
+ {
+ }
+
+ TransferJobPrivate(const KURL& kurl, const QByteArray &_postData)
+ : status(0)
+ , metaData([[NSMutableDictionary alloc] initWithCapacity:17])
+ , URL(kurl)
+ , loader(nil)
+ , method("POST")
+ , postData(_postData)
{
}
@@ -58,6 +69,8 @@ public:
NSMutableDictionary *metaData;
KURL URL;
KWQResourceLoader *loader;
+ QString method;
+ QByteArray postData;
};
TransferJob::TransferJob(const KURL &url, bool reload, bool showProgressInfo)
@@ -70,7 +83,7 @@ TransferJob::TransferJob(const KURL &url, bool reload, bool showProgressInfo)
}
TransferJob::TransferJob(const KURL &url, const QByteArray &postData, bool showProgressInfo)
- : d(new TransferJobPrivate(url)),
+ : d(new TransferJobPrivate(url, postData)),
m_data(this, SIGNAL(data(KIO::Job*, const char*, int))),
m_redirection(this, SIGNAL(redirection(KIO::Job*, const KURL&))),
m_result(this, SIGNAL(result(KIO::Job*))),
@@ -146,6 +159,16 @@ KURL TransferJob::url() const
return d->URL;
}
+QByteArray TransferJob::postData() const
+{
+ return d->postData;
+}
+
+QString TransferJob::method() const
+{
+ return d->method;
+}
+
void TransferJob::emitData(const char *data, int size)
{
m_data.call(this, data, size);
diff --git a/WebCore/kwq/KWQLoader.mm b/WebCore/kwq/KWQLoader.mm
index c77388c..ec09840 100644
--- a/WebCore/kwq/KWQLoader.mm
+++ b/WebCore/kwq/KWQLoader.mm
@@ -59,7 +59,15 @@ bool KWQServeRequest(Loader *loader, DocLoader *docLoader, TransferJob *job)
KWQ_BLOCK_EXCEPTIONS;
KWQResourceLoader *resourceLoader = [[KWQResourceLoader alloc] initWithJob:job];
- id <WebCoreResourceHandle> handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL()];
+
+ id <WebCoreResourceHandle> handle;
+
+ if (job->method() == "POST") {
+ NSData *postData = [NSData dataWithBytesNoCopy:job->postData().data() length:job->postData().size() freeWhenDone:NO];
+ handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL() postData:postData];
+ } else {
+ handle = [bridge startLoadingResource:resourceLoader withURL:job->url().getNSURL()];
+ }
[resourceLoader setHandle:handle];
[resourceLoader release];
return handle != nil;
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 3a85116..864873c 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -291,6 +291,7 @@ typedef enum {
- (BOOL)runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText returningText:(NSString **)result;
- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL;
+- (id <WebCoreResourceHandle>)startLoadingResource:(id <WebCoreResourceLoader>)loader withURL:(NSURL *)URL postData:(NSData *)data;
- (void)objectLoadedFromCacheWithURL:(NSURL *)URL response:(id)response size:(unsigned)bytes;
- (BOOL)isReloading;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list