Put URL and garbage in result from PHP

Dave Cragg dave.cragg at lacscentre.co.uk
Tue Oct 9 04:37:09 EDT 2012


On 8 Oct 2012, at 15:58, Mark Schonewille <m.schonewille at economy-x-talk.com> wrote:
> Exactly every 8001 bytes (or 889 words, which are all different), I get some garbage:
> 
> 1f41
> AAAAAAAAA
> AAAAAAAAB
> [889 times]
> AAAAAAAAC
> 1f41
> AAAAAAAAP
> AAAAAAAAQ
> [889 times]
> AAAAAAAAR
> etc etc etc
> BBBBBBBBX
> 1e7d
> 
> The garbage is often the same but not always and it appears before the first line and after the last line. I have tried several combinations of the content-type and content-transfer-encoding headers in PHP. I have also tried changing the encoding of the PHP script itself.
> 

Mark

(Answer based on behavior of libUrl from a couple of years ago)

It looks like the format of a 'chunked' Transfer-Encoding. LibUrl should deal with this. Can you check if the response headers contain a line like this:

Transfer-Encoding: chunked

If so, there shouldn't also be a Content-Length header. If there is, libUrl will just read raw data for the length of the Content-Length header. 

If there is neither, libUrl will read data until the socket is closed.

I think 'chunked' is normal  for php scripts of the style you showed (echo in a loop). So it looks like something odd is happening in this case.

Dave





More information about the use-livecode mailing list