From 2641b3fe207ad953d1d7d88acb3dbab3ae55e390 Mon Sep 17 00:00:00 2001 From: Alessandro Pasotti Date: Tue, 22 Jan 2019 12:14:42 +0100 Subject: [PATCH] Allow REQUEST_BODY in tests even if QGISDEBUG is off --- src/server/qgsfcgiserverrequest.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/qgsfcgiserverrequest.cpp b/src/server/qgsfcgiserverrequest.cpp index 185cc55014f..0d759c81508 100644 --- a/src/server/qgsfcgiserverrequest.cpp +++ b/src/server/qgsfcgiserverrequest.cpp @@ -139,7 +139,10 @@ void QgsFcgiServerRequest::readData() { bool success = false; int length = QString( lengthstr ).toInt( &success ); -#ifdef QGISDEBUG + // Note: REQUEST_BODY is not part of CGI standard, and it is not + // normally passed by any CGI web server and it is implemented only + // to allow unit tests to inject a request body and simulate a POST + // request const char *request_body = getenv( "REQUEST_BODY" ); if ( success && request_body ) { @@ -148,6 +151,7 @@ void QgsFcgiServerRequest::readData() mData.append( body.toUtf8() ); length = 0; } +#ifdef QGISDEBUG qDebug() << "fcgi: reading " << lengthstr << " bytes from " << ( request_body ? "REQUEST_BODY" : "stdin" ); #endif if ( success )