mirror of
https://github.com/mirror/wget.git
synced 2025-01-23 10:40:40 +08:00
[svn] Strip trailing whitespace in header_process().
Published in <sxsadvh0xpz.fsf@florida.arsdigita.de>.
This commit is contained in:
parent
46617228fa
commit
08c935bef2
@ -1,3 +1,8 @@
|
|||||||
|
2002-01-14 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
|
* headers.c (header_get): Strip trailing whitespace from the
|
||||||
|
header.
|
||||||
|
|
||||||
2002-01-14 Hrvoje Niksic <hniksic@arsdigita.com>
|
2002-01-14 Hrvoje Niksic <hniksic@arsdigita.com>
|
||||||
|
|
||||||
* url.c (parse_uname): URL-decode *USER and *PASSWD.
|
* url.c (parse_uname): URL-decode *USER and *PASSWD.
|
||||||
|
@ -64,8 +64,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
|||||||
as much memory as necessary for it to fit. It need not contain a
|
as much memory as necessary for it to fit. It need not contain a
|
||||||
`:', thus you can use it to retrieve, say, HTTP status line.
|
`:', thus you can use it to retrieve, say, HTTP status line.
|
||||||
|
|
||||||
The trailing CRLF or LF are stripped from the header, and it is
|
All trailing whitespace is stripped from the header, and it is
|
||||||
zero-terminated. #### Is this well-behaved? */
|
zero-terminated. */
|
||||||
int
|
int
|
||||||
header_get (struct rbuf *rbuf, char **hdr, enum header_get_flags flags)
|
header_get (struct rbuf *rbuf, char **hdr, enum header_get_flags flags)
|
||||||
{
|
{
|
||||||
@ -101,11 +101,13 @@ header_get (struct rbuf *rbuf, char **hdr, enum header_get_flags flags)
|
|||||||
if (next == '\t' || next == ' ')
|
if (next == '\t' || next == ' ')
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
/* The header ends. */
|
|
||||||
|
/* Strip trailing whitespace. (*hdr)[i] is the newline;
|
||||||
|
decrement I until it points to the last available
|
||||||
|
whitespace. */
|
||||||
|
while (i > 0 && ISSPACE ((*hdr)[i - 1]))
|
||||||
|
--i;
|
||||||
(*hdr)[i] = '\0';
|
(*hdr)[i] = '\0';
|
||||||
/* Get rid of '\r'. */
|
|
||||||
if (i > 0 && (*hdr)[i - 1] == '\r')
|
|
||||||
(*hdr)[i - 1] = '\0';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user