浏览代码

automatically set Content-Length when postData is set (fixed issue #908)

Nicolas Cannasse 13 年之前
父节点
当前提交
934eac4376
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      std/haxe/Http.hx

+ 3 - 1
std/haxe/Http.hx

@@ -362,7 +362,9 @@ class Http {
 			b.add(uri);
 		}
 		b.add(" HTTP/1.1\r\nHost: "+host+"\r\n");
-		if( postData == null && post && uri != null ) {
+		if( postData != null )
+			b.add("Content-Length: "+postData.length+"\r\n");
+		else if( post && uri != null ) {
 			if( multipart || headers.get("Content-Type") == null ) {
 				b.add("Content-Type: ");
 				if( multipart ) {