From a445c6860ad5011401827f038f4ccbf1b2db7b29 Mon Sep 17 00:00:00 2001 From: Tony Garnock-Jones Date: Mon, 31 Oct 2016 22:29:32 -0400 Subject: [PATCH] Cope with network error when considering redirection --- rmq/private/util.rkt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rmq/private/util.rkt b/rmq/private/util.rkt index 4f8d425..68d7ed3 100644 --- a/rmq/private/util.rkt +++ b/rmq/private/util.rkt @@ -71,8 +71,9 @@ (stop-when (message (web-response-complete req-id $resp $response-body)) (printf "~a <-- ~v ~v\n" req-id resp response-body) (k resp response-body)))) - (define location (dict-ref (web-response-header-headers resp) 'location #f)) - (if (and (eq? (web-response-header-code-type resp) 'redirection) + (define location (and resp (dict-ref (web-response-header-headers resp) 'location #f))) + (if (and resp + (eq? (web-response-header-code-type resp) 'redirection) (positive? redirect-budget) location) (web-request! verb location