Permalink
Browse files

Remove MS_HTTP_HEADER hack to use mapserv -nh existing mechanism

  • Loading branch information...
rouault committed Oct 2, 2014
1 parent e262f0e commit a10b31ba5fb9e45654b7980fa8d76f76ea25c8da
Showing with 15 additions and 7 deletions.
  1. +13 −7 mapio.c
  2. +1 −0 mapio.h
  3. +1 −0 mapserv.c
View
20 mapio.c
@@ -191,6 +191,19 @@ msIOContext *msIO_getHandler( FILE * fp )
return NULL;
}
/************************************************************************/
/* msIO_setHeaderEnabled() */
/************************************************************************/
void msIO_setHeaderEnabled(int bFlag)
{
is_msIO_header_enabled = bFlag;
}
/************************************************************************/
/* msIO_setHeader() */
/************************************************************************/
void msIO_setHeader (const char *header, const char* value, ...)
{
va_list args;
@@ -213,8 +226,6 @@ void msIO_setHeader (const char *header, const char* value, ...)
}
} else {
#endif // MOD_WMS_ENABLED
if( !is_msIO_initialized )
msIO_Initialize();
if( is_msIO_header_enabled ) {
msIO_fprintf(stdout,"%s: ",header);
msIO_vfprintf(stdout,value,args);
@@ -530,11 +541,6 @@ static void msIO_Initialize( void )
if( is_msIO_initialized == MS_TRUE )
return;
pszStripHTTPHeader = getenv("MS_HTTP_HEADER");
is_msIO_header_enabled = ( pszStripHTTPHeader == NULL ||
strcasecmp(pszStripHTTPHeader, "YES") == 0 ||
strcasecmp(pszStripHTTPHeader, "ON") == 0 );
default_contexts.stdin_context.label = "stdio";
default_contexts.stdin_context.write_channel = MS_FALSE;
default_contexts.stdin_context.readWriteFunc = msIO_stdioRead;
View
@@ -75,6 +75,7 @@ extern "C" {
msIOContext *stdout_context,
msIOContext *stderr_context );
msIOContext MS_DLL_EXPORT *msIO_getHandler( FILE * );
void msIO_setHeaderEnabled(int bFlag);
void msIO_setHeader (const char *header, const char* value, ...) MS_PRINT_FUNC_FORMAT(2,3);
void msIO_sendHeaders(void);
View
@@ -170,6 +170,7 @@ int main(int argc, char *argv[])
exit(0);
} else if(strcmp(argv[iArg], "-nh") == 0) {
sendheaders = MS_FALSE;
msIO_setHeaderEnabled( MS_FALSE );
} else if( strncmp(argv[iArg], "QUERY_STRING=", 13) == 0 ) {
/* Debugging hook... pass "QUERY_STRING=..." on the command-line */
putenv( "REQUEST_METHOD=GET" );

0 comments on commit a10b31b

Please sign in to comment.