curl response says “HTTP version not supported”, error 505

心已入冬 提交于 2019-12-01 03:24:38

问题


I made request using curl, the response says that HTTP Version not supported, error 505. What are the steps to make HTTP Version supported.

After googling i get, the i should use curl --http2.0 to make it work, but my curl version is not supporting that option, as it is added in curl 7.33, whereas i am using curl with version: curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.0.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2

Now, should i upgrade my curl or is there any other way to make it supported or am i missing something in my request(sorry, but i am not able to show the request).

If i need to upgrade it, then please specify me the way how to upgrade curl to version 7.33.0, i am not getting any proper way to do it.


回答1:


for me the problem was mistake in the url (i had space there) after this issue it turn out that the curl complaining about bad http version was false alarm.




回答2:


I got the same error today with Imperva Rest API curl commands.

Turned out that the URL that I was using had some path / (variables containing spaces in it's value) http://.../.../some path/or/some thing here/resource/sites and it didn't allow spaces.

To fix the issue, I used %20 to replace space characters (as per Imperva REST API v11.5 doc): http://.../.../some%20path/or/some%20thing%20here/resource/sites and then it worked.




回答3:


curl defaults to using HTTP 1.1 (which -v and --trace will show you), so if that is non-supported you probably need to switch to HTTP 1.0 using the --http1.0 option.

http 2 is hardly used in the wild yet by servers and is only supported by very recent curl versions .




回答4:


For me it was while passing a half-coded "url" to Curl, particularly spaces were not encoded into "%20", while other staff was encoded properly. someone should either pass a "url" fully decoded or fully encoded.




回答5:


this is a confusion created by curl error message. however this issue has nothing to be with HTTP version, most of the time is the space inside the curl URL. e.g. "adc.com/adc?a=hi there", so to fix this one just need to escape those chars according to rfc3986, like "adc.com/adc?a=hi%20there".



来源:https://stackoverflow.com/questions/20114175/curl-response-says-http-version-not-supported-error-505

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!