mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
Fix for -setHTTPMaximumConnectionLifetime:
This commit is contained in:
parent
713c7c0f7e
commit
782e7aed31
6 changed files with 48 additions and 5 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
2021-05-05 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* configure.ac: Check for declaration of CURLOPT_MAXAGE_CONN
|
||||
* configure: regenerate
|
||||
* Headers/GNUstepBase/config.h.in: regenerate
|
||||
* Source/NSURLSession.m: Use HAVE_DECL_CURLOPT_MAXAGE_CONN to tell
|
||||
whether -setHTTPMaximumConnectionLifetime: can be implemented.
|
||||
* Tests/base/NSURLSession/test02.m: Add a testcase (hope) to see if
|
||||
-setHTTPMaximumConnectionLifetime: is supported.
|
||||
|
||||
2021-04-26 Ivan Vucica <ivan@vucica.net>
|
||||
|
||||
* ChangeLog:
|
||||
|
|
|
@ -204,6 +204,10 @@
|
|||
/* Define to 1 if you have the <dbghelp.h> header file. */
|
||||
#undef HAVE_DBGHELP_H
|
||||
|
||||
/* Define to 1 if you have the declaration of `CURLOPT_MAXAGE_CONN', and to 0
|
||||
if you don't. */
|
||||
#undef HAVE_DECL_CURLOPT_MAXAGE_CONN
|
||||
|
||||
/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
|
||||
don't. */
|
||||
#undef HAVE_DECL_STRERROR_R
|
||||
|
|
|
@ -1175,13 +1175,14 @@ static NSURLSessionConfiguration *def = nil;
|
|||
|
||||
- (void) setHTTPMaximumConnectionLifetime: (NSInteger)n
|
||||
{
|
||||
#if !defined(CURLOPT_MAXAGE_CONN)
|
||||
#if HAVE_DECL_CURLOPT_MAXAGE_CONN
|
||||
_HTTPMaximumConnectionLifetime = n;
|
||||
#else
|
||||
[NSException raise: NSInternalInconsistencyException
|
||||
format: @"-[%@ %@] not supported by the version of Curl"
|
||||
@" this library was built with",
|
||||
NSStringFromClass([self class]), NSStringFromSelector(_cmd)];
|
||||
#endif
|
||||
_HTTPMaximumConnectionLifetime = n;
|
||||
}
|
||||
|
||||
- (BOOL) HTTPShouldUsePipelining
|
||||
|
|
|
@ -37,7 +37,7 @@ int main()
|
|||
[server start: nil]; // localhost:1234 HTTP
|
||||
|
||||
|
||||
NSURLSessionConfiguration *defaultConfigObject;
|
||||
NSURLSessionConfiguration *configuration;
|
||||
NSURLSession *defaultSession;
|
||||
NSURLSessionDataTask *dataTask;
|
||||
NSMutableURLRequest *urlRequest;
|
||||
|
@ -46,12 +46,23 @@ int main()
|
|||
NSString *params;
|
||||
MyDelegate *object;
|
||||
|
||||
configuration = [[NSURLSessionConfiguration alloc] init];
|
||||
[configuration setHTTPShouldUsePipelining: YES];
|
||||
|
||||
testHopeful=YES;
|
||||
PASS_RUNS([configuration setHTTPMaximumConnectionLifetime: 42];,
|
||||
"-setHTTPMaximumConnectionLifetime: support available in CURL")
|
||||
testHopeful=NO;
|
||||
|
||||
[configuration setHTTPMaximumConnectionsPerHost: 1];
|
||||
[configuration setRequestCachePolicy: NSURLCacheStorageNotAllowed];
|
||||
|
||||
object = AUTORELEASE([MyDelegate new]);
|
||||
mainQueue = [NSOperationQueue mainQueue];
|
||||
defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||
defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject
|
||||
defaultSession = [NSURLSession sessionWithConfiguration: configuration
|
||||
delegate: object
|
||||
delegateQueue: mainQueue];
|
||||
RELEASE(configuration);
|
||||
url = [NSURL URLWithString: @"http://localhost:1234/xxx"];
|
||||
params = @"dummy=true";
|
||||
urlRequest = [NSMutableURLRequest requestWithURL: url];
|
||||
|
|
14
configure
vendored
14
configure
vendored
|
@ -13390,6 +13390,20 @@ fi
|
|||
|
||||
fi
|
||||
if test $HAVE_LIBCURL = 1; then
|
||||
# Check for Curl capabilities we may use in NSURLSession
|
||||
ac_fn_c_check_decl "$LINENO" "CURLOPT_MAXAGE_CONN" "ac_cv_have_decl_CURLOPT_MAXAGE_CONN" "#include <curl/curl.h>
|
||||
"
|
||||
if test "x$ac_cv_have_decl_CURLOPT_MAXAGE_CONN" = xyes; then :
|
||||
ac_have_decl=1
|
||||
else
|
||||
ac_have_decl=0
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_DECL_CURLOPT_MAXAGE_CONN $ac_have_decl
|
||||
_ACEOF
|
||||
|
||||
|
||||
# If curl supports runtime selection of the TLS module we will need
|
||||
# to use curl_global_sslset to pick GNUTLS
|
||||
for ac_func in curl_global_sslset
|
||||
|
|
|
@ -3574,6 +3574,9 @@ if test $HAVE_LIBCURL = 1; then
|
|||
[#include <curl/curl.h>])
|
||||
fi
|
||||
if test $HAVE_LIBCURL = 1; then
|
||||
# Check for Curl capabilities we may use in NSURLSession
|
||||
AC_CHECK_DECLS(CURLOPT_MAXAGE_CONN,,, [#include <curl/curl.h>])
|
||||
|
||||
# If curl supports runtime selection of the TLS module we will need
|
||||
# to use curl_global_sslset to pick GNUTLS
|
||||
AC_CHECK_FUNCS(curl_global_sslset)
|
||||
|
|
Loading…
Reference in a new issue