带有XML附件上载的CURL'POST'在Linux下失败但在Windows中有效

时间:2016-04-29 05:37:46

标签: xml shell curl

我一直无法找到在Windows下运行的CURL命令(在Linux中),但在Linux下运行时失败。

您可以在下面看到curl POST命令的成绩单,该命令成功上载Windows下的XML文件附件,但出现以下错误:

  • 额外的东西不精细transfer.c:1037:0 0

在Linux下运行时。

我已尝试删除命令的contentXml = @部分的; type = text / xml后缀,但这没有任何区别。我还尝试使用Chrome的“检查元素”来监控HTML表单中的相同内容,但输出表单没有帮助。

我觉得我错过了一件小事(必不可少的!)。有没有人对我遗失的东西有任何建议?

真诚地感谢任何帮助。

-----WINDOWS--WORKS--OK------

C:\Users\>curl -k -v -X POST -F "contentName=spotlight" -F "unityRemoteUsername=aaa" -F "unityRemotePassword=aaa" -F " contentXml=@outputSpotlights.xml;type=text/xml" -F "contentXmlFileAction=upload" "https://www.example.com/admin.aspx?a=content.uploadxmlprocess&unityRemoteRequest=1" >log-spotlight_01.txt

* Adding handle: conn: 0x1d6aea0
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x1d6aea0) send_pipe: 1, recv_pipe: 0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*
About to connect() to www.example.com port 443 (#0)
*   Trying 111.222.33.444...
* Connected to www.example.com (111.222.33.444) port 443 (#0)
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
*        subject: OU=Domain Control Validated; OU=Hosted by; O
U=COMODO SSL; CN=www.example.com
*        start date: 2013
*        expire date: 2016
*        issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN
=COMODO RSA Domain Validation Secure Server CA
*        SSL certificate verify result: self signed certificate in certificate c
hain (19), continuing anyway.
> POST /admin.aspx?a=content.uploadxmlprocess&unityRemoteRequest=1 HTTP/1.1
> User-Agent: curl/7.32.0
> Host: www.example.com
> Accept: */*
> Content-Length: 1894
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------b4a30d5f4f
02e40b
>
< HTTP/1.1 100 Continue
} [data not shown]
< HTTP/1.1 200 OK
< Cache-Control: private
< Content-Type: text/xml; charset=utf-8
* Server Microsoft-IIS/8.0 is not blacklisted
< Server: Microsoft-IIS/8.0
< Set-Cookie: ASP.NET_SessionId=myp1fxahmvil4p450mlkvy55; path=/; HttpOnly
< X-AspNet-Version: 2.0.50727
< X-Server-Name: www.example.com
< X-Powered-By: ASP.NET
< Date: Fri, 29 Apr 2016 05:01:55 GMT
< Content-Length: 4804
< Set-Cookie: DCW=!YurETMEX+uJDlGsjwPb80U37Lbn8yAZFhJDfC3k/kBCRszzy7sdlEoNLnqW2U
U6om/d+TTG8sc+WQaQ=; path=/
< Vary: Accept-Encoding
<
{ [data not shown]
100  6698  100  4804  100  1894   8798   3468 --:--:-- --:--:-- --:--:--  8798
* Connection #0 to host www.example.com left intact

C:\Users\>




----LINUX---FAILS----

me@LINUX:~/xml/$ curl -k -v -X POST -F "contentName=spotlight" -F "unityRemoteUsername=aaa" -F "unityRemotePassword=bbb" -F "contentXml=@outputSpotlights.xml;type=text/xml" -F "contentXmlFileAction=upload" "https://www.example.com/admin.aspx?a=content.uploadxmlprocess&unityRemoteRequest=1" >log-spotlight_01.txt
* About to connect() to www.example.com port 443 (#0)
*   Trying 111.222.33.444...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* connected
* Connected to www.example.com (111.222.33.444) port 443 (#0)
* successfully set certificate verify locations:
*   CAfile: none
  CApath: /etc/ssl/certs
* SSLv3, TLS handshake, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Server hello (2):
{ [data not shown]
* SSLv3, TLS handshake, CERT (11):
{ [data not shown]
* SSLv3, TLS handshake, Server key exchange (12):
{ [data not shown]
* SSLv3, TLS handshake, Server finished (14):
{ [data not shown]
* SSLv3, TLS handshake, Client key exchange (16):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
} [data not shown]
* SSLv3, TLS handshake, Finished (20):
} [data not shown]
* SSLv3, TLS change cipher, Client hello (1):
{ [data not shown]
* SSLv3, TLS handshake, Finished (20):
{ [data not shown]
* SSL connection using DHE-RSA-AES256-GCM-SHA384
* Server certificate:
*        subject: OU=Domain Control Validated; OU=Hosted by ; OU=COMODO SSL; CN=www.example.com
*        start date: 2013
*        expire date: 2016
*        issuer: C=GB; ST=Greater Manchester; L=Salford; O=COMODO CA Limited; CN=COMODO RSA Domain Validation Secure Server CA
*        SSL certificate verify ok.
> POST /admin.aspx?a=content.uploadxmlprocess&unityRemoteRequest=1 HTTP/1.1
> User-Agent: curl/7.26.0
> Host: www.example.com
> Accept: */*
> Content-Length: 1840
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=----------------------------b59711af552e
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 100 Continue
  0  1840    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* additional stuff not fine transfer.c:1037: 0 0
} [data not shown]
* additional stuff not fine transfer.c:1037: 0 0
} [data not shown]
* additional stuff not fine transfer.c:1037: 0 0
} [data not shown]
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Cache-Control: private
< Content-Type: text/xml; charset=utf-8
< Server: Microsoft-IIS/8.0
< X-AspNet-Version: 2.0.50727
< X-Server-Name: www.example.com
< X-Powered-By: ASP.NET
< Date: Fri, 29 Apr 2016 05:02:22 GMT
< Content-Length: 100
< Set-Cookie: DCW=!QdorcUlrlaR+qA4jwPb80U37Lbn8yDOhcW/oNikxhZm8kVcjfFQuS+kjHbekv0xdGtQM5pDBv2UgMNA=; path=/
<
{ [data not shown]
100  1940  100   100  100  1840    354   6527 --:--:-- --:--:-- --:--:--  7389
* Connection #0 to host www.example.com left intact
* Closing connection #0
* SSLv3, TLS alert, Client hello (1):
} [data not shown]

me@LINUX:~/xml/

0 个答案:

没有答案