Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change HttpClients HTTP version to HTTP/1.0

im trying to use HTTP/1.0 with Apache HttpClient 4.3, but I can't find out how. In 3.x version it was done this way:

httpClient.getParams().setParameter("http.protocol.version", HttpVersion.HTTP_1_0);

Thats deprecated by now. How to do it now? Thank you.

like image 497
JuSch Avatar asked Jul 14 '14 23:07

JuSch


People also ask

Who sets the HTTP version?

HTTP standards are developed by the Internet Engineering Task Force (IETF) and the World Wide Web Consortium (W3C), culminating in the publication of a series of Requests for Comments (RFCs). HTTP has four versions — HTTP/0.9, HTTP/1.0, HTTP/1.1, and HTTP/2.0.

What is closeable HttpClient?

CloseableHttpClient is an abstract class that represents a base implementation of the HttpClient interface. However, it also implements the Closeable interface. Thus, we should close all its instances after use.

Where is HTTP set?

HTTP version is sent as a header in every request, so it is set in the message sent by System. Net. Http.


1 Answers

HttpGet request = new HttpGet("/stuff");
request.setProtocolVersion(HttpVersion.HTTP_1_0);
like image 152
ok2c Avatar answered Sep 30 '22 07:09

ok2c