Thanks for following up @satybald.

For file upload, we use [Content-Type: 
multipart/form-data](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#multipartform-data).
 The requests consists of multiple parts, where each part has its own HTTP 
headers. For the individual parts, you can set `Content-Type: 
application/x-java-archive` by using the `type=...` syntax. Using `-H 
Content-Type: application/...` results in a HTTP request that is not following 
the specification. I found that when working with Flink 1.6.0, it does not 
matter what you put after `type=`.

For me the command below works (note the `type=foo/bar`):
```
curl -vvv  -X POST -H "Expect:" -F 
"jarfile=@examples/streaming/WordCount.jar;type=foo/bar" 
```
output:
```
http://localhost:8081/jars/upload
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying ::1...
* TCP_NODELAY set
* Connected to localhost (::1) port 8081 (#0)
> POST /jars/upload HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 10286
> Content-Type: multipart/form-data; 
> boundary=------------------------1fdbe0626a9f0009
>
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=UTF-8
< Access-Control-Allow-Origin: *
< Connection: keep-alive
< content-length: 197
<
* Connection #0 to host localhost left intact
{"filename":"/var/folders/43/ghpk0br14m99tnl9b86lwfsm0000gn/T/flink-web-5891eaeb-bcb7-41f8-8d20-1647dc1c576f/flink-web-upload/1d287180-8151-423d-b6d2-31ce955bfcb1_WordCount.jar","status":"success"}%
```

I can also omit `type=` and it still works. What Flink and curl version are you 
using? I would change the documentation accordingly if the Content-type is not 
needed because it causes confusion.

```
curl --version
curl 7.54.0 (x86_64-apple-darwin17.0) libcurl/7.54.0 LibreSSL/2.0.20 
zlib/1.2.11 nghttp2/1.24.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 
pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL 
libz HTTP2 UnixSockets HTTPS-proxy
```

[ Full content available at: https://github.com/apache/flink/pull/6706 ]
This message was relayed via gitbox.apache.org for [email protected]

Reply via email to