From bohmer at gmail.com Fri Apr 16 16:53:59 2010 From: bohmer at gmail.com (=?ISO-8859-1?Q?Knut_Olav_B=F8hmer?=) Date: Fri, 16 Apr 2010 18:53:59 +0200 Subject: [clouchdb-devel] basic-authorization Message-ID: Hi, What about enabeling basic-authorization. This worked for me: (defun db-request (uri &rest args &key &allow-other-keys) "Used by most Clouchdb APIs to make the actual REST request." (let ((*text-content-types* *text-types*)) (multiple-value-bind (body status headers uri stream must-close reason-phrase) (apply #'drakma:http-request (make-uri uri) `(, at args :basic-authorization ,(when (db-user *couchdb*) (list (db-user *couchdb*) (db-password *couchdb*))))) ;;(declare (ignore must-close reason-phrase stream uri headers status)) (when *debug-requests* (format t "uri: ~s~%args: ~s~%must-close:~s~%reason-phrase: ~s~%status: ~s~%headers: ~s~%stream:~s~%body:~s~%" uri args must-close reason-phrase status headers stream body)) (if (stringp body) (json-to-document body) (values body status reason-phrase))))) -- Knut Olav B?hmer From peter.eddy at gmail.com Mon Apr 19 01:08:02 2010 From: peter.eddy at gmail.com (Peter Eddy) Date: Sun, 18 Apr 2010 21:08:02 -0400 Subject: [clouchdb-devel] basic-authorization In-Reply-To: References: Message-ID: Hi, I think I've added something similar in source control, but not in a released version. I'll have to check. If not, I'll incorporate your patch and make a new release soon. thanks, Peter 2010/4/16 Knut Olav B?hmer : > Hi, > > What about enabeling basic-authorization. This worked for me: > > > (defun db-request (uri &rest args &key &allow-other-keys) > ?"Used by most Clouchdb APIs to make the actual REST request." > ?(let ((*text-content-types* *text-types*)) > ? ?(multiple-value-bind (body status headers uri stream must-close > reason-phrase) > ? ? ? ?(apply #'drakma:http-request (make-uri uri) > ? ? ? ? ? ? ? `(, at args :basic-authorization > ? ? ? ? ? ? ? ? ? ? ? ?,(when (db-user *couchdb*) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (list (db-user *couchdb*) > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? (db-password *couchdb*))))) > > ? ? ?;;(declare (ignore must-close reason-phrase stream uri headers status)) > ? ? ?(when *debug-requests* > ? ? ? ?(format t "uri: ~s~%args: ~s~%must-close:~s~%reason-phrase: > ? ? ? ?~s~%status: ~s~%headers: ~s~%stream:~s~%body:~s~%" uri args > ? ? ? ?must-close reason-phrase status headers stream body)) > ? ? ?(if (stringp body) > ? ? ? ? ?(json-to-document body) > ? ? ? ? ?(values body status reason-phrase))))) > > > -- > Knut Olav B?hmer > > _______________________________________________ > clouchdb-devel mailing list > clouchdb-devel at common-lisp.net > http://common-lisp.net/cgi-bin/mailman/listinfo/clouchdb-devel >