hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: No Server header until explicitly assigning ORIGIN_SERVER to response
Date Thu, 18 Oct 2007 18:29:20 GMT
On Thu, 2007-10-18 at 19:35 +0200, Erik Abele wrote:
> While using httpcore-4.0 for a server application I came across an  
> issue which can be easily shown by using the ElementalHttpServer  
> example:
> 
> When running the example I get no Server header:
> 
> HTTP/1.1 200 OK
> Date: Thu, 18 Oct 2007 16:48:00 GMT
> Content-Length: 5599
> Content-Type: text/html
> 
> After applying the attached patch to ElementalHttpServer.java I get  
> the server header:
> 
> HTTP/1.1 200 OK
> Date: Thu, 18 Oct 2007 16:53:49 GMT
> Server: Jakarta-HttpComponents/1.1
> Content-Length: 5599
> Content-Type: text/html
> 
> The problem seems to be that the params used by the instance of  
> HttpService are not carried over to the HttpResponse object and  
> therefore the ResponseServer interceptor doesn't add the header in  
> question - is this intended or am I just too blind?
> 

Hi Erik

No, you are not blind and this is not intended. I messed up when I made
changes to the HttpService class last time. I'll commit a fix for the
bug in a few ticks. 

My bad. Sorry.

Oleg


> Cheers,
> Erik
> 
> --- ElementalHttpServer.java.orig	2007-10-05 12:04:10.000000000 +0200
> +++ ElementalHttpServer.java	2007-10-18 19:32:49.000000000 +0200
> @@ -104,6 +104,12 @@
>                   final HttpResponse response,
>                   final HttpContext context) throws HttpException,  
> IOException {
> 
> +            response.getParams().setParameter 
> (CoreProtocolPNames.ORIGIN_SERVER,
> +                request.getParams().getParameter 
> (CoreProtocolPNames.ORIGIN_SERVER));
> +
> +            // or alternatively simply:
> +            //response.setParams(request.getParams());
> +
>               String method = request.getRequestLine().getMethod 
> ().toUpperCase();
>               if (!method.equals("GET") && !method.equals("HEAD") &&
! 
> method.equals("POST")) {
>                   throw new MethodNotSupportedException(method + "  
> method not supported");
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org
> 
> 


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


Mime
View raw message