From: Graham Leggett Date: Sun, 15 Apr 2001 20:26:10 +0000 (+0000) Subject: Add the Retry-After support that was commented out in proxy_ftp.c X-Git-Tag: 2.0.17~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=73d8d4ab4dc5f979b02b0ab9b55472986090a936;p=apache Add the Retry-After support that was commented out in proxy_ftp.c PR: Obtained from: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@88868 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/proxy/proxy_ftp.c b/modules/proxy/proxy_ftp.c index 2e1786f709..39a2283bf0 100644 --- a/modules/proxy/proxy_ftp.c +++ b/modules/proxy/proxy_ftp.c @@ -82,7 +82,7 @@ static int decodeenc(char *x) if (x[0] == '\0') return 0; /* special case for no characters */ for (i = 0, j = 0; x[i] != '\0'; i++, j++) { -/* decode it if not already done */ + /* decode it if not already done */ ch = x[i]; if (ch == '%' && ap_isxdigit(x[i + 1]) && ap_isxdigit(x[i + 2])) { ch = ap_proxy_hex2c(&x[i + 1]); @@ -777,22 +777,23 @@ PROXY_DECLARE (int) ap_proxy_ftp_handler(request_rec *r, proxy_server_conf *conf if (i == -1) { return ap_proxyerror(r, HTTP_BAD_GATEWAY, "Error reading from remote server"); } -#if 0 if (i == 120) { - /* RFC2068 states: - * 14.38 Retry-After + /* RFC2616 states: + * 14.37 Retry-After * * The Retry-After response-header field can be used with a 503 (Service * Unavailable) response to indicate how long the service is expected to - * be unavailable to the requesting client. The value of this field can - * be either an HTTP-date or an integer number of seconds (in decimal) + * be unavailable to the requesting client. [...] The value of this field + * can be either an HTTP-date or an integer number of seconds (in decimal) * after the time of the response. * Retry-After = "Retry-After" ":" ( HTTP-date | delta-seconds ) */ - ap_table_add(r->headers_out, "Retry-After", apr_psprintf(p, "%u", 60*wait_mins); + for (i=0 ; buffer[i] && !isdigit(buffer[i]); i++); + if (buffer[i]) { + ap_table_add(r->headers_out, "Retry-After", apr_psprintf(p, "%lu", 60*atol(buffer+i))); + } return ap_proxyerror(r, HTTP_SERVICE_UNAVAILABLE, buffer); } -#endif if (i != 220) { return ap_proxyerror(r, HTTP_BAD_GATEWAY, buffer); }