Commit 6c808bdb authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Fix Require header support

parent 1c07ad88
...@@ -1643,7 +1643,11 @@ static int RtspCallback( httpd_callback_sys_t *p_args, ...@@ -1643,7 +1643,11 @@ static int RtspCallback( httpd_callback_sys_t *p_args,
answer->p_body = NULL; answer->p_body = NULL;
if( httpd_MsgGet( query, "Require" ) != NULL ) if( httpd_MsgGet( query, "Require" ) != NULL )
{
answer->i_status = 551; answer->i_status = 551;
httpd_MsgAdd( query, "Unsupported", "%s",
httpd_MsgGet( query, "Require" ) );
}
else else
switch( query->i_type ) switch( query->i_type )
{ {
...@@ -1745,10 +1749,11 @@ static int RtspCallback( httpd_callback_sys_t *p_args, ...@@ -1745,10 +1749,11 @@ static int RtspCallback( httpd_callback_sys_t *p_args,
return VLC_EGENERIC; return VLC_EGENERIC;
} }
httpd_MsgAdd( answer, "Server", PACKAGE_STRING ); httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body ); httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
psz_cseq = httpd_MsgGet( query, "Cseq" ); psz_cseq = httpd_MsgGet( query, "Cseq" );
httpd_MsgAdd( answer, "Cseq", "%s", psz_cseq ? psz_cseq : "0" ); if( psz_cseq )
httpd_MsgAdd( answer, "Cseq", "%s", psz_cseq );
httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" ); httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" );
if( psz_session ) if( psz_session )
...@@ -1815,7 +1820,11 @@ static int RtspCallbackId( httpd_callback_sys_t *p_args, ...@@ -1815,7 +1820,11 @@ static int RtspCallbackId( httpd_callback_sys_t *p_args,
} }
if( httpd_MsgGet( query, "Require" ) != NULL ) if( httpd_MsgGet( query, "Require" ) != NULL )
{
answer->i_status = 551; answer->i_status = 551;
httpd_MsgAdd( query, "Unsupported", "%s",
httpd_MsgGet( query, "Require" ) );
}
else else
switch( query->i_type ) switch( query->i_type )
{ {
...@@ -1993,14 +2002,13 @@ static int RtspCallbackId( httpd_callback_sys_t *p_args, ...@@ -1993,14 +2002,13 @@ static int RtspCallbackId( httpd_callback_sys_t *p_args,
default: default:
answer->i_status = 460; answer->i_status = 460;
break; break;
return VLC_EGENERIC;
} }
httpd_MsgAdd( answer, "Server", PACKAGE_STRING );
httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
psz_cseq = httpd_MsgGet( query, "Cseq" ); psz_cseq = httpd_MsgGet( query, "Cseq" );
httpd_MsgAdd( answer, "Cseq", "%s", psz_cseq ? psz_cseq : "0"); if( psz_cseq )
httpd_MsgAdd( answer, "Cseq", "%s", psz_cseq );
httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" ); httpd_MsgAdd( answer, "Cache-Control", "%s", "no-cache" );
if( psz_session ) if( psz_session )
......
...@@ -2036,24 +2036,28 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2036,24 +2036,28 @@ static void httpd_HostThread( httpd_host_t *host )
} }
else if( i_msg == HTTPD_MSG_OPTIONS ) else if( i_msg == HTTPD_MSG_OPTIONS )
{ {
const char *psz_cseq; const char *psz;
/* unimplemented */ /* unimplemented */
answer->i_proto = query->i_proto ; answer->i_proto = query->i_proto ;
answer->i_type = HTTPD_MSG_ANSWER; answer->i_type = HTTPD_MSG_ANSWER;
answer->i_version= 0; answer->i_version= 0;
answer->i_status = 200; answer->i_status = 200;
answer->i_body = 0; answer->i_body = 0;
answer->p_body = NULL; answer->p_body = NULL;
psz_cseq = httpd_MsgGet( query, "Cseq" ); psz = httpd_MsgGet( query, "Cseq" );
httpd_MsgAdd( answer, "Cseq", "%s", psz_cseq ? psz_cseq : "0" ); if( psz != NULL )
httpd_MsgAdd( answer, "Server", "VLC Server" ); httpd_MsgAdd( answer, "Cseq", "%s", psz );
psz = httpd_MsgGet( query, "Require" );
if( psz != NULL )
httpd_MsgAdd( query, "Unsupported", "%s", psz );
httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
httpd_MsgAdd( answer, "Public", "DESCRIBE, SETUP, " httpd_MsgAdd( answer, "Public", "DESCRIBE, SETUP, "
"TEARDOWN, PLAY, PAUSE" ); "TEARDOWN, PLAY, PAUSE" );
httpd_MsgAdd( answer, "Content-Length", "%d", httpd_MsgAdd( answer, "Content-Length", "0" );
answer->i_body );
cl->i_buffer = -1; /* Force the creation of the answer in cl->i_buffer = -1; /* Force the creation of the answer in
* httpd_ClientSend */ * httpd_ClientSend */
......
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