Skip to content

Commit

Permalink
Remove MS_HTTP_HEADER hack to use mapserv -nh existing mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Oct 2, 2014
1 parent e262f0e commit a10b31b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
20 changes: 13 additions & 7 deletions mapio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions mapio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions mapserv.c
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down

0 comments on commit a10b31b

Please sign in to comment.