From: Trastabuga
Subject: Any recommendation for http client library?
Date: 
Message-ID: <1171427954.828356.134050@v33g2000cwv.googlegroups.com>
I needed to do HTTP GET and POST requests, mostly to upload files
(images). I tried Drakma and though it works well for GET requests,
for POST requests it choked somewhere trying to deliver the file.
Did anyone try to upload files using this or any other libs? Could you
share the code? Any other library?
I couldn't find a better alternative on cliki and as a Lisp newbie
it's hard to decide whether I should go ahead and debug the Drakma
library or look for some other lib. I use CMUCL on Debian.

Any recommendations are welcome!
Andrew

From: ·······@gmail.com
Subject: Re: Any recommendation for http client library?
Date: 
Message-ID: <1171438790.712494.290960@h3g2000cwc.googlegroups.com>
On Feb 14, 5:39 am, "Trastabuga" <·········@gmail.com> wrote:
> I needed to do HTTP GET and POST requests, mostly to upload files
> (images). I tried Drakma and though it works well for GET requests,
> for POST requests it choked somewhere trying to deliver the file.

In my experience file uploads work fine with Drakma.  My guess is
that you're not using it correctly.[*]  If you /think/ you've
found a bug, you should maybe report it to the mailing list
instead of spreading unproven claims on Usenet.

Cheers,
Edi.

[*] For example, a common misconception with file uploads is that
    every web server is able to accept chunked transfer encoding.
    This is wrong, see for example Apache 1.x.
From: Trastabuga
Subject: Re: Any recommendation for http client library?
Date: 
Message-ID: <1171459883.483772.55620@q2g2000cwa.googlegroups.com>
On Feb 14, 2:39 am, ·······@gmail.com wrote:
> On Feb 14, 5:39 am, "Trastabuga" <·········@gmail.com> wrote:
>
> > I needed to do HTTP GET and POST requests, mostly to upload files
> > (images). I tried Drakma and though it works well for GET requests,
> > for POST requests it choked somewhere trying to deliver the file.
>
> In my experience file uploads work fine with Drakma.  My guess is
> that you're not using it correctly.[*]  If you /think/ you've
> found a bug, you should maybe report it to the mailing list
> instead of spreading unproven claims on Usenet.
>
> Cheers,
> Edi.
>
> [*] For example, a common misconception with file uploads is that
>     every web server is able to accept chunked transfer encoding.
>     This is wrong, see for example Apache 1.x.

Hi Edi.
We've discussed it in the mailing list. You suggested that I should
debug it using Hunchentoot as a receiving server.
I think that the server I am posting to can't accept the chunked
encoding. Is there a way to make the same encoding as if I send it
from Mozilla Firefox (it works from there).
Here is how I do it:
(defun upload-file (name1 name2 file-name)
  (drakma:http-request "/some/uri"
                :method :post :form-data t
                :parameters `(("Name1" . ,name1)
                      ("Name2" . ,name2)
                      ("File" . ,file-name)))))
One more thing, if I supply file name #p"/some/file.txt" it looks like
the function fails to handle the request. File name as a string works
(opens the file and puts it in the stream).

Regards,
Andrew
From: ·······@gmail.com
Subject: Re: Any recommendation for http client library?
Date: 
Message-ID: <1171474917.131377.237080@j27g2000cwj.googlegroups.com>
On Feb 14, 2:31 pm, "Trastabuga" <·········@gmail.com> wrote:
>
> We've discussed it in the mailing list.

Are you the one who called himself "Andrei" on the mailing list?
I wouldn't call what we had a discussion because you didn't reply
to the emails I sent.  Instead you posted this on c.l.l.  I find
this behaviour pretty irritating...

> I think that the server I am posting to can't accept the
> chunked encoding. Is there a way to make the same encoding as
> if I send it from Mozilla Firefox (it works from there).

Yes, and I already told you on Monday how to do it:

  http://common-lisp.net/pipermail/drakma-devel/2007-February/
000059.html

> One more thing, if I supply file name #p"/some/file.txt" it
> looks like the function fails to handle the request. File name
> as a string works (opens the file and puts it in the stream).

I can't believe that - partly because I wrote the code.  How
would Drakma know that you want to send a file if you're using a
string naming a file?  How would it be able to tell a string
naming a file from another string meaning just a string?

I'd prefer if we could continue this "discussion" on the mailing
list.

Cheers,
Edi.
From: Trastabuga
Subject: Re: Any recommendation for http client library?
Date: 
Message-ID: <1171478508.131490.101220@a75g2000cwd.googlegroups.com>
On Feb 14, 12:41 pm, ·······@gmail.com wrote:
> On Feb 14, 2:31 pm, "Trastabuga" <·········@gmail.com> wrote:
>
>
>
> > We've discussed it in the mailing list.
>
> Are you the one who called himself "Andrei" on the mailing list?
> I wouldn't call what we had a discussion because you didn't reply
> to the emails I sent.  Instead you posted this on c.l.l.  I find
> this behaviour pretty irritating...
>
> > I think that the server I am posting to can't accept the
> > chunked encoding. Is there a way to make the same encoding as
> > if I send it from Mozilla Firefox (it works from there).
>
> Yes, and I already told you on Monday how to do it:
>
>  http://common-lisp.net/pipermail/drakma-devel/2007-February/
> 000059.html
>
> > One more thing, if I supply file name #p"/some/file.txt" it
> > looks like the function fails to handle the request. File name
> > as a string works (opens the file and puts it in the stream).
>
> I can't believe that - partly because I wrote the code.  How
> would Drakma know that you want to send a file if you're using a
> string naming a file?  How would it be able to tell a string
> naming a file from another string meaning just a string?
>
> I'd prefer if we could continue this "discussion" on the mailing
> list.
>
> Cheers,
> Edi.


Sorry, Edi. My fault. I haven't read the your latest message in the
mailing list. Let's continue there.

Thank you,
Andrew
From: ······@gmail.com
Subject: Re: Any recommendation for http client library?
Date: 
Message-ID: <1171446748.695152.198880@p10g2000cwp.googlegroups.com>
On Feb 14, 6:39 am, "Trastabuga" <·········@gmail.com> wrote:
> it's hard to decide whether I should go ahead and debug the Drakma
> library or look for some other lib.

Actually you should do neither. What you should do is to prepare a
_minimal_ example that clearly demonstrates the problem together with
a short description of what exactly are the steps to run it (including
the address of the server you run against if  applicable), what is the
result of running it, and what did you expect the result to be.
Basically you need to write several lines of code that everybody can
and see the problem.
Very often during the process of making a small self-contained example
you'll find that the short version does not exhibit the buggy
behavior. This might be a good time to find what's the difference
between the short sample and the actual code is, sometimes that may
lead to a discovery that it was your one bug. But if you can may that
small self-contained example that demonstrates the bug you should post
it to the appropriate mailing list.