Peter Stirling | 5 Mar 04:00 2014

drakma

Hi,

I'm trying to use drakma with clisp on windows and I get an error when I 
use the :stream argument on http-request:

NO-APPLICABLE-METHOD: When calling #1=#<STANDARD-GENERIC-FUNCTION
      #2=(SETF FLEXI-STREAMS:FLEXI-STREAM-ELEMENT-TYPE)> with arguments 
#3=(CHARACTER
     T), no method is applicable.
    [Condition of type CLOS:METHOD-CALL-TYPE-ERROR]

As a second issue, the link to this email list on 
http://weitz.de/drakma/ is a 404.

Konstanski, Carlos | 3 Sep 20:18 2013

SSL version

I ran across an SSL website that requires TLSv1. `drakma:http-request'
does not allow passing an SSL method to 'cl+ssl:make-ssl-client-stream'
(via `drakma:make-ssl-stream'). It would be nice if it did.

Carlos  Konstanski
Sr. Systems Administrator

T 208.578.3733
C 208.720.7511

ckonstanski <at> marketron.com<mailto:ckonstanski <at> marketron.com>
[www.marketron.com]<https://www1.gotomeeting.com/register/644819568>
The information contained in this e-mail message may be confidential and
protected from disclosure.  If you are not the intended recipient, any
dissemination, distribution or copying is strictly prohibited. If you
think that you have received this e-mail message in error, please notify
the sender immediately by replying to this message and then delete it
from your system.


Phil Marneweck | 15 Aug 13:58 2013
Picon

syntax-error: Got Content-Length header although input chunking is on.

Hi

I am getting this (Got Content-Length header although input chunking is on.") syntax-error when I do some
api calls to twitter and facebook.

The drakma code says to

;; see RFC 2616, section 4.4

But if I look at the documentation 4.4 says

"If a message is received with both a Transfer-Encoding header field and a
Content-Length header field, the latter MUST be ignored."

I have hacked my local copy of drakma to do just that and it seems to work."

Am I maybe missing something or not reading the spec right?

Regards
Phil

Phil Marneweck | 15 Aug 07:21 2013
Picon

"Got Content-Length header although input chunking is on."

Hi

I am getting this syntax-error when I do some api calls to twitter and 
facebook.

The drakma code says to

;; see RFC 2616, section 4.4

But if I look at the documentation 4.4 says

"If a message is received with both a Transfer-Encoding header field and 
a Content-Length header field, the latter MUST be ignored."

I have hacked my local copy of drakma to do just that and it seems to work."

Am I maybe missing something or not reading the spec right?

Regards
Phil

Peter Wood | 17 Jul 08:16 2013

using PUT method with parameters

Hi

Using Drakma-1.3.2 (via quicklisp) and Sbcl-1.1.9 on Linux (Debian Wheezy):

I believe it is allowed to send parameters with a PUT request, just as with a POST request, but Drakma only
allows POST with parameters.

In request.lisp, changing this 

(when (and file-parameters-p (not (eq method :post)))
   (parameter-error "Don't know how to handle parameters in ~S, as this is not a POST request."

To this

(when (and file-parameters-p (not (member method '(:post :put))))
   (parameter-error "Don't know how to handle parameters in ~S, as this is not a POST or PUT request."

Allows PUT parameters.

I need this change for drakma to work with an common lisp interface to the paymill payment service api: https://www.paymill.com/
I would like to release the the paymill-api, but if Drakma won't let me use parameters in a put request, I will
have to ship a forked version of it with the api.

Regards
Peter

(ps. Just to be clear: I'm not talking about form-data - that IS only allowed with POST.)

Patrick May | 12 Jun 21:42 2013
Picon

Ignoring timeouts in Drakma

	I have a list of IP addresses to poll and want to catch the USOCKET:TIMEOUT-ERROR from Drakma when a machine
isn't available, log a message, and continue on mapping over the list.  Does anyone have an example of how to
do this?

Thanks,

Patrick

Michel Deloncle | 11 Apr 21:16 2013

Votre Convention collective

Si vous avez des difficultés de lire ce message, visualisez-le grâce à ce chemin.




Votre convention collective

La Convention Collective nationale dont vous dépendez est disponible.
Elle vous est livrée dans son classeur.

  • Sommaire thématique
    (classification, durée de travail, formation, salaire...)
La mise à jour de votre Convention sera assurée sans frais
pendant 1 an.*

Cet e-mail commercial est conforme à la législation en vigueur et aux délibérations de la CNIL des 22 et 30 mars deux milles cinq sur la prospection par courrier électronique dans le cadre professionnel. Conformément à l’article 34 de la loi 78-17 du 6 janvier mille neuf cent soixante dix huit relative à l’informatique, aux fichiers et aux libertés,vous disposez d’un droit d’accès, de rectification de données nominative vous concernant.
se désabonner
Patrick May | 23 Mar 15:03 2013
Picon

Problem with SBCL, Drakma, and quicklisp

	I'm trying to get Drakma working with SBCL.  I've loaded it with quicklisp but when I try to connect to a
website in Slime, I get this error:

The function DRAKMA::WITH-CHARACTER-STREAM-SEMANTICS is undefined.
   [Condition of type UNDEFINED-FUNCTION]

Any idea what could be causing this?  I've attached the backtrace in case that helps.

Thanks,

Patrick

Backtrace:
  0: ("undefined function")
  1: (HTTP-REQUEST #<PURI:URI http://ichart.yahoo.com/table.csv?s=IBM&a=0&b=01&c=2012&d=11&e=31&f=2012&g=d&ignore=.csv>)
  2: (GET-YAHOO-SYMBOL-DATA "IBM" "2012-01-01" "2012-12-31")
  3: (SB-INT:SIMPLE-EVAL-IN-LEXENV (GET-YAHOO-SYMBOL-DATA "IBM" "2012-01-01" "2012-12-31") #<NULL-LEXENV>)
  4: (EVAL (GET-YAHOO-SYMBOL-DATA "IBM" "2012-01-01" "2012-12-31"))
  5: ((LAMBDA () :IN SWANK:EVAL-AND-GRAB-OUTPUT))
  6: (SWANK::CALL-WITH-RETRY-RESTART "Retry SLIME evaluation request." #<CLOSURE (LAMBDA # :IN
SWANK:EVAL-AND-GRAB-OUTPUT) {13BBF7E5}>)
  7: (SWANK::CALL-WITH-BUFFER-SYNTAX NIL #<CLOSURE (LAMBDA # :IN SWANK:EVAL-AND-GRAB-OUTPUT) {13BBF7CD}>)
  8: (SB-INT:SIMPLE-EVAL-IN-LEXENV (SWANK:EVAL-AND-GRAB-OUTPUT "(get-yahoo-symbol-data \"IBM\"
\"2012-01-01\" \"2012-12-31\")\n") #<NULL-LEXENV>)
  9: (EVAL (SWANK:EVAL-AND-GRAB-OUTPUT "(get-yahoo-symbol-data \"IBM\" \"2012-01-01\" \"2012-12-31\")\n"))
 10: (SWANK:EVAL-FOR-EMACS (SWANK:EVAL-AND-GRAB-OUTPUT "(get-yahoo-symbol-data \"IBM\"
\"2012-01-01\" \"2012-12-31\")\n") ":comp-invest" 17)
 11: (SWANK::PROCESS-REQUESTS T)
 12: (SWANK::CALL-WITH-BINDINGS ..)
 13: (SWANK::REPL-INPUT-STREAM-READ #<SWANK::SINGLETHREADED-CONNECTION {12971A59}>
#<SB-SYS:FD-STREAM for "standard input" {11A91B11}>)
 14: ((LAMBDA () :IN SB-GRAY:STREAM-READ-CHAR))
 15: ((SB-PCL::FAST-METHOD SB-GRAY:STREAM-READ-CHAR (SWANK-BACKEND::SLIME-INPUT-STREAM))
#<unavailable argument> #<unavailable argument> #<SWANK-BACKEND::SLIME-INPUT-STREAM {12971BC9}>)
 16: (READ-CHAR #<SWANK-BACKEND::SLIME-INPUT-STREAM {12971BC9}> T #:EOF-OBJECT #<unused argument>)
 17: (SB-IMPL::%READ-PRESERVING-WHITESPACE #<SWANK-BACKEND::SLIME-INPUT-STREAM {12971BC9}> T NIL T)
 18: (SB-IMPL::%READ-PRESERVING-WHITESPACE #<SWANK-BACKEND::SLIME-INPUT-STREAM {12971BC9}> T NIL NIL)
 19: (READ #<SWANK-BACKEND::SLIME-INPUT-STREAM {12971BC9}> T NIL NIL)
 20: (SWANK::SIMPLE-REPL)
 21: ((LAMBDA () :IN SWANK::SIMPLE-SERVE-REQUESTS))
 22: ((LAMBDA () :IN SWANK::SIMPLE-SERVE-REQUESTS))
 23: ((LAMBDA (SWANK-BACKEND::HANDLER FUNCTION) :IN
"/Users/Patrick/.emlib/slime/swank-backend.lisp") ..)
 24: (SWANK-BACKEND::CALL-WITH-BREAK-HOOK #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK> #<CLOSURE
(LAMBDA # :IN SWANK::SIMPLE-SERVE-REQUESTS) {12971ACD}>)
 25: ((FLET SWANK-BACKEND:CALL-WITH-DEBUGGER-HOOK :IN
"/Users/Patrick/.emlib/slime/swank-sbcl.lisp") #<FUNCTION SWANK:SWANK-DEBUGGER-HOOK>
#<CLOSURE (LAMBDA # :IN SWANK::SIMPLE-SERVE-REQUESTS) {12971ACD}>)
 26: (SWANK::SIMPLE-SERVE-REQUESTS #<SWANK::SINGLETHREADED-CONNECTION {12971A59}>)
 27: (SWANK::ACCEPT-CONNECTIONS #<SB-BSD-SOCKETS:INET-SOCKET fd: -1 {129680D1}> NIL NIL)
 28: ((LABELS SWANK::SERVE-LOOP :IN SWANK::SETUP-SERVER))
 29: (SWANK::SETUP-SERVER 0 #<CLOSURE (LAMBDA # :IN SWANK:START-SERVER) {128E5F1D}> NIL NIL NIL)
 30: (SB-INT:SIMPLE-EVAL-IN-LEXENV (FUNCALL (READ-FROM-STRING "swank:start-server")
"/var/folders/b0/br9v722s5nq0j4m677ncd98c0000gn/T/slime.32805") #<NULL-LEXENV>)
 31: (SB-INT:SIMPLE-EVAL-IN-LEXENV ..)
 32: (EVAL ..)
 33: (SB-EXT:INTERACTIVE-EVAL ..)
 34: (SB-IMPL::REPL-FUN NIL)
 35: ((LAMBDA () :IN SB-IMPL::TOPLEVEL-REPL))
 36: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA # :IN SB-IMPL::TOPLEVEL-REPL) {13363095}>)
 37: (SB-IMPL::TOPLEVEL-REPL NIL)
 38: (SB-IMPL::TOPLEVEL-INIT)
 39: ((FLET #:WITHOUT-INTERRUPTS-BODY-222031 :IN SB-EXT:SAVE-LISP-AND-DIE))
 40: ((LABELS SB-IMPL::RESTART-LISP :IN SB-EXT:SAVE-LISP-AND-DIE))
Peter Kuchta | 21 Mar 22:41 2013
Picon

Error while trying to POST some JSON data

Hi everybody,


I'm trying to POST some JSON data to a web service: 

        (ql:quickload :st-json)
        (ql:quickload :cl-json)
        (ql:quickload :drakma)

        (defvar *rc* (merge-pathnames (user-homedir-pathname) ".apirc"))

        (defvar *user*
          (with-open-file (s *rc*)
            (st-json:read-json s)))

        (defvar api-url (st-json:getjso "url" *user*))
        (defvar api-key (st-json:getjso "key" *user*))
        (defvar api-email (st-json:getjso "email" *user*))

        (setf drakma:*header-stream* *standard-output*)

        (defvar *req* '(("dataset" . "tigge")
                  ("step"    . "24")
                  ("date"    . "20071001")
                  ("time"    . "00")
                  ("origin"  . "all")))

        (format t "json:~S~%" (json:encode-json-to-string *req*))

        (defun retrieve (api request)
          (let* ((cookie-jar (make-instance 'drakma:cookie-jar))
                 (extra-headers (list (cons "From" api-email)
                                      (cons "X-API-KEY" api-key)))
                 (url (concatenate 'string api-url api "/requests"))
                 (stream (drakma:http-request url
                               :additional-headers extra-headers
                               :accept "application/json"
                               :method :post
                               :content-type "application/json"
                               :external-format-out :utf-8
                               :external-format-in :utf-8
                               :redirect 100
                               :cookie-jar cookie-jar
                               :content (json:encode-json-to-string request)
                               :want-stream t)))
              (st-json:read-json stream)))

     (retrieve "/datasets/tigge" *req*)

Unfortunately, I get an error, although the data seems to be encoded OK to JSON and the headers generated by drakma too, I think. Apparently something is wrong with the :content (the list of integers in the errors message is just the list of ASCII codes of the JSON encoded data).

    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\"}"

    POST /v1/datasets/tigge/requests HTTP/1.1
    Host: api.service.int
    User-Agent: Drakma/1.3.0 (SBCL 1.1.5; Darwin; 12.2.0; http://weitz.de/drakma/)
    Accept: application/json
    Connection: close
    From: me <at> gmail.com
    X-API-KEY: 19a0edb6d8d8dda1e6a3b21223e4f86a
    Content-Type: application/json
    Content-Length: 193


    debugger invoked on a SIMPLE-TYPE-ERROR:
      The value of CL+SSL::THING is #(123 34 100 97 116 97 115 101 116 34 58 34
                                  ...), which is not of type (SIMPLE-ARRAY
                                                              (UNSIGNED-BYTE 8)
                                                              (*)).

Any idea what's wrong with this code? Many thanks in advance.

Best regards,
Piotr
_______________________________________________
drakma-devel mailing list
drakma-devel <at> common-lisp.net
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/drakma-devel
Hans Hübner | 9 Dec 22:04 2012
Picon

Drakma documentation overhaul

Hi,

while fixing some bugs in Drakma recently, I was notified that the
documentation and the docstrings were not matching well anymore.  I
have decided to overhaul the documentation, and in the process of
that, I also made some source changes.

There will be more changes soon, so you may experience instabilities
when you're using the master branch from github.

Comments regarding the documentation would be very welcome, I have put
a version up for review at http://netzhansa.com/drakma.html

Thanks,
Hans
Simon Koch | 9 Dec 18:15 2012
Picon

error while parsing set cookie containing httponly & secure

When parsing this Set-Cookie line:

Set-Cookie: shssl=4058628; path=/; secure; HttpOnly

The resulting Cookie is:

#<COOKIE shssl=4058628; path=/; domain=www.base.de>

Which misses both features: 'HttpOnly' and 'secure'.

I traced the bug down to 'parse-set-cooie' which returns
(("Set-Cookie: shssl" "4058628" (("path" . "/") ("secure; HttpOnly"))))

instead of (("Set-Cookie: shssl" "4058628" (("path" . "/") ("secure")
("HttpOnly"))))

As far as I understood the code the problem is caused by
'read-name-value-pairs' of chunga.

I am using chunga 1.1.1 and drakma 1.2.9

Is this a already known bug/problem?

Gmane