HttpService header length restriction

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

HttpService header length restriction

megharajdeepak
Hi,
I am using HttpService and making a post request by passing custom header,
instead of query string (as IE doesn't allow longer query strings).

However, flex is not at all invoking the service call in case of header
length being greater than 8192 characters long. I get "Error 2145:
Cumulative length of requestHeaders must be less than 8192 characters".

Kindly let me know if there is a way to remove this restriction. If not,
how can I make a server call with long parameter value?

 - Deepak
Reply | Threaded
Open this post in threaded view
|

Re: HttpService header length restriction

Olaf Krueger
Hi,
I am not sure but could it be that you've put your payload/data in the
header instead of the body of the request? Maybe you should share some
code...

I've just copied and pasted an incomplete snippet of a HTTPSerrvice call
[1].

Hope this helps,
Olaf


[1]
service = new HTTPService();
service.addEventListener(ResultEvent.RESULT, resultCallback);
service.addEventListener(FaultEvent.FAULT, faultCallback);
service.url = url;
                       
// Due to a bug in Flash, a HTTPService/URLRequest with a GET request will
// not properly send headers. We therefore use POST for this and *ALL*
// requests.
service.method = "POST";
                       
service.resultFormat = "text";
service.contentType = "application/json";
service.headers["Authorization"] = "Bearer " + this.jwt;
service.headers["Content-Type"] = "application/json";
                       
// The X-HTTP-Method-Override header tells the API to treat this request
// as the passed request, even though it is being conducted as a POST (due
to the bug
// mentioned above)
service.headers["X-HTTP-Method-Override"] = method;

var body:Object = new Object;
body.foo= "foo";
body.bar= "bar";

service.send(JSON.stringify(body));



--
Sent from: http://apache-flex-users.2333346.n4.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: HttpService header length restriction

Alex Harui-2
In reply to this post by megharajdeepak
Looks like header length is a restriction on the server side.  See

https://stackoverflow.com/questions/686217/maximum-on-http-header-values

So there may not be a way around it from the client.

HTH,
-Alex

On 2/1/18, 9:12 PM, "Deepak MS" <[hidden email]> wrote:

>Hi,
>I am using HttpService and making a post request by passing custom header,
>instead of query string (as IE doesn't allow longer query strings).
>
>However, flex is not at all invoking the service call in case of header
>length being greater than 8192 characters long. I get "Error 2145:
>Cumulative length of requestHeaders must be less than 8192 characters".
>
>Kindly let me know if there is a way to remove this restriction. If not,
>how can I make a server call with long parameter value?
>
> - Deepak

Reply | Threaded
Open this post in threaded view
|

Re: HttpService header length restriction

megharajdeepak
In reply to this post by Olaf Krueger
Thanks, Olaf. You were right, payload param was getting passed as header.

On 02-Feb-2018 1:21 pm, "Olaf Krueger" <[hidden email]> wrote:

> Hi,
> I am not sure but could it be that you've put your payload/data in the
> header instead of the body of the request? Maybe you should share some
> code...
>
> I've just copied and pasted an incomplete snippet of a HTTPSerrvice call
> [1].
>
> Hope this helps,
> Olaf
>
>
> [1]
> service = new HTTPService();
> service.addEventListener(ResultEvent.RESULT, resultCallback);
> service.addEventListener(FaultEvent.FAULT, faultCallback);
> service.url = url;
>
> // Due to a bug in Flash, a HTTPService/URLRequest with a GET request will
> // not properly send headers. We therefore use POST for this and *ALL*
> // requests.
> service.method = "POST";
>
> service.resultFormat = "text";
> service.contentType = "application/json";
> service.headers["Authorization"] = "Bearer " + this.jwt;
> service.headers["Content-Type"] = "application/json";
>
> // The X-HTTP-Method-Override header tells the API to treat this request
> // as the passed request, even though it is being conducted as a POST (due
> to the bug
> // mentioned above)
> service.headers["X-HTTP-Method-Override"] = method;
>
> var body:Object = new Object;
> body.foo= "foo";
> body.bar= "bar";
>
> service.send(JSON.stringify(body));
>
>
>
> --
> Sent from: http://apache-flex-users.2333346.n4.nabble.com/
>