Commit 3ca77004 authored by Rui Zhang's avatar Rui Zhang Committed by Rémi Denis-Courmont

http: trim trailing space in field content

Fix incorrect redirection given in "Location: http://host/path "
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
(cherry picked from commit a05aca783e3b2a03f839d2141ee64ee835ebf1cc)
parent b60db54c
......@@ -1374,6 +1374,7 @@ static int Request( access_t *p_access, uint64_t i_tell )
{
char *psz = net_Gets( p_access, p_sys->fd, pvs );
char *p;
char *p_trailing;
if( psz == NULL )
{
......@@ -1401,7 +1402,19 @@ static int Request( access_t *p_access, uint64_t i_tell )
goto error;
}
*p++ = '\0';
while( *p == ' ' ) p++;
p += strspn( p, " \t" );
/* trim trailing white space */
p_trailing = p + strlen( p );
if( p_trailing > p )
{
p_trailing--;
while( ( *p_trailing == ' ' || *p_trailing == '\t' ) && p_trailing > p )
{
*p_trailing = '\0';
p_trailing--;
}
}
if( !strcasecmp( psz, "Content-Length" ) )
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment