Skip to content

Commit

Permalink
Force HTTP/1.1 for tests that query demo.mapserver.org to workaround …
Browse files Browse the repository at this point in the history
…current issue with it (#6858)

Co-authored-by: Even Rouault <even.rouault@spatialys.com>
  • Loading branch information
github-actions[bot] and rouault committed Apr 9, 2023
1 parent 9c5e0cb commit 8a9aebd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions maphttp.c
Expand Up @@ -484,6 +484,8 @@ int msHTTPExecuteRequests(httpRequestObj *pasReqInfo, int numRequests,
msDebug("Using CURL_CA_BUNDLE=%s\n", pszCurlCABundle);
}

const char* pszHttpVersion = CPLGetConfigOption("CURL_HTTP_VERSION", NULL);

/* Alloc a curl-multi handle, and add a curl-easy handle to it for each
* file to download.
*/
Expand Down Expand Up @@ -545,6 +547,13 @@ int msHTTPExecuteRequests(httpRequestObj *pasReqInfo, int numRequests,

unchecked_curl_easy_setopt(http_handle, CURLOPT_PROTOCOLS, CURLPROTO_HTTP|CURLPROTO_HTTPS );

if (pszHttpVersion && strcmp(pszHttpVersion, "1.0") == 0)
unchecked_curl_easy_setopt(http_handle, CURLOPT_HTTP_VERSION,
CURL_HTTP_VERSION_1_0);
else if (pszHttpVersion && strcmp(pszHttpVersion, "1.1") == 0)
unchecked_curl_easy_setopt(http_handle, CURLOPT_HTTP_VERSION,
CURL_HTTP_VERSION_1_1);

/* Set User-Agent (auto-generate if not set by caller */
if (pasReqInfo[i].pszUserAgent == NULL) {
curl_version_info_data *psCurlVInfo;
Expand Down
4 changes: 4 additions & 0 deletions msautotest/etc/mapserv.conf
Expand Up @@ -2,6 +2,10 @@ CONFIG
ENV
MS_MAP_PATTERN "."
MS_CONTEXT_PATTERN "ows_context\.xml"

# Workaround current issues with demo.mapserver.org with HTTP/2
CURL_HTTP_VERSION "1.1"

END
# following used by the mssql tests on Appveyor
PLUGINS
Expand Down

0 comments on commit 8a9aebd

Please sign in to comment.