help
Support authenticated HTTP transfers.
+config CONFIG_FEATURE_WGET_IP6_LITERAL
+ bool " Enable IPv6 literal addresses"
+ default y
+ depends on CONFIG_WGET
+ help
+ Support IPv6 address literal notation in URLs.
+
source networking/udhcp/Config.in
endmenu
* Send HTTP request.
*/
if (proxy) {
- fprintf(sfp, "GET %stp://%s:%d/%s HTTP/1.1\r\n",
+ const char *format = "GET %stp://%s:%d/%s HTTP/1.1\r\n";
+#ifdef CONFIG_FEATURE_WGET_IP6_LITERAL
+ if (strchr (target.host, ':'))
+ format = "GET %stp://[%s]:%d/%s HTTP/1.1\r\n";
+#endif
+ fprintf(sfp, format,
target.is_ftp ? "f" : "ht", target.host,
target.port, target.path);
} else {
void parse_url(char *url, struct host_info *h)
{
- char *cp, *sp, *up;
+ char *cp, *sp, *up, *pp;
if (strncmp(url, "http://", 7) == 0) {
h->port = 80;
} else
h->user = NULL;
- cp = strchr(h->host, ':');
+ pp = h->host;
+
+#ifdef CONFIG_FEATURE_WGET_IP6_LITERAL
+ if (h->host[0] == '[') {
+ char *ep;
+
+ ep = h->host + 1;
+ while (*ep == ':' || isdigit (*ep))
+ ep++;
+ if (*ep == ']') {
+ h->host++;
+ *ep = '\0';
+ pp = ep + 1;
+ }
+ }
+#endif
+
+ cp = strchr(pp, ':');
if (cp != NULL) {
*cp++ = '\0';
h->port = atoi(cp);
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: wget.c,v 1.57 2003/08/29 06:25:04 bug1 Exp $
+ * $Id: wget.c,v 1.58 2003/09/10 23:52:15 bug1 Exp $
*/