added: to config: 'content_type_header' parameter

the kind of "Content-Type" header send to the client
       if utf8 is enabled then 'charset=UTF-8' will also be appended
added: to templates: an index pattern for 'rawcontent'
       used when 'rawcontent' parameter is present
       by default the template has only one [content] ezc function
       useful in AJAX requests       


git-svn-id: svn://ttmath.org/publicrep/winix/trunk@784 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2011-12-17 21:59:22 +00:00
parent fe2f1605f1
commit fa05e25a9d
6 changed files with 92 additions and 22 deletions

View File

@@ -667,12 +667,35 @@ void App::SendHeadersStatic()
}
void App::SendHeaderContentType()
{
switch( config.content_type_header )
{
case 1:
FCGX_PutS("Content-Type: application/xhtml+xml", fcgi_request.out);
break;
case 2:
FCGX_PutS("Content-Type: application/xml", fcgi_request.out);
break;
case 0:
default:
FCGX_PutS("Content-Type: text/html", fcgi_request.out);
}
if( config.utf8 )
FCGX_PutS("; charset=UTF-8", fcgi_request.out);
FCGX_PutS("\r\n", fcgi_request.out);
}
void App::SendHeadersForbidden()
{
FCGX_PutS("Status: 403 Forbidden\r\n", fcgi_request.out);
FCGX_PutS("Content-Type: text/html\r\n", fcgi_request.out);
SendHeaderContentType();
log << log2 << "App: response: 403 Forbidden" << logend;
}
@@ -739,7 +762,7 @@ void App::SendHeadersNormal(Header header)
{
case h_404:
FCGX_PutS("Status: 404 Not Found\r\n", fcgi_request.out);
FCGX_PutS("Content-Type: text/html\r\n", fcgi_request.out);
SendHeaderContentType();
log << log2 << "App: response: 404 Not Found" << logend;
break;
@@ -751,7 +774,7 @@ void App::SendHeadersNormal(Header header)
FCGX_PutS("Status: 200 OK\r\n", fcgi_request.out);
if( cur.request->role != Request::authorizer )
FCGX_PutS("Content-Type: text/html\r\n", fcgi_request.out);
SendHeaderContentType();
}
}