curl-library
CR/LF in URL
From: Jeff Pohlmeyer <yetanothergeek_at_gmail.com>
Date: Mon, 10 Apr 2006 06:51:11 -0500
Date: Mon, 10 Apr 2006 06:51:11 -0500
Using bash, I tried to do something like this:
--- curl -l ftp://ftp.gtk.org/pub/gtk/perl/ | while read FILENAME do curl -sSO ftp://ftp.gtk.org/pub/gtk/perl/$FILENAME done --- And I get this: curl: (3) URL using bad/illegal format or missing URL curl: (3) URL using bad/illegal format or missing URL curl: (3) URL using bad/illegal format or missing URL etc... The problem is that the the ftp LIST response is in CR/LF format, and the bash 'read' strips the LF, but not the CR. I suppose that's my mistake, but it sure took me a while to figure out what I was doing wrong! Is there any reason why curl shouldn't strip the CR if it finds one? This patch may be a bit too simplistic, but it seems to solve the problem: --- main.c.OLD 2006-04-10 06:35:53.133455408 -0500 +++ main.c.NEW 2006-04-10 06:35:43.724885728 -0500 @@ -3793,6 +3793,7 @@ /* size of uploaded file: */ curl_easy_setopt(curl, CURLOPT_INFILESIZE_LARGE, uploadfilesize); + if ( strchr(url, 0xd) ) *strchr(url, 0xd)=0x0; curl_easy_setopt(curl, CURLOPT_URL, url); /* what to fetch */ curl_easy_setopt(curl, CURLOPT_PROXY, config->proxy); /* proxy to use */ curl_easy_setopt(curl, CURLOPT_HEADER, config->conf&CONF_HEADER); - JeffReceived on 2006-04-10