svn: r8813

This commit is contained in:
Eli Barzilay 2008-02-27 14:04:03 +00:00
parent 36b05ee127
commit 7a1aaadf8d

View File

@ -1,13 +1,15 @@
(module check mzscheme
#lang scheme/base
(define version-url "http://download.plt-scheme.org/version")
(define timeout 30)
;; This file is invoked from the installer, without using zo files -- so
;; using net/url.ss is extremely slow. Instead, do things directly.
;; This file can be invoked from an installer, and in case it's
;; without zo files using net/url.ss is extremely slow. Instead, do
;; things directly.
;; (require net/url)
;; (define (url->port url)
;; (get-pure-port (string->url url)))
;; (define (url->port url) (get-pure-port (string->url url)))
(require scheme/tcp)
(define (url->port url)
(define-values (host path)
(apply values (cdr (regexp-match #rx"^http://([^/:@]+)(/.*)$" url))))
@ -39,7 +41,7 @@
(thunk))))))])
(if r result (error-value "timeout"))))
(define (check-version/timeout)
(define (check-version-raw)
(let/ec escape
(define (err . args) (escape (apply error-value args)))
(define-syntax try
@ -86,8 +88,8 @@
;; stable)
[else `(newer ,stable ,recent)]))))
;; Check the version on the server and compare to our version.
;; Possible return values (message is always a string):
;; Check the version on the server and compare to our version. Possible return
;; values (message is always a string):
;; * `ok
;; You're fine.
;; * `(ok-but ,version)
@ -95,13 +97,11 @@
;; * `(newer ,version)
;; You have an old version, please upgrade to `version'
;; * `(newer ,version ,alpha)
;; You have an old version, please upgrade to `version' you may consider
;; also the alpha version
;; You have an old version, please upgrade to `version' you may consider also
;; the alpha version
;; * `(error ,message [,additional-info])
;; An error occured, the third (optional) value can be shown as the system
;; error that happened or the value that caused an error.
(provide check-version)
(define (check-version)
(with-timeout timeout check-version/timeout))
)
(with-timeout timeout check-version-raw))