Commit 7f78e6b4 authored by Rafaël Carré's avatar Rafaël Carré

httpd: whitespace

parent 3fb69dd7
...@@ -2036,30 +2036,30 @@ static void httpdLoop(httpd_host_t *host) ...@@ -2036,30 +2036,30 @@ static void httpdLoop(httpd_host_t *host)
switch( query->i_proto ) switch( query->i_proto )
{ {
case HTTPD_PROTO_HTTP: case HTTPD_PROTO_HTTP:
answer->i_version = 1; answer->i_version = 1;
httpd_MsgAdd(answer, "Allow", "GET,HEAD,POST,OPTIONS"); httpd_MsgAdd(answer, "Allow", "GET,HEAD,POST,OPTIONS");
break; break;
case HTTPD_PROTO_RTSP: case HTTPD_PROTO_RTSP:
answer->i_version = 0; answer->i_version = 0;
const char *p = httpd_MsgGet( query, "Cseq" ); const char *p = httpd_MsgGet( query, "Cseq" );
if( p != NULL ) if( p != NULL )
httpd_MsgAdd( answer, "Cseq", "%s", p ); httpd_MsgAdd( answer, "Cseq", "%s", p );
p = httpd_MsgGet( query, "Timestamp" ); p = httpd_MsgGet( query, "Timestamp" );
if( p != NULL ) if( p != NULL )
httpd_MsgAdd( answer, "Timestamp", "%s", p ); httpd_MsgAdd( answer, "Timestamp", "%s", p );
p = httpd_MsgGet( query, "Require" ); p = httpd_MsgGet( query, "Require" );
if( p != NULL ) { if( p != NULL ) {
answer->i_status = 551; answer->i_status = 551;
httpd_MsgAdd( query, "Unsupported", "%s", p ); httpd_MsgAdd( query, "Unsupported", "%s", p );
} }
httpd_MsgAdd( answer, "Public", "DESCRIBE,SETUP," httpd_MsgAdd( answer, "Public", "DESCRIBE,SETUP,"
"TEARDOWN,PLAY,PAUSE,GET_PARAMETER" ); "TEARDOWN,PLAY,PAUSE,GET_PARAMETER" );
break; break;
} }
cl->i_buffer = -1; /* Force the creation of the answer in cl->i_buffer = -1; /* Force the creation of the answer in
...@@ -2089,64 +2089,64 @@ static void httpdLoop(httpd_host_t *host) ...@@ -2089,64 +2089,64 @@ static void httpdLoop(httpd_host_t *host)
break; break;
default: { default: {
int i_msg = query->i_type; int i_msg = query->i_type;
bool b_auth_failed = false; bool b_auth_failed = false;
/* Search the url and trigger callbacks */ /* Search the url and trigger callbacks */
for(int i = 0; i < host->i_url; i++ ) { for(int i = 0; i < host->i_url; i++ ) {
httpd_url_t *url = host->url[i]; httpd_url_t *url = host->url[i];
if (strcmp(url->psz_url, query->psz_url)) if (strcmp(url->psz_url, query->psz_url))
continue; continue;
if (!url->catch[i_msg].cb) if (!url->catch[i_msg].cb)
continue; continue;
if (answer) { if (answer) {
b_auth_failed = !httpdAuthOk(url->psz_user, b_auth_failed = !httpdAuthOk(url->psz_user,
url->psz_password, url->psz_password,
httpd_MsgGet(query, "Authorization")); /* BASIC id */ httpd_MsgGet(query, "Authorization")); /* BASIC id */
if (b_auth_failed) if (b_auth_failed)
break; break;
} }
if (url->catch[i_msg].cb(url->catch[i_msg].p_sys, cl, answer, query)) if (url->catch[i_msg].cb(url->catch[i_msg].p_sys, cl, answer, query))
continue; continue;
if( answer->i_proto == HTTPD_PROTO_NONE ) if( answer->i_proto == HTTPD_PROTO_NONE )
cl->i_buffer = cl->i_buffer_size; /* Raw answer from a CGI */ cl->i_buffer = cl->i_buffer_size; /* Raw answer from a CGI */
else else
cl->i_buffer = -1; cl->i_buffer = -1;
/* only one url can answer */ /* only one url can answer */
answer = NULL; answer = NULL;
if( cl->url == NULL ) if( cl->url == NULL )
cl->url = url; cl->url = url;
} }
if( answer ) { if( answer ) {
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;
if( b_auth_failed ) { if( b_auth_failed ) {
httpd_MsgAdd( answer, "WWW-Authenticate", httpd_MsgAdd( answer, "WWW-Authenticate",
"Basic realm=\"VLC stream\"" ); "Basic realm=\"VLC stream\"" );
answer->i_status = 401; answer->i_status = 401;
} else } else
answer->i_status = 404; /* no url registered */ answer->i_status = 404; /* no url registered */
char *p; char *p;
answer->i_body = httpd_HtmlError (&p, answer->i_status, answer->i_body = httpd_HtmlError (&p, answer->i_status,
query->psz_url); query->psz_url);
answer->p_body = (uint8_t *)p; answer->p_body = (uint8_t *)p;
cl->i_buffer = -1; /* Force the creation of the answer in httpd_ClientSend */ cl->i_buffer = -1; /* Force the creation of the answer in httpd_ClientSend */
httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body ); httpd_MsgAdd( answer, "Content-Length", "%d", answer->i_body );
httpd_MsgAdd( answer, "Content-Type", "%s", "text/html" ); httpd_MsgAdd( answer, "Content-Type", "%s", "text/html" );
} }
cl->i_state = HTTPD_CLIENT_SENDING; cl->i_state = HTTPD_CLIENT_SENDING;
} }
} }
break; break;
} }
......
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