Lisp HUG Maillist Archive

quicklisp, drakma

Hello,

I received code some time ago from this bulletin board for checking legitimacy of a URL.
It works with Lispworks for windows, but it hangs for Lispworks for MacOsX.
I have lost the original correspondence, but I do appreciate the help I received.

The function that is useful for me is:

(defun check-url-ok (uri)
  (multiple-value-bind (content-stream code headers new-uri headers-stream close-p status)
      (drakma:http-request uri :want-stream t)
    status))

Lispworks for windows returns "OK" is it finds the URL.

Any ideas?

Thanks,
Sheldon

Re: quicklisp, drakma

I don't have a Mac to test right now, so I can just ask questions:

* Does it hang with all URLs or just with specific ones?
* Do you happen to have a web server running on localhost you could
try to connect to via Drakma (just to make sure it's not a problem
with the "outside world")?
* There's an example in the LW documentation somewhere that talks to
an http server (in the simplest case you just open a TCP connection to
port 80 and then send "GET /").  Could you try if it works this way
(i.e. without Drakma)?

HTH,
Edi.

On Tue, Aug 28, 2012 at 4:30 AM, Sheldon Ball <sheldon.ball@gmail.com> wrote:
> Hello,
>
> I received code some time ago from this bulletin board for checking
> legitimacy of a URL.
> It works with Lispworks for windows, but it hangs for Lispworks for MacOsX.
> I have lost the original correspondence, but I do appreciate the help I
> received.
>
> The function that is useful for me is:
>
> (defun check-url-ok (uri)
>   (multiple-value-bind (content-stream code headers new-uri headers-stream
> close-p status)
>       (drakma:http-request uri :want-stream t)
>     status))
>
> Lispworks for windows returns "OK" is it finds the URL.
>
> Any ideas?
>
> Thanks,
> Sheldon

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: quicklisp, drakma

The example I was referring to is at the end of this page:
http://www.lispworks.com/documentation/lw60/LW/html/lw-553.htm

On Tue, Aug 28, 2012 at 11:47 AM, Edi Weitz <edi@agharta.de> wrote:
> I don't have a Mac to test right now, so I can just ask questions:
>
> * Does it hang with all URLs or just with specific ones?
> * Do you happen to have a web server running on localhost you could
> try to connect to via Drakma (just to make sure it's not a problem
> with the "outside world")?
> * There's an example in the LW documentation somewhere that talks to
> an http server (in the simplest case you just open a TCP connection to
> port 80 and then send "GET /").  Could you try if it works this way
> (i.e. without Drakma)?
>
> HTH,
> Edi.
>
> On Tue, Aug 28, 2012 at 4:30 AM, Sheldon Ball <sheldon.ball@gmail.com> wrote:
>> Hello,
>>
>> I received code some time ago from this bulletin board for checking
>> legitimacy of a URL.
>> It works with Lispworks for windows, but it hangs for Lispworks for MacOsX.
>> I have lost the original correspondence, but I do appreciate the help I
>> received.
>>
>> The function that is useful for me is:
>>
>> (defun check-url-ok (uri)
>>   (multiple-value-bind (content-stream code headers new-uri headers-stream
>> close-p status)
>>       (drakma:http-request uri :want-stream t)
>>     status))
>>
>> Lispworks for windows returns "OK" is it finds the URL.
>>
>> Any ideas?
>>
>> Thanks,
>> Sheldon

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: quicklisp, drakma

On Aug 28, 2012, at 04:30 , Sheldon Ball <sheldon.ball@gmail.com> wrote:
> Hello,
> 
> I received code some time ago from this bulletin board for checking legitimacy of a URL.
> It works with Lispworks for windows, but it hangs for Lispworks for MacOsX.
> I have lost the original correspondence, but I do appreciate the help I received.
> 
> The function that is useful for me is:
> 
> (defun check-url-ok (uri)
>   (multiple-value-bind (content-stream code headers new-uri headers-stream close-p status)
>       (drakma:http-request uri :want-stream t)
>     status))
> 
> Lispworks for windows returns "OK" is it finds the URL.
> 
> Any ideas?
> 
> Thanks,
> Sheldon

I just checked, and this works for me with Lispworks 6.1 under MacOSX 10.8.1.

What you could try doing when it hangs is to use the (Lispworks) Process Browser to break into the hanging process; the backtrace should then show you exactly where the operation is hanging.

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Re: quicklisp, drakma

Hi Raymond,

Thanks.
The problem I encounter occurs after many iterations of 'check-url-ok'.
I have ~80,000 references containing URLs that I look through.
The recursive function that calls check-URL-ok makes it through ~20,000 iterations before encountering a problem.
The problem seems to occur with different URLs, each of which (when I checked it out) turned out to be a legitimate URL.

The first error I get is: 'No status line.'
I record the references that were successfully checked with 'check-URL-ok' so that when I run the same recursive function again, 'check-URL-ok' will pick up where it encountered error: 'No status line'. On windows, this trick seems to allow me be hack my may through all 80,000 references.. On MacOsX, it never gets further than the initial block.

The new error is: Error making TCP connection, reason=failure to connect: Operation now in progress.

The system then will respond for a while. I can quit Lispworks, but then I get the spinning ball of doom.

Any ideas?

Thanks,
Sheldon

On Wed, Aug 29, 2012 at 12:49 AM, Raymond Wiker <rwiker@gmail.com> wrote:
On Aug 28, 2012, at 04:30 , Sheldon Ball <sheldon.ball@gmail.com> wrote:
> Hello,
>
> I received code some time ago from this bulletin board for checking legitimacy of a URL.
> It works with Lispworks for windows, but it hangs for Lispworks for MacOsX.
> I have lost the original correspondence, but I do appreciate the help I received.
>
> The function that is useful for me is:
>
> (defun check-url-ok (uri)
>   (multiple-value-bind (content-stream code headers new-uri headers-stream close-p status)
>       (drakma:http-request uri :want-stream t)
>     status))
>
> Lispworks for windows returns "OK" is it finds the URL.
>
> Any ideas?
>
> Thanks,
> Sheldon

I just checked, and this works for me with Lispworks 6.1 under MacOSX 10.8.1.

What you could try doing when it hangs is to use the (Lispworks) Process Browser to break into the hanging process; the backtrace should then show you exactly where the operation is hanging.

Updated at: 2020-12-10 08:36 UTC