meson: Rollback libmicrohttpd >= 0.9.40
Ubuntu 18.04 (bionic) should continue to be supported until April 2023. So I modified mhd_server to support older versions of libmicrohttpd.
This commit is contained in:
parent
6c5a8a135a
commit
9d94b33c7b
|
@ -31,7 +31,7 @@ if metrics_impl_optval == 'prometheus'
|
|||
# 0.50.0: {'CMake Module'}
|
||||
# 0.51.0: {'subproject'}
|
||||
|
||||
libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.61')
|
||||
libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.40')
|
||||
|
||||
cmake = import('cmake')
|
||||
prometheus_client_c_proj = cmake.subproject('prometheus-client-c')
|
||||
|
|
|
@ -49,7 +49,7 @@ sbi_cc_flags = ['-DOGS_SBI_COMPILATION']
|
|||
|
||||
libgnutls_dep = cc.find_library('gnutls', required : true)
|
||||
libnghttp2_dep = dependency('libnghttp2', version: '>=1.18.1')
|
||||
libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.61')
|
||||
libmicrohttpd_dep = dependency('libmicrohttpd', version: '>=0.9.40')
|
||||
libcurl_dep = dependency('libcurl', version: '>=7.52.1')
|
||||
|
||||
libsbi = library('ogssbi',
|
||||
|
|
|
@ -289,10 +289,12 @@ static void server_stop(ogs_sbi_server_t *server)
|
|||
}
|
||||
}
|
||||
|
||||
#if MHD_VERSION >= 0x00096100
|
||||
static void free_callback(void *cls)
|
||||
{
|
||||
ogs_free(cls);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool server_send_response(
|
||||
ogs_sbi_stream_t *stream, ogs_sbi_response_t *response)
|
||||
|
@ -330,6 +332,7 @@ static bool server_send_response(
|
|||
ogs_assert(mhd_socket != INVALID_SOCKET);
|
||||
|
||||
if (response->http.content) {
|
||||
#if MHD_VERSION >= 0x00096100
|
||||
mhd_response = MHD_create_response_from_buffer_with_free_callback(
|
||||
response->http.content_length, response->http.content,
|
||||
free_callback);
|
||||
|
@ -343,6 +346,12 @@ static bool server_send_response(
|
|||
* So, we'll set response->http.content to NULL.
|
||||
*/
|
||||
response->http.content = NULL;
|
||||
#else
|
||||
mhd_response = MHD_create_response_from_buffer(
|
||||
response->http.content_length, response->http.content,
|
||||
MHD_RESPMEM_MUST_COPY);
|
||||
ogs_assert(mhd_response);
|
||||
#endif
|
||||
|
||||
} else {
|
||||
mhd_response = MHD_create_response_from_buffer(
|
||||
|
|
Loading…
Reference in New Issue