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 rangeli nepal <ra...@gmail.com> on 2010/04/11 19:19:02 UTC

Manually Setting up Authorization Header.

Good Evening Everybody,

I am trying to seup Authorization header in GET method like this.

Header authHeader=new Header();
      authHeader.setName("Authorization");

              <get deflated and base64 encoded String >


      StringBuffer prefix=new StringBuffer(" Custom CustomToken=");

            //Put based 64 encoded string here.
             prefix.append(encodedString);//.append("\"");


              authHeader.setValue(prefix.toString());
      method.setRequestHeader(authHeader);

However when it goes to the server. I get following on server log:

request failed: error reading the headers

I tried to do tcpdump. It seems Authorization Header is received in two
parts ( makes sense as it's size is 2.5K) . But server sends error after
receiving first part.

Re: Manually Setting up Authorization Header.

Posted by rangeli nepal <ra...@gmail.com>.
I guess issue was me not doing the url encoding of header string.

On Sun, Apr 11, 2010 at 5:56 PM, rangeli nepal <ra...@gmail.com>wrote:

> I guess that decision is pretty much guided by the propriety protocol that
> we are planning to use.
>
> Reading the documentation for LimitRequestFieldsize at following site, it
> claims SPNEGO authentication headers can be up to 12392 bytes. so 2.5 k is
> not that unusual. :)
>
> http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestfieldsize
>
>
>
> On Sun, Apr 11, 2010 at 3:25 PM, Oleg Kalnichevski <ol...@apache.org>wrote:
>
>> On Sun, 2010-04-11 at 13:19 -0400, rangeli nepal wrote:
>> > Good Evening Everybody,
>> >
>> > I am trying to seup Authorization header in GET method like this.
>> >
>> > Header authHeader=new Header();
>> >       authHeader.setName("Authorization");
>> >
>> >               <get deflated and base64 encoded String >
>> >
>> >
>> >       StringBuffer prefix=new StringBuffer(" Custom CustomToken=");
>> >
>> >             //Put based 64 encoded string here.
>> >              prefix.append(encodedString);//.append("\"");
>> >
>> >
>> >               authHeader.setValue(prefix.toString());
>> >       method.setRequestHeader(authHeader);
>> >
>> > However when it goes to the server. I get following on server log:
>> >
>> > request failed: error reading the headers
>> >
>> > I tried to do tcpdump. It seems Authorization Header is received in two
>> > parts ( makes sense as it's size is 2.5K) . But server sends error after
>> > receiving first part.
>>
>> Why on earth are you trying to use an HTTP header to send 2.5K of data?
>>
>> Oleg
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
>> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>>
>>
>

Re: Manually Setting up Authorization Header.

Posted by rangeli nepal <ra...@gmail.com>.
I guess that decision is pretty much guided by the propriety protocol that
we are planning to use.

Reading the documentation for LimitRequestFieldsize at following site, it
claims SPNEGO authentication headers can be up to 12392 bytes. so 2.5 k is
not that unusual. :)

http://httpd.apache.org/docs/2.0/mod/core.html#limitrequestfieldsize


On Sun, Apr 11, 2010 at 3:25 PM, Oleg Kalnichevski <ol...@apache.org> wrote:

> On Sun, 2010-04-11 at 13:19 -0400, rangeli nepal wrote:
> > Good Evening Everybody,
> >
> > I am trying to seup Authorization header in GET method like this.
> >
> > Header authHeader=new Header();
> >       authHeader.setName("Authorization");
> >
> >               <get deflated and base64 encoded String >
> >
> >
> >       StringBuffer prefix=new StringBuffer(" Custom CustomToken=");
> >
> >             //Put based 64 encoded string here.
> >              prefix.append(encodedString);//.append("\"");
> >
> >
> >               authHeader.setValue(prefix.toString());
> >       method.setRequestHeader(authHeader);
> >
> > However when it goes to the server. I get following on server log:
> >
> > request failed: error reading the headers
> >
> > I tried to do tcpdump. It seems Authorization Header is received in two
> > parts ( makes sense as it's size is 2.5K) . But server sends error after
> > receiving first part.
>
> Why on earth are you trying to use an HTTP header to send 2.5K of data?
>
> Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>

Re: Manually Setting up Authorization Header.

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Sun, 2010-04-11 at 13:19 -0400, rangeli nepal wrote:
> Good Evening Everybody,
> 
> I am trying to seup Authorization header in GET method like this.
> 
> Header authHeader=new Header();
>       authHeader.setName("Authorization");
> 
>               <get deflated and base64 encoded String >
> 
> 
>       StringBuffer prefix=new StringBuffer(" Custom CustomToken=");
> 
>             //Put based 64 encoded string here.
>              prefix.append(encodedString);//.append("\"");
> 
> 
>               authHeader.setValue(prefix.toString());
>       method.setRequestHeader(authHeader);
> 
> However when it goes to the server. I get following on server log:
> 
> request failed: error reading the headers
> 
> I tried to do tcpdump. It seems Authorization Header is received in two
> parts ( makes sense as it's size is 2.5K) . But server sends error after
> receiving first part.

Why on earth are you trying to use an HTTP header to send 2.5K of data?

Oleg



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