Apache 卷曲挂在“上”;没有区块,没有闭合,没有大小。假设接近信号端“;

Apache 卷曲挂在“上”;没有区块,没有闭合,没有大小。假设接近信号端“;,apache,curl,tcp,Apache,Curl,Tcp,使用此命令流式上载到Apache/PHP服务器时 curl -X POST \ -i --data-binary @customfile.app \ -H "Transfer-Encoding: chunked" \ -H "Content-Type: application/app" \ -H "X-CustomHeader1: customvalue1" \ -H "X-CustomHeader2: customvalue2" \ -H "X-CustomHeader3: customval

使用此命令流式上载到Apache/PHP服务器时

curl -X POST \
-i --data-binary @customfile.app \
-H "Transfer-Encoding: chunked" \
-H "Content-Type: application/app" \
-H "X-CustomHeader1: customvalue1" \
-H "X-CustomHeader2: customvalue2" \
-H "X-CustomHeader3: customvalue3" \
-H "X-CustomHeader4: customvalue4" \
-H "X-CustomHeader5: customvalue5" \
-H "X-CustomHeader6: customvalue6" \
--ignore-content-length \
--progress-bar -vvv \
http://[DOMAIN]/upload.php
命令挂起,如下所示:

* Hostname was NOT found in DNS cache
*   Trying [IP_ADDRESS]...
* Connected to [DOMAIN] ([IP_ADDRESS]) port 80 (#0)
> POST /upload.php HTTP/1.1
> User-Agent: curl/7.37.1
> Host: [DOMAIN]
> Accept: */*
> Transfer-Encoding: chunked
> Content-Type: application/app
> X-CustomHeader1: customvalue1
> X-CustomHeader2: customvalue2
> X-CustomHeader3: customvalue3
> X-CustomHeader4: customvalue4
> X-CustomHeader5: customvalue5
> X-CustomHeader6: customvalue6
> Expect: 100-continue
>
< HTTP/1.1 100 Continue
HTTP/1.1 100 Continue

< HTTP/1.1 200 OK
HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
Content-Type: text/html; charset=UTF-8
< Date: Thu, 12 Feb 2015 11:10:17 GMT
Date: Thu, 12 Feb 2015 11:10:17 GMT
* Server Apache is not blacklisted
< Server: Apache
Server: Apache
< Vary: Content-Type
Vary: Content-Type
< Content-Length: 0
Content-Length: 0
< Connection: keep-alive
Connection: keep-alive
* no chunk, no close, no size. Assume close to signal end

<
在DNS缓存中找不到主机名 *正在尝试[IP\U地址]。。。 *已连接到[域]([IP_地址])端口80(#0) >POST/upload.php HTTP/1.1 >用户代理:curl/7.37.1 >主机:[域] >接受:*/* >传输编码:分块 >内容类型:应用程序/应用程序 >X-CustomHeader1:customvalue1 >X-CustomHeader2:customvalue2 >X-CustomHeader3:customvalue3 >X-CustomHeader4:customvalue4 >X-CustomHeader5:customvalue5 >X-CustomHeader6:customvalue6 >预期:100人继续 > 现在,当
没有区块、没有关闭、没有大小时。假设出现接近信号结束
的消息,我对本地文件和服务器文件进行校验和,以证明它们是相同的。这意味着文件已成功上载,但由于某些原因,连接未关闭


这是为什么?我该如何解决?上传完整个文件后,我能告诉cURL关闭连接吗?谢谢

您特别告诉curl忽略服务器设置的内容长度。因此,将假定响应结束时连接已关闭。但是服务器没有关闭,因为它等待更多的请求


除此之外:我不认为您可以添加“Transfer Encoding:chunked”作为自定义头。仅仅告诉服务器内容将以块的形式发送是不够的,但是curl实际上必须使用块编码,而它可能没有使用块编码。

当JSP页面发生这种情况时,我遇到了一个有趣的例子

刷新新行有助于:

<%
    out.println("");
    out.flush();
%>

删除
--忽略内容长度
谢谢。它最初是在实验/学习如何上传PHP以作为流接收时放在那里的。