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

raop: Always pass dictionaries for request and response headers

Authentication will need this.
Signed-off-by: default avatarMichael Hanselmann <public@hansmi.ch>
Signed-off-by: default avatarRémi Denis-Courmont <remi@remlab.net>
parent 08c47fec
...@@ -644,7 +644,7 @@ static int ReadHeader( vlc_object_t *p_this, ...@@ -644,7 +644,7 @@ static int ReadHeader( vlc_object_t *p_this,
/* Empty line for response end */ /* Empty line for response end */
if ( psz_line[0] == '\0' ) if ( psz_line[0] == '\0' )
*done = 1; *done = 1;
else if ( p_resp_headers ) else
{ {
psz_original = strdup( psz_line ); psz_original = strdup( psz_line );
psz_next = psz_line; psz_next = psz_line;
...@@ -755,12 +755,9 @@ static int SendRequest( vlc_object_t *p_this, const char *psz_method, ...@@ -755,12 +755,9 @@ static int SendRequest( vlc_object_t *p_this, const char *psz_method,
} }
} }
if ( p_req_headers )
{
i_err = WriteAuxHeaders( p_this, p_req_headers ); i_err = WriteAuxHeaders( p_this, p_req_headers );
if ( i_err != VLC_SUCCESS ) if ( i_err != VLC_SUCCESS )
goto error; goto error;
}
i_rc = net_Write( p_this, p_sys->i_control_fd, NULL, i_rc = net_Write( p_this, p_sys->i_control_fd, NULL,
psz_headers_end, sizeof( psz_headers_end ) - 1 ); psz_headers_end, sizeof( psz_headers_end ) - 1 );
...@@ -810,7 +807,6 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method, ...@@ -810,7 +807,6 @@ static int ExecRequest( vlc_object_t *p_this, const char *psz_method,
goto error; goto error;
} }
if ( p_resp_headers )
vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL ); vlc_dictionary_clear( p_resp_headers, FreeHeader, NULL );
/* Read headers */ /* Read headers */
...@@ -1044,34 +1040,46 @@ error: ...@@ -1044,34 +1040,46 @@ error:
static int SendFlush( vlc_object_t *p_this ) static int SendFlush( vlc_object_t *p_this )
{ {
VLC_UNUSED( p_this ); VLC_UNUSED( p_this );
vlc_dictionary_t resp_headers;
vlc_dictionary_t req_headers; vlc_dictionary_t req_headers;
int i_err = VLC_SUCCESS; int i_err = VLC_SUCCESS;
vlc_dictionary_init( &req_headers, 0 ); vlc_dictionary_init( &req_headers, 0 );
vlc_dictionary_init( &resp_headers, 0 );
vlc_dictionary_insert( &req_headers, "RTP-Info", vlc_dictionary_insert( &req_headers, "RTP-Info",
(void *)"seq=0;rtptime=0" ); (void *)"seq=0;rtptime=0" );
i_err = ExecRequest( p_this, "FLUSH", NULL, NULL, &req_headers, NULL ); i_err = ExecRequest( p_this, "FLUSH", NULL, NULL,
&req_headers, &resp_headers );
if ( i_err != VLC_SUCCESS ) if ( i_err != VLC_SUCCESS )
goto error; goto error;
error: error:
vlc_dictionary_clear( &req_headers, NULL, NULL ); vlc_dictionary_clear( &req_headers, NULL, NULL );
vlc_dictionary_clear( &resp_headers, FreeHeader, NULL );
return i_err; return i_err;
} }
static int SendTeardown( vlc_object_t *p_this ) static int SendTeardown( vlc_object_t *p_this )
{ {
vlc_dictionary_t resp_headers;
vlc_dictionary_t req_headers;
int i_err = VLC_SUCCESS; int i_err = VLC_SUCCESS;
i_err = ExecRequest( p_this, "TEARDOWN", NULL, NULL, NULL, NULL ); vlc_dictionary_init( &req_headers, 0 );
vlc_dictionary_init( &resp_headers, 0 );
i_err = ExecRequest( p_this, "TEARDOWN", NULL, NULL,
&req_headers, &resp_headers );
if ( i_err != VLC_SUCCESS ) if ( i_err != VLC_SUCCESS )
goto error; goto error;
error: error:
vlc_dictionary_clear( &req_headers, NULL, NULL );
vlc_dictionary_clear( &resp_headers, FreeHeader, NULL );
return i_err; return i_err;
} }
...@@ -1080,12 +1088,14 @@ static int UpdateVolume( vlc_object_t *p_this ) ...@@ -1080,12 +1088,14 @@ static int UpdateVolume( vlc_object_t *p_this )
sout_stream_t *p_stream = (sout_stream_t*)p_this; sout_stream_t *p_stream = (sout_stream_t*)p_this;
sout_stream_sys_t *p_sys = p_stream->p_sys; sout_stream_sys_t *p_sys = p_stream->p_sys;
vlc_dictionary_t req_headers; vlc_dictionary_t req_headers;
vlc_dictionary_t resp_headers;
char *psz_parameters = NULL; char *psz_parameters = NULL;
double d_volume; double d_volume;
int i_err = VLC_SUCCESS; int i_err = VLC_SUCCESS;
int i_rc; int i_rc;
vlc_dictionary_init( &req_headers, 0 ); vlc_dictionary_init( &req_headers, 0 );
vlc_dictionary_init( &resp_headers, 0 );
/* Our volume is 0..255, RAOP is -144..0 (-144 off, -30..0 on) */ /* Our volume is 0..255, RAOP is -144..0 (-144 off, -30..0 on) */
...@@ -1110,12 +1120,13 @@ static int UpdateVolume( vlc_object_t *p_this ) ...@@ -1110,12 +1120,13 @@ static int UpdateVolume( vlc_object_t *p_this )
i_err = ExecRequest( p_this, "SET_PARAMETER", i_err = ExecRequest( p_this, "SET_PARAMETER",
"text/parameters", psz_parameters, "text/parameters", psz_parameters,
&req_headers, NULL ); &req_headers, &resp_headers );
if ( i_err != VLC_SUCCESS ) if ( i_err != VLC_SUCCESS )
goto error; goto error;
error: error:
vlc_dictionary_clear( &req_headers, NULL, NULL ); vlc_dictionary_clear( &req_headers, NULL, NULL );
vlc_dictionary_clear( &resp_headers, FreeHeader, NULL );
free( psz_parameters ); free( psz_parameters );
return i_err; return i_err;
......
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