diff --git a/lime/_backend/html5/HTML5HTTPRequest.hx b/lime/_backend/html5/HTML5HTTPRequest.hx
index 523c7f632..e6a18b675 100644
--- a/lime/_backend/html5/HTML5HTTPRequest.hx
+++ b/lime/_backend/html5/HTML5HTTPRequest.hx
@@ -63,11 +63,17 @@ class HTML5HTTPRequest {
private function load (uri:String, progress:Dynamic, readyStateChange:Dynamic):Void {
request = new XMLHttpRequest ();
- if(parent.method == POST) {
+
+ if (parent.method == POST) {
+
request.upload.addEventListener ("progress", progress, false);
+
} else {
+
request.addEventListener ("progress", progress, false);
+
}
+
request.onreadystatechange = readyStateChange;
var query = "";
@@ -155,6 +161,12 @@ class HTML5HTTPRequest {
}
+ if (parent.withCredentials) {
+
+ request.withCredentials = true;
+
+ }
+
if (parent.data != null) {
request.send (parent.data.getData ());
diff --git a/lime/_backend/native/NativeHTTPRequest.hx b/lime/_backend/native/NativeHTTPRequest.hx
index b77605c27..089554dc0 100644
--- a/lime/_backend/native/NativeHTTPRequest.hx
+++ b/lime/_backend/native/NativeHTTPRequest.hx
@@ -127,7 +127,6 @@ class NativeHTTPRequest {
bytesTotal = 0;
readPosition = 0;
writePosition = 0;
-
if (curl == null) {
@@ -268,6 +267,14 @@ class NativeHTTPRequest {
}
+ // TODO: Add support for cookies: https://curl.haxx.se/docs/http-cookies.html
+
+ if (parent.withCredentials) {
+
+ // TODO: Send cookies with request
+
+ }
+
curl.setOption (SSL_VERIFYPEER, false);
curl.setOption (SSL_VERIFYHOST, 0);
curl.setOption (USERAGENT, parent.userAgent == null ? "libcurl-agent/1.0" : parent.userAgent);
diff --git a/lime/net/HTTPRequest.hx b/lime/net/HTTPRequest.hx
index ae4495199..feeaba55a 100644
--- a/lime/net/HTTPRequest.hx
+++ b/lime/net/HTTPRequest.hx
@@ -40,6 +40,7 @@ private class AbstractHTTPRequest implements _IHTTPRequest {
public var timeout:Int;
public var uri:String;
public var userAgent:String;
+ public var withCredentials:Bool;
#if !display
private var backend:HTTPRequestBackend;
@@ -57,6 +58,7 @@ private class AbstractHTTPRequest implements _IHTTPRequest {
headers = [];
method = GET;
timeout = 30000;
+ withCredentials = false;
#if !display
backend = new HTTPRequestBackend ();
@@ -188,6 +190,7 @@ interface _IHTTPRequest {
public var timeout:Int;
public var uri:String;
public var userAgent:String;
+ public var withCredentials:Bool;
public function cancel ():Void;