-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Too many redirects error when redirected to https only in axel compiled without ssl #158
Comments
@ismaell I have an idea on where the bug exists, please correct me if i am wrong. I believe when This can be easily corrected by a test for failure of |
On further perusal i believe presence or absence of SSL support in axel should not have any influence on parsing a well made URL as done here in Instead it can be elegantly handled after parsing it in #ifndef HAVE_SSL
if (PROTO_IS_SECURE(conn->proto)) {
sprintf(conn->message, _("Unsupported protocol\n"));
/* return function with some negative value */
}
#endif Is this the right way to do this ? |
@shankar your reasoning seems right. Please note:
|
The reason to avoid |
@ismaell if we compile with
would not compile. Please advice |
And also i have been thinking about what i said about handling secure protocol outside |
@ismaell here is my patch to fix the issue ( i have taken the liberty to improve error message) diff --git a/src/conn.c b/src/conn.c
index 3acdf67..591d18b 100644
--- a/src/conn.c
+++ b/src/conn.c
@@ -70,7 +70,6 @@ conn_set(conn_t *conn, const char *set_url)
conn->proto = PROTO_HTTP;
conn->port = PROTO_HTTP_PORT;
}
-#ifdef HAVE_SSL
else if (strncmp(set_url, "ftps", proto_len) == 0) {
conn->proto = PROTO_FTPS;
conn->port = PROTO_FTPS_PORT;
@@ -78,10 +77,17 @@ conn_set(conn_t *conn, const char *set_url)
conn->proto = PROTO_HTTPS;
conn->port = PROTO_HTTPS_PORT;
}
-#endif /* HAVE_SSL */
else {
+ sprintf(conn->message, _("Unsupported protocol\n"));
return 0;
}
+#ifndef HAVE_SSL
+ if (PROTO_IS_SECURE(conn->proto)) {
+ sprintf(conn->message,
+ _("Secure protocol is not supported\n"));
+ return 0;
+ }
+#endif
strncpy(url, i + 3, sizeof(url) - 1);
url[sizeof(url) - 1] = '\0';
}
@@ -352,7 +358,10 @@ conn_info(conn_t *conn)
strncpy(s, conn->http->headers, sizeof(s) - 1);
}
s[sizeof(s) - 1] = '\0';
- conn_set(conn, s);
+
+ if (!conn_set(conn, s)) {
+ return 0;
+ }
/* check if the download has been redirected to FTP and
* report it back to the caller */ Did it do it right ? do i need to make changes ? |
@shankar looks good; instead of "secure protocol is not supported" it could say "SSL support disabled". Send a PR and I'll merge it. |
Axel, when compiled without ssl and passed a http url argument that redirects to a https url, exits with
Too many redirects.
error.Steps to reproduce the bug:
Configure axel with
--without-ssl
option and compile.Curl output to get an idea of the redirections :
The text was updated successfully, but these errors were encountered: