Kevin,<div><br></div><div>Thank you very much - I was absolutely sure I was doing something wrong!</div><div><br></div><div>Could you please show how I can roll back to cl+ssl-20130128-git ? I don't know how to do it, I'm a quicklisp newbie.</div>
<div><br></div><div>Many thanks,</div><div>Piotr</div><br><div class="gmail_quote">On Thu, Mar 21, 2013 at 9:44 PM, Kevin Raison <span dir="ltr"><<a href="mailto:raison@chatsubo.net" target="_blank">raison@chatsubo.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I encountered this same error after upgrading packages via quicklisp. I<br>
rolled back cl+ssl to version cl+ssl-20130128-git and the problem went<br>
away. I have not had time to investigate further yet.<br>
<br>
-Kevin<br>
<div><div class="h5"><br>
<br>
On 03/21/2013 02:41 PM, Peter Kuchta wrote:<br>
> Hi everybody,<br>
><br>
> I'm trying to POST some JSON data to a web service:<br>
><br>
> (ql:quickload :st-json)<br>
> (ql:quickload :cl-json)<br>
> (ql:quickload :drakma)<br>
><br>
> (defvar *rc* (merge-pathnames (user-homedir-pathname) ".apirc"))<br>
><br>
> (defvar *user*<br>
> (with-open-file (s *rc*)<br>
> (st-json:read-json s)))<br>
><br>
> (defvar api-url (st-json:getjso "url" *user*))<br>
> (defvar api-key (st-json:getjso "key" *user*))<br>
> (defvar api-email (st-json:getjso "email" *user*))<br>
><br>
> (setf drakma:*header-stream* *standard-output*)<br>
><br>
> (defvar *req* '(("dataset" . "tigge")<br>
> ("step" . "24")<br>
> ("date" . "20071001")<br>
> ("time" . "00")<br>
> ("origin" . "all")))<br>
><br>
> (format t "json:~S~%" (json:encode-json-to-string *req*))<br>
><br>
> (defun retrieve (api request)<br>
> (let* ((cookie-jar (make-instance 'drakma:cookie-jar))<br>
> (extra-headers (list (cons "From" api-email)<br>
> (cons "X-API-KEY" api-key)))<br>
> (url (concatenate 'string api-url api "/requests"))<br>
> (stream (drakma:http-request url<br>
> :additional-headers extra-headers<br>
> :accept "application/json"<br>
> :method :post<br>
> :content-type "application/json"<br>
> :external-format-out :utf-8<br>
> :external-format-in :utf-8<br>
> :redirect 100<br>
> :cookie-jar cookie-jar<br>
> :content (json:encode-json-to-string request)<br>
> :want-stream t)))<br>
> (st-json:read-json stream)))<br>
><br>
> (retrieve "/datasets/tigge" *req*)<br>
><br>
> Unfortunately, I get an error, although the data seems to be encoded OK<br>
> to JSON and the headers generated by drakma too, I think. Apparently<br>
> something is wrong with the :content (the list of integers in the errors<br>
> message is just the list of ASCII codes of the JSON encoded data).<br>
><br>
><br>
> json:"{\"dataset\":\"tigge\",\"step\":\"24\",\"number\":\"all\",\"levtype\":\"sl\",\"date\":\"20071001\",\"time\":\"00\",\"origin\":\"all\",\"type\":\"pf\",\"param\":\"tp\",\"area\":\"70\\/-130\\/30\\/-60\",\"grid\":\"2\\/2\",\"target\":\"data.grib\"}"<br>
><br>
> POST /v1/datasets/tigge/requests HTTP/1.1<br>
</div></div>> Host: <a href="http://api.service.int" target="_blank">api.service.int</a> <<a href="http://api.service.int" target="_blank">http://api.service.int</a>><br>
<div class="im">> User-Agent: Drakma/1.3.0 (SBCL 1.1.5; Darwin; 12.2.0;<br>
> <a href="http://weitz.de/drakma/" target="_blank">http://weitz.de/drakma/</a>)<br>
> Accept: application/json<br>
> Connection: close<br>
</div>> From: <a href="mailto:me@gmail.com">me@gmail.com</a> <mailto:<a href="mailto:me@gmail.com">me@gmail.com</a>><br>
<div class="im">> X-API-KEY: 19a0edb6d8d8dda1e6a3b21223e4f86a<br>
> Content-Type: application/json<br>
> Content-Length: 193<br>
><br>
><br>
> debugger invoked on a SIMPLE-TYPE-ERROR:<br>
> The value of CL+SSL::THING is #(123 34 100 97 116 97 115 101 116<br>
> 34 58 34<br>
> ...), which is not of type (SIMPLE-ARRAY<br>
><br>
> (UNSIGNED-BYTE 8)<br>
> (*)).<br>
><br>
> Any idea what's wrong with this code? Many thanks in advance.<br>
><br>
> Best regards,<br>
> Piotr<br>
><br>
><br>
</div>> _______________________________________________<br>
> drakma-devel mailing list<br>
> <a href="mailto:drakma-devel@common-lisp.net">drakma-devel@common-lisp.net</a><br>
> <a href="http://lists.common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel" target="_blank">http://lists.common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel</a><br>
><br>
</blockquote></div><br>