improved error checking when the response is badly malformed
svn: r11925
This commit is contained in:
parent
e99645136b
commit
a7217aed0e
|
@ -628,7 +628,7 @@ subdirectory.
|
|||
(min-hi . ,(get pkg-spec-minor-hi))
|
||||
(path . ,(get pkg-spec-path)))))
|
||||
|
||||
;; get-http-response-code : header[from net/head] -> string
|
||||
;; get-http-response-code : header[from net/head] -> string or #f
|
||||
;; gets the HTTP response code in the given header
|
||||
(define (get-http-response-code header)
|
||||
(let ([parsed (regexp-match #rx"^HTTP/[^ ]* ([^ ]*)" header)])
|
||||
|
@ -656,7 +656,8 @@ subdirectory.
|
|||
[ip (get-impure-port target)]
|
||||
[head (purify-port ip)]
|
||||
[response-code/str (get-http-response-code head)]
|
||||
[response-code (string->number response-code/str)])
|
||||
[response-code (and response-code/str
|
||||
(string->number response-code/str))])
|
||||
|
||||
(define (abort msg)
|
||||
(close-input-port ip)
|
||||
|
|
Loading…
Reference in New Issue
Block a user