I am a beginner with regards to phoenix.
I need a replacement for an existing build pipeline which fetches and uploads build artefacts from/to a web server with GET and PUT.
I get GET, but am about halfway with PUT…
I have a route:
put "/upload" UploadController, :put
I use curl as client:
curl -X PUT -v -H "Content-Type: application/octet-stream" --data-binary @binary_file localhost:4000/upload
I noticed that curl is careful and first only sends the length of the binary and a 100 continue,
so I answer with a 100 continue in the controller:
And in the respective controller there is:
def put(conn, params) do IO.inspect(params) IO.inspect(conn) # do some length checking and whatnot send_resp(conn, 100, "") end
curl is happy and continues with a PUT and the data.
Wireshark shows me that all is transmitted, but I think I should get an error message about a missing
callback or come again into the put method with different parameters, but nothing.
Any pointers, please?
update, this is the output of curl:
* Trying 127.0.0.1:4000... * TCP_NODELAY set * Connected to localhost (127.0.0.1) port 4000 (#0) > PUT /upl/x HTTP/1.1 > Host: localhost:4000 > User-Agent: curl/7.68.0 > Accept: */* > Content-Type: application/octet-stream > Content-Length: 3400 > Expect: 100-continue > * Mark bundle as not supporting multiuse < HTTP/1.1 100 Continue < cache-control: max-age=0, private, must-revalidate < content-length: 0 < cross-origin-window-policy: deny < date: Wed, 25 Jan 2023 19:36:11 GMT < server: Cowboy < x-content-type-options: nosniff < x-download-options: noopen < x-frame-options: SAMEORIGIN < x-permitted-cross-domain-policies: none < x-request-id: Fz2kYMP9txZw4X0AAA-R < x-xss-protection: 1; mode=block * We are completely uploaded and fine * Empty reply from server * Connection #0 to host localhost left intact curl: (52) Empty reply from server