Re: Contributed Network Code

[email protected] Mon, 9 Mar 2009 07:33:10 -0700
Newsgroups gmane.lisp.scheme.scsh
Message-ID <[email protected]>
Remember that you're dealing with SCSH.  You don't need a builtin
client library:

    (define (pull-current-rss rss-url)
      (receive (port child)
          (run/port+proc (wget -q -O - ,rss-url))
        (let* ((str (close-after port
                        (lambda (port)
                          (call-with-string-output-port
                            (lambda (out)
                              (asciify-numeric-entities port out))))))
               (data (ssax:xml->sxml (make-string-input-port str) '()))
               ;; The (wait ...) call has to come after we have read
               ;; all the data.  The kernel will keep the process
               ;; around as a zombie until we're ready to get its
               ;; status.
               (status (wait child)))
          (if (zero? status)
              data
              (error "non-zero exit status pulling rss"
                     (status:exit-val status)
                     (status:stop-sig status)
                     (status:term-sig status))))))

'asciify-numeric-entities' is a finite state machine that detects
&#nn; XML entities greater than 255 and transforms them into '?',
because SCSH 0.6.7 doesn't support Unicode.  That will be another
benefit to porting SCSH to Scheme 48.

Derek

Nunez Steve writes:
> Thanks, but that only has HTTP server and clients for SMTP, FTP, etc.
> 
> 
> 
> ________________________________
> From: Andreas Bernauer <[email protected]>
> To: Nunez Steve <[email protected]>
> Cc: [email protected]
> Sent: Monday, March 9, 2009 4:00:25 PM
> Subject: Re: Contributed Network Code
> 
> 
> 
> Nunez Steve wrote:
> > Does anyone know where I can obtain HTTP functions for scsh?
> 
> Maybe the SUnet package is of some help?
> 
> http://www.scsh.net/resources/sunet.html
> 
> -- 
> Andreas.
> 
> 
>