You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Rob Manning <Ro...@collabraspace.com> on 2005/11/16 16:22:02 UTC

Only speaking HTTP 1.1

I'd like to be able to tell HttpClient to only speak HTTP/1.1 with the 
server and
throw an Exception if the server doesn't support this.  I see in the 
preferences
api document 
(http://jakarta.apache.org/commons/httpclient/preference-api.html)
where I can set the default protocol to use via the HTTP method parameter
called "http.protocol.version".  However, I suspect this will only 
"prefer" HTTP/1.1
and not "prevent" speaking HTTP/1.0.  Anyone have any ideas about how I
would achieve this?

Rob Manning


CollabraSpace - Revolutionary Collaboration
Visit us at http://www.collabraspace.com
This message has been scanned for viruses by
ClamAV v0.83



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Only speaking HTTP 1.1

Posted by Rob Manning <Ro...@collabraspace.com>.
Oleg Kalnichevski wrote:

>On Wed, Nov 16, 2005 at 10:22:02AM -0500, Rob Manning wrote:
>  
>
>>I'd like to be able to tell HttpClient to only speak HTTP/1.1 with the 
>>server and
>>throw an Exception if the server doesn't support this.  I see in the 
>>preferences
>>api document 
>>(http://jakarta.apache.org/commons/httpclient/preference-api.html)
>>where I can set the default protocol to use via the HTTP method parameter
>>called "http.protocol.version".  However, I suspect this will only 
>>"prefer" HTTP/1.1
>>and not "prevent" speaking HTTP/1.0.  Anyone have any ideas about how I
>>would achieve this?
>>
>>    
>>
>
>Rob,
>
>Just override the HttpMethodBase#readStatusLine(HttpState,
>HttpConnection) method and throw an exception if the effective protocol
>version is set to HttpVersion.HTTP_1_0
>
>http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/httpclient/HttpMethodBase.html#1821
>
>Hope this helps
>  
>
Oleg,

Thanks as always for a quick response.  I expect that will work just fine.

Rob


CollabraSpace - Revolutionary Collaboration
Visit us at http://www.collabraspace.com
This message has been scanned for viruses by
ClamAV v0.83



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org


Re: Only speaking HTTP 1.1

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, Nov 16, 2005 at 10:22:02AM -0500, Rob Manning wrote:
> 
> I'd like to be able to tell HttpClient to only speak HTTP/1.1 with the 
> server and
> throw an Exception if the server doesn't support this.  I see in the 
> preferences
> api document 
> (http://jakarta.apache.org/commons/httpclient/preference-api.html)
> where I can set the default protocol to use via the HTTP method parameter
> called "http.protocol.version".  However, I suspect this will only 
> "prefer" HTTP/1.1
> and not "prevent" speaking HTTP/1.0.  Anyone have any ideas about how I
> would achieve this?
> 

Rob,

Just override the HttpMethodBase#readStatusLine(HttpState,
HttpConnection) method and throw an exception if the effective protocol
version is set to HttpVersion.HTTP_1_0

http://jakarta.apache.org/commons/httpclient/xref/org/apache/commons/httpclient/HttpMethodBase.html#1821

Hope this helps

Oleg


> Rob Manning
> 
> 
> CollabraSpace - Revolutionary Collaboration
> Visit us at http://www.collabraspace.com
> This message has been scanned for viruses by
> ClamAV v0.83
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpclient-user-help@jakarta.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-user-help@jakarta.apache.org