Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-cloud-platform/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Curl上传到Google/Shopify失败,出现400错误和';格式错误的多部分正文';_Curl_Google Cloud Platform_Shopify_Multipartform Data_Gltf - Fatal编程技术网

Curl上传到Google/Shopify失败,出现400错误和';格式错误的多部分正文';

Curl上传到Google/Shopify失败,出现400错误和';格式错误的多部分正文';,curl,google-cloud-platform,shopify,multipartform-data,gltf,Curl,Google Cloud Platform,Shopify,Multipartform Data,Gltf,我正试图上传一个glb文件到Shopify使用谷歌通过卷曲。我通过GraphQL在Google上生成一个占位符url,然后使用curl上传到这个临时url。当我使用另一个GraphQLAPI帖子将图像链接到Shopify时,Shopify说“你的一些媒体无法上传” 我从这个答案中获取了一些标题,以启用此文件的多部分上载: 以下是主要用于视频的Shopify说明: 我得到一个400错误,但它显示所有内容都已上载,但对于1.7 MB的文件,上载时间为1秒。我想我的网速很快,但如果出现400错误,

我正试图上传一个glb文件到Shopify使用谷歌通过卷曲。我通过GraphQL在Google上生成一个占位符url,然后使用curl上传到这个临时url。当我使用另一个GraphQLAPI帖子将图像链接到Shopify时,Shopify说“你的一些媒体无法上传”

我从这个答案中获取了一些标题,以启用此文件的多部分上载:

以下是主要用于视频的Shopify说明:

我得到一个400错误,但它显示所有内容都已上载,但对于1.7 MB的文件,上载时间为1秒。我想我的网速很快,但如果出现400错误,所有东西是如何上传的呢

我注意到Content-Length值大于X-Upload-Content-Length值(使用Python getsize()在文件本身上测量),这与文件系统和上载显示中列出的文件大小不同

这是我的curl字符串(在python中):

bashCommand=''curl-v-H'Accept:application/json“-H”Content Type:multipart/form data“-H”x-upload-Content-Type:application/octet stream“-H”x-upload-Content-Length:{}“-F”GoogleAccessID={}“-F”key={}“-F”policy={}“-F”签名={}“-F”签名={}”-F文件=@{}}{}}''.format(文件大小、谷歌访问id、密钥、策略、签名、glb路径、url)
这是详细的输出:

> Host: storage.googleapis.com
> User-Agent: curl/7.55.1
> Accept: */*
> "Accept:application/json"
> "Content-Type:multipart/form-data"
> "x-upload-content-type:application/octet-stream"
> "X-Upload-Content-Length:1800252"
> Content-Length: 1801555
> Expect: 100-continue
> Content-Type: multipart/form-data; boundary=------------------------086d33ba0b272238
>
* schannel: client wants to read 102400 bytes
* schannel: encdata_buffer resized 103424
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data got 54
* schannel: encrypted data buffer: offset 54 length 103424
* schannel: decrypted data length: 25
* schannel: decrypted data added: 25
* schannel: decrypted data cached: offset 25 length 102400
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 25 length 102400
* schannel: schannel_recv cleanup
* schannel: decrypted data returned 25
* schannel: decrypted data buffer: offset 0 length 102400
< HTTP/1.1 100 Continue
} [1255 bytes data]
 21 1759k    0     0   21  385k      0   385k  0:00:04 --:--:--  0:00:04 1027k* schannel: client wants to read 102400 bytes
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: encrypted data got 502
* schannel: encrypted data buffer: offset 502 length 103424
* schannel: decrypted data length: 473
* schannel: decrypted data added: 473
* schannel: decrypted data cached: offset 473 length 102400
* schannel: encrypted data buffer: offset 0 length 103424
* schannel: decrypted data buffer: offset 473 length 102400
* schannel: schannel_recv cleanup
* schannel: decrypted data returned 473
* schannel: decrypted data buffer: offset 0 length 102400
< HTTP/1.1 400 Bad Request
< Content-Type: text/plain; charset=utf-8
< X-GUploader-UploadID: ABg5-UzLfsxk4ALL0C4Fewm8gTDel_583XI_OahsahS8HO25JZ6SXzSVudsJvfsA8YOguKoE7XXafAc0UXxH16jBpNsUszb5yg
< Content-Length: 25
< Date: Sat, 20 Mar 2021 19:33:55 GMT
< Server: UploadServer
< Alt-Svc: h3-29=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
* HTTP error before end of send, stop sending
<
{ [25 bytes data]
100 1759k  100    25  100 1759k     25  1759k  0:00:01 --:--:--  0:00:01 2048k
* Closing connection 0
* schannel: shutting down SSL/TLS connection with storage.googleapis.com port 443
* schannel: clear security context handle


 curl output: b'Malformed multipart body.'


 error: None
>主机:storage.googleapis.com
>用户代理:curl/7.55.1
>接受:*/*
>“接受:应用程序/json”
>“内容类型:多部分/表单数据”
>“x-upload-content-type:应用程序/八位字节流”
>“X-Upload-Content-Length:1800252”
>内容长度:1801555
>预期:100人继续
>内容类型:多部分/表单数据;边界=---------------------------086d33ba0b272238
>
*schannel:客户端想要读取102400字节
*schannel:encdata_缓冲区大小调整为103424
*schannel:加密数据缓冲区:偏移量0长度103424
*沙内尔:加密数据得到54
*schannel:加密数据缓冲区:偏移量54长度103424
*schannel:解密的数据长度:25
*schannel:已添加解密数据:25
*schannel:缓存的解密数据:偏移量25长度102400
*schannel:加密数据缓冲区:偏移量0长度103424
*schannel:解密数据缓冲区:偏移量25长度102400
*schannel:schannel_recv清理
*schannel:已解密的数据返回25
*schannel:解密的数据缓冲区:偏移量0长度102400

有什么见解吗?这里有很多技术在起作用。

我查看了标题,发现我的标题有引号,而实际的标题没有引号。从curl字符串中删除引号,现在就可以使用了