Created
January 7, 2012 06:33
-
-
Save valvallow/1574000 to your computer and use it in GitHub Desktop.
available-url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/gosh | |
(use rfc.http) | |
(use srfi-1) | |
(define (main args) | |
(let ((urls (remove (pa$ equal? "") | |
(string-split (port->string (current-input-port)) "\n")))) | |
(for-each print | |
(filter-map (^u (guard (ex (else (print u))) | |
(receive (status header body) | |
(http-get u "/") | |
(rlet1 ret (and (equal? status "200") u) | |
(with-output-to-port (current-error-port) | |
(^ _ (display (boolean ret)) | |
(display ":") | |
(print u))))))) | |
urls)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment