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

Handle HTTP OPTIONS

parent 50e9af20
...@@ -2040,36 +2040,47 @@ static void httpd_HostThread( httpd_host_t *host ) ...@@ -2040,36 +2040,47 @@ 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;
/* unimplemented */
answer->i_proto = query->i_proto;
answer->i_type = HTTPD_MSG_ANSWER; answer->i_type = HTTPD_MSG_ANSWER;
answer->i_version= 0; answer->i_proto = query->i_proto;
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 = httpd_MsgGet( query, "Require" ); httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
if( psz != NULL ) httpd_MsgAdd( answer, "Content-Length", "0" );
switch( query->i_proto )
{
case HTTPD_PROTO_HTTP:
httpd_MsgAdd( answer, "Allow",
"GET,HEAD,POST,OPTIONS" );
break;
case HTTPD_PROTO_RTSP:
{
const char *p;
answer->i_version = 0;
p = httpd_MsgGet( query, "Cseq" );
if( p != NULL )
httpd_MsgAdd( answer, "Cseq", "%s", p );
p = httpd_MsgGet( query, "Timestamp" );
if( p != NULL )
httpd_MsgAdd( answer, "Timestamp", "%s", p );
p = httpd_MsgGet( query, "Require" );
if( p != NULL )
{ {
answer->i_status = 551; answer->i_status = 551;
httpd_MsgAdd( query, "Unsupported", "%s", psz ); httpd_MsgAdd( query, "Unsupported", "%s", p );
} }
psz = httpd_MsgGet( query, "Cseq" ); httpd_MsgAdd( answer, "Public", "DESCRIBE,SETUP,"
if( psz != NULL ) "TEARDOWN,PLAY,PAUSE,GET_PARAMETER" );
httpd_MsgAdd( answer, "Cseq", "%s", psz ); }
psz = httpd_MsgGet( query, "Timestamp" ); break;
if( psz != NULL ) }
httpd_MsgAdd( answer, "Timestamp", "%s", psz );
httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING );
httpd_MsgAdd( answer, "Public", "DESCRIBE, SETUP, "
"TEARDOWN, PLAY, PAUSE, GET_PARAMETER" );
httpd_MsgAdd( answer, "Content-Length", "0" );
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