[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.javascript

newbie: How to get the trailer from HTTP respones in javascript

Sijie YANG

3/26/2015 3:14:00 PM

The trailer of HTTP response(in chunked encoding) contains speical header field which records signature of the response body.

How to get the trailer from HTTP responses in javasript?
I tried xmlHTTPRequest, but the headers(returned by getAllResponseHeaders) doesn't contain any header from the trailer.

Is it possilbe get the raw data of HTTP response in javascript?

Thanks in advanece!

eg:

h=new XMLHttpRequest()
h.open("GET", "http://test-site", true)
h.send()
h.getAllResponseHeaders()
2 Answers

Cezary Tomczyk

3/26/2015 9:35:00 PM

0

On 2015-03-26 16:14, Sijie YANG wrote:
> The trailer of HTTP response(in chunked encoding) contains speical
> header field which records signature of the response body.
>
> How to get the trailer from HTTP responses in javasript? I tried
> xmlHTTPRequest, but the headers(returned by getAllResponseHeaders)
> doesn't contain any header from the trailer.
[...]

Maybe you are sending cross-domain request. If so then take a look at
http://stackoverflow.com/questions/5822985/cross-domain-resource-sharing-get-refused-to-get-unsafe-header-et...

I haven't tried to set Access-Control-Expose-Headers header, but you may
try it.

--
Cezary Tomczyk
http://www.ct...

JJ

3/27/2015 8:59:00 AM

0

On Thu, 26 Mar 2015 08:14:26 -0700 (PDT), Sijie YANG wrote:
> The trailer of HTTP response(in chunked encoding) contains speical header field which records signature of the response body.
>
> How to get the trailer from HTTP responses in javasript?
> I tried xmlHTTPRequest, but the headers(returned by getAllResponseHeaders) doesn't contain any header from the trailer.
>
> Is it possilbe get the raw data of HTTP response in javascript?
>
> Thanks in advanece!
>
> eg:
>
> h=new XMLHttpRequest()
> h.open("GET", "http://test-site", true)
> h.send()
> h.getAllResponseHeaders()

You've created an *asynchronous* request, so you should wait until the
headers are received. Oh, and *do* check the readyState before trying to
access the headers.