[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: do and read-line in MrEd.



On Jul  2, Jordan Katz wrote:
> Which essentially proves my entire code isn't doing even remotely
> what I think it's doing.  After the first do, all the lines upto and
> including "Content-Type: text/html" were supposed to have been read,
> so I don't see how all the junk before that would be printed in the
> *second* do.  I have no idea what's going on here; any clues?

(*sigh*, so no I have to actually read your code...)

|  (let-values ;;(((url) (send urlbox get-value))
|   (((sin sout) (tcp-connect url 80))
|    ((html-start) (regexp "Content-Type:.*")))

Your indentation is screwed here...

|   (fprintf sout "GET http://www.~s HTTP/1.0~n~n" url)

Are you sure you want a "~s" there?  If url is a string, then the
string which is sent includes double-quote characters.

|   ;; read until "Content-Type..." is met
|   (do ((line (read-line sin) (read-line sin)))
|       ((not (regexp-match html-start line))))
|         ^^^

Isn't this supposed to be the other way?

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!