Skip to content

Commit

Permalink
Addressed Even's recommendations.
Browse files Browse the repository at this point in the history
  • Loading branch information
sdlime committed Feb 20, 2024
1 parent 4a054e4 commit aea4046
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
5 changes: 3 additions & 2 deletions etc/mapserver-sample.conf
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ CONFIG
# MS_ERRORFILE "/opt/mapserver/logs/mapserver.log"

#
# Global Error Redirect Handling (see web object docs)
# Global Error Redirect Handling
#
# MS_EMPTY "https://mapserver.org/"
# see https://mapserver.org/mapfile/web.html#EMPTY
# MS_EMPTY_URL "https://mapserver.org/"

#
# Default Map
Expand Down
2 changes: 1 addition & 1 deletion msautotest/query/6907_01.conf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CONFIG
ENV
MS_MAP_PATTERN "."
MS_EMPTY "http://localhost/6907_01.html"
MS_EMPTY_URL "http://localhost/6907_01.html"
END
END
6 changes: 3 additions & 3 deletions src/mapservutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,10 @@ void msCGIWriteError(mapservObj *mapserv) {

if ((ms_error->code == MS_NOTFOUND) &&
(mapserv->map->web.empty != NULL ||
CPLGetConfigOption("MS_EMPTY", NULL) != NULL)) {
CPLGetConfigOption("MS_EMPTY_URL", NULL) != NULL)) {
const char *url = mapserv->map->web.empty;
if (url == NULL)
url = CPLGetConfigOption("MS_EMPTY", NULL);
url = CPLGetConfigOption("MS_EMPTY_URL", NULL);
if (msReturnURL(mapserv, url, BROWSE) != MS_SUCCESS) {
msIO_setHeader("Content-Type", "text/html");
msIO_sendHeaders();
Expand Down Expand Up @@ -2000,7 +2000,7 @@ int msCGIDispatchQueryRequest(mapservObj *mapserv) {

/* catch empty result set when web->empty is set (#6907) */
if (mapserv->map->web.empty != NULL ||
CPLGetConfigOption("MS_EMPTY", NULL) != NULL) {
CPLGetConfigOption("MS_EMPTY_URL", NULL) != NULL) {
int n = 0;
for (int i = 0; i < mapserv->map->numlayers; i++) { // count results
if (mapserv->map->layers[i]->resultcache) {
Expand Down
2 changes: 1 addition & 1 deletion src/maptemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -4702,7 +4702,7 @@ int msReturnPage(mapservObj *mapserv, char *html, int mode,
return MS_SUCCESS;
}

int msReturnURL(mapservObj *ms, char *url, int mode) {
int msReturnURL(mapservObj *ms, const char *url, int mode) {
char *tmpurl;

if (url == NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/maptemplate.h
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ MS_DLL_EXPORT int checkWebScale(mapservObj *msObj);
MS_DLL_EXPORT int setExtent(mapservObj *msObj);

MS_DLL_EXPORT int msReturnPage(mapservObj *msObj, char *, int, char **);
MS_DLL_EXPORT int msReturnURL(mapservObj *msObj, char *, int);
MS_DLL_EXPORT int msReturnURL(mapservObj *msObj, const char *, int);
MS_DLL_EXPORT int msReturnNestedTemplateQuery(mapservObj *msObj,
char *pszMimeType,
char **papszBuffer);
Expand Down

0 comments on commit aea4046

Please sign in to comment.