You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by Oleg Kalnichevski <ol...@apache.org> on 2007/10/18 20:29:20 UTC

Re: No Server header until explicitly assigning ORIGIN_SERVER to response

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


Re: No Server header until explicitly assigning ORIGIN_SERVER to response

Posted by Erik Abele <er...@codefaktor.de>.
On 18.10.2007, at 20:29, Oleg Kalnichevski wrote:

> On Thu, 2007-10-18 at 19:35 +0200, Erik Abele wrote:
>> ...
>> 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.

Ah, ok.

> I'll commit a fix for the bug in a few ticks.

I see your commit (r586057) now; I was actually looking at that part  
of the code but was too hurried to see the obvious... :-/

> My bad. Sorry.

Heh, no need to be sorry - this is an alpha - glad I could help  
improving it :-)

Cheers,
Erik

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