Commit 64964519 authored by Michael Hanselmann's avatar Michael Hanselmann Committed by Rémi Denis-Courmont

raop: Add loop for request retry

This loop will be used by authentication.
Signed-off-by: default avatarMichael Hanselmann <public@hansmi.ch>
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent be1e8e59
...@@ -793,37 +793,43 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method, ...@@ -793,37 +793,43 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method,
goto error; goto error;
} }
/* Send request */ while ( 1 )
i_err = SendRequest( p_this, psz_method, psz_content_type, psz_body,
p_req_headers);
if ( i_err != VLC_SUCCESS )
goto error;
/* Read status line */
i_status = ReadStatusLine( p_this );
if ( i_status < 0 )
{ {
i_err = i_status; /* Send request */
goto error; i_err = SendRequest( p_this, psz_method, psz_content_type, psz_body,
} p_req_headers);
vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
/* Read headers */
headers_done = 0;
while ( !headers_done )
{
i_err = ReadHeader( p_this, p_resp_headers, &headers_done );
if ( i_err != VLC_SUCCESS ) if ( i_err != VLC_SUCCESS )
goto error; goto error;
}
if ( i_status != 200 ) /* Read status line */
{ i_status = ReadStatusLine( p_this );
msg_Err( p_this, "Request failed (%s), status is %d", if ( i_status < 0 )
p_sys->psz_last_status_line, i_status ); {
i_err = VLC_EGENERIC; i_err = i_status;
goto error; goto error;
}
vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
/* Read headers */
headers_done = 0;
while ( !headers_done )
{
i_err = ReadHeader( p_this, p_resp_headers, &headers_done );
if ( i_err != VLC_SUCCESS )
goto error;
}
if ( i_status == 200 )
/* Request successful */
break;
else
{
msg_Err( p_this, "Request failed (%s), status is %d",
p_sys->psz_last_status_line, i_status );
i_err = VLC_EGENERIC;
goto error;
}
} }
error: error:
......
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