curl-users
Re: Spaces in redirects
Date: Fri, 06 Jun 2003 04:01:56 -0500
I decided to have a go at patching it up myself. The attached diff patches
lib/transfer.c to replace spaces with plus-signs in the redirect url. This
is against curl-7.10.5.
BTW, it works just great - I can now get past the login and pull subsequent
pages.
Ralph
Ralph Mitchell wrote:
> I've just run into a problem with a Weblogic server I'm trying to pull
> pages from. During the login POST, I get back several redirects, one of
> which contains this partial string:
>
> &resp=Authentication Successfull&pwd_exp_date=7/20/2003 3:57:04 PM
>
> Curl happily follows the first redirect, then tries the second, which
> gets cut off at the space before "Successful".
>
> I realize this is probably a mal-formed redirect, probably innocently
> caused by the company code-monkeys, and I'm trying to get them to see
> the light and fix it. However...
>
> Would it be unreasonable to replace space with + when following the
> redirect? I've looked at that section of transfer.c (line 721) and
> found that the redirect url is being copied to the end, or to the first
> space, whichever comes first. I didn't think anything would follow the
> url on a Location: line, so that kinda seems a little odd.
>
> So, am I wrong, and could there be something after the redirect url? If
> so, then it's reasonable to cut off after the space. If not, could this
> be altered to replace spaces with pluses, or is that a big policy no-no?
>
> Ralph Mitchell
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
*** lib/transfer.c Fri Jun 6 03:55:59 2003
--- lib/transfer.c.new Fri Jun 6 03:56:36 2003
***************
*** 718,725 ****
ptr = start; /* start scanning here */
/* scan through the string to find the end */
! while(*ptr && !isspace((int)*ptr))
ptr++;
backup = *ptr; /* store the ending letter */
if(ptr != start) {
*ptr = '\0'; /* zero terminate */
--- 718,728 ----
ptr = start; /* start scanning here */
/* scan through the string to find the end */
! while(*ptr) {
! if (isblank((int)*ptr)) *ptr = '+';
! if (isspace((int)*ptr)) break;
ptr++;
+ }
backup = *ptr; /* store the ending letter */
if(ptr != start) {
*ptr = '\0'; /* zero terminate */
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
Received on 2003-06-06