Rainer,
Yes, I would like this code to run on other platforms besides Windows. So, I
take to heart your advice to make sure the newlines are CRLF.
Ron Lewis
-----Original Message-----
From:
owner-lisp-hug@lispworks.com <
owner-lisp-hug@lispworks.com> On Behalf
Of Rainer Joswig
Sent: Thursday, March 15, 2018 5:26 AM
To: Lisp HUG <
lisp-hug@lispworks.com>
Subject: Re: Browser (client) side: bring up
google.com search page
Note also that HTTP favors CRLF as lineending - both for reading and
writing.
The newline in Common Lisp (both for reading and writing) depends on the
platform and on the cleverness of the Lisp.
-> LF on Unixoids and CRLF on Windows are the platform defaults.
Servers & clients might be able to deal with reading LF, but they still
should be answer with CRLF.
Regards,
Rainer
Am 13.03.2018 um 23:13 schrieb Ron Lewis <rlewis-4d@indinfer.com>:
I am trying to send a GET message to google.com and then receive
whatever I get back. I think I am getting nothing back. But what I
ought to get back should be something like what you get when you type
"google.com" into the Chrome, FireFox, or other browser.
I think I am connecting. google.com is an HTTPS site, not HTTP. I
think that means I need to specify something with SSL. Maybe I have
the GET command wrong. Anyway, here is the code:
============ Begin Code ======================= ;;;; Package xcomm
;;;; ;;;; Experiment with LispWorks COMM package ;;;;
(in-package xcomm)
;;; Bring up the google search page?
(defvar *connection* nil)
(defun request-web-page ()
(let ((ln (format nil "GET / HTTP/1.0~%")))
(format t "~s~%" ln)
(write-line ln *connection*)
(finish-output)))
(defun show-web-page ()
(do ((chr (read-char *connection* nil) (read-char *connection* nil)))
((null chr))
(write-char chr)))
(defun bring-up-google ()
(setf *connection* (open-tcp-stream "google.com" 443
:direction :io
:ssl-ctx t)) (if (null
*connection*)
(return-from bring-up-google nil))
;; Think it is connecting okay.
(request-web-page)
(show-web-page)
(close *connection*)
(setf *connection* nil))
============ End Code =======================
My Listener session looks like:
========== Begin Listener Session =========== CL-USER 1 > (in-package
xcomm) #<The XCOMM package, 7/16 internal, 0/16 external>
XCOMM 2 > (bring-up-google)
"GET / HTTP/1.0
"
NIL
XCOMM 5 >
========== End Listener Session ===========
Before the snippet of Listener Session (just above), I have already
executed the following:
========== Begin Executed before Listener Session ========== (require
"comm")
(defpackage xcomm
(:use common-lisp comm))
========== End Executed before Listener Session ==========
I would be very, very happy to learn where I can get the
enabling-information I lack. Is there a book? A website?
Thank you very much for looking at this. I hope someone can offer
direction.
Ron Lewis
_______________________________________________
Lisp Hug - the mailing list for LispWorks users lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.comhttp://www.lispworks.com/support/lisp-hug.html
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html