[cl-plus-ssl-cvs] CVS update: trivial-https/trivial-https.lisp
David Lichteblau
dlichteblau at common-lisp.net
Wed Nov 16 17:08:26 UTC 2005
Update of /project/cl-plus-ssl/cvsroot/trivial-https
In directory common-lisp.net:/tmp/cvs-serv21082
Modified Files:
trivial-https.lisp
Log Message:
use octet streams for https
Date: Wed Nov 16 18:08:25 2005
Author: dlichteblau
Index: trivial-https/trivial-https.lisp
diff -u trivial-https/trivial-https.lisp:1.1.1.1 trivial-https/trivial-https.lisp:1.2
--- trivial-https/trivial-https.lisp:1.1.1.1 Wed Nov 9 23:11:16 2005
+++ trivial-https/trivial-https.lisp Wed Nov 16 18:08:25 2005
@@ -50,9 +50,11 @@
(defun http-get (url &optional headers)
(let* ((host (url-host url))
(port (url-port url))
- (stream (open-stream host port)))
- (when (equal (url-scheme url) "https")
- (setf stream (cl+ssl:make-ssl-client-stream stream)))
+ (stream
+ (if (equal (url-scheme url) "https")
+ (cl+ssl:make-ssl-client-stream
+ (open-stream host port :element-type '(unsigned-byte 8)))
+ (open-stream host port))))
(format stream "GET ~A HTTP/1.0~AHost: ~A~AUser-Agent: Trivial HTTP for Common Lisp~A"
url +crlf+ host +crlf+ +crlf+)
(loop for (name . value) in headers do
@@ -67,9 +69,11 @@
(defun http-post (url content-type content)
(let* ((host (url-host url))
(port (url-port url))
- (stream (open-stream host port)))
- (when (equal (url-scheme url) "https")
- (setf stream (cl+ssl:make-ssl-client-stream stream)))
+ (stream
+ (if (equal (url-scheme url) "https")
+ (cl+ssl:make-ssl-client-stream
+ (open-stream host port :element-type '(unsigned-byte 8)))
+ (open-stream host port))))
(format stream "POST ~A HTTP/1.0~AHost: ~A~AUser-Agent: Trivial HTTP for Common Lisp~AContent-Type: ~A~AContent-Length: ~D~A~A~A" url +crlf+ host +crlf+ +crlf+ content-type +crlf+ (length content) +crlf+ +crlf+ content)
(force-output stream)
(list
More information about the cl-plus-ssl-cvs
mailing list