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 )
{ {
answer->i_status = 551; case HTTPD_PROTO_HTTP:
httpd_MsgAdd( query, "Unsupported", "%s", psz ); httpd_MsgAdd( answer, "Allow",
} "GET,HEAD,POST,OPTIONS" );
break;
psz = httpd_MsgGet( query, "Cseq" ); case HTTPD_PROTO_RTSP:
if( psz != NULL ) {
httpd_MsgAdd( answer, "Cseq", "%s", psz ); const char *p;
psz = httpd_MsgGet( query, "Timestamp" ); answer->i_version = 0;
if( psz != NULL )
httpd_MsgAdd( answer, "Timestamp", "%s", psz ); 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;
httpd_MsgAdd( query, "Unsupported", "%s", p );
}
httpd_MsgAdd( answer, "Server", "%s", PACKAGE_STRING ); httpd_MsgAdd( answer, "Public", "DESCRIBE,SETUP,"
httpd_MsgAdd( answer, "Public", "DESCRIBE, SETUP, " "TEARDOWN,PLAY,PAUSE,GET_PARAMETER" );
"TEARDOWN, PLAY, PAUSE, GET_PARAMETER" ); }
httpd_MsgAdd( answer, "Content-Length", "0" ); break;
}
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