curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)

Fix curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1) using http/1.1

I was trying to upload a video file to Google Cloud Storage using Google Storage API using CURL from my Mac Book. I was not getting a response from the API. Instead, CURL was throwing an error "curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)"

new_man_test_report.png

I found this issue happening because of new version of CURL is using HTTP/2 as default. In older CURL version it was HTTP/1.1

So HTTP/2 will not be compatible with older API services. So a HTTP/2 request to an older API service will be failed to connect. In this case I set the HTTP version to 1.1 when sending the request like shown in the below image and it helped me to fix this.

new_man_test_report-2.png

I hope you found this article helpful.

Thank you for reading!.