Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port-eof? not reliable for client sockets #142

Open
GoogleCodeExporter opened this issue Aug 19, 2015 · 0 comments
Open

port-eof? not reliable for client sockets #142

GoogleCodeExporter opened this issue Aug 19, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

From the description of port-eof? in R6RS it seems like port-eof? should not 
return #f when lookahead-u8 will return the end of file object. So this program 
should not print its message, but it does:

Ypsilon 0.9.6-trunk/r503 Copyright (c) 2009 Y.Fujita, LittleWing Company 
Limited.
> (import (socket))
> (let ((p (socket-port (make-client-socket "www.example.com" "80"))))
  (put-bytevector p
                  (string->utf8
                   (string-append "GET / HTTP/1.1\r\n"
                                  "Host: www.example.com:80"
                                  "Connection: close\r\n"
                                  "\r\n\r\n")))
  (flush-output-port p)
  (let lp ()
    (unless (port-eof? p)
      (cond ((eof-object? (lookahead-u8 p))
             (display "end of file returned even though port-eof? was false.\n"))
            (else
             (get-u8 p)
             (lp)))))
  (close-port p))
end of file returned even though port-eof? was false.
> 

Original issue reported on code.google.com by weinh...@gmail.com on 22 Jul 2010 at 6:50

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant