On Thu, Sep 10, 2015 at 9:26 PM, R. Clayton <rvclay...@acm.org> wrote:
>     "HTTP/1.1 200 OK
>     Date: Fri, 11 Sep 2015 01:10:39 GMT
>     Server: III 100
>     Pragma: no-cache
>     Content-Type: text/html; ISO-8859-1
>     Expires: Fri, 11 Sep 2015 01:10:39 GMT
>     Cache-control: no-cache
>     Set-Cookie: SESSION_LANGUAGE=eng; path=/; domain=.example.com; path=/
>     Set-Cookie: III_EXPT_FILE=aa20885; path=/; domain=.example.com; path=/
>     Set-Cookie: III_SESSION_ID=3ba8ef1c57601a925bc732a44b4bb791; 
> domain=.example.com; path=/
>     Set-Cookie: SESSION_SCOPE=0; path=/
>     Vary: User-Agent,Accept-Encoding
>     Transfer-Encoding: chunked

Aha. The last, "Transfer-Encoding: chunked" header is the issue:

  https://en.wikipedia.org/wiki/Chunked_transfer_encoding

Also notice there is no Content-Length header -- therefore the client
can't read some specific number of bytes.

Plus, the response says HTTP 1.1, which means that multiple requests
and responses may be made over one connection -- therefore the client
can't just read until "end of file".

Instead, the client must do chunked transfer decoding. But
get-pure-port doesn't know how to. And it shouldn't need to: When a
client makes an HTTP 1.1 request, the server is allowed to assume the
client knows how to do chunked transfer encoding. But IIRC,
get-pure-port supplies HTTP 1.0 in the request header. So technically,
this web server must not respond like this. But it is. In other words,
welcome to the real world wide web. :)


TL;DR: Instead you probably want to use Racket's http-client library,
which knows how to handle HTTP 1.1 including chunked
transfer-encoding:

  http://docs.racket-lang.org/net/http-client.html

That should do all you need.


p.s. I also have an http package that does a bit more:

  https://github.com/greghendershott/http

You can install with:

  raco pkg install http

But again, http-client should be fine for what you're doing.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to