Merge branch 'master' into nscalendar-withIdentifier

This commit is contained in:
Fred Kiefer 2018-06-15 10:02:10 +02:00 committed by GitHub
commit a6106f550e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 222 additions and 17 deletions

View file

@ -3,6 +3,55 @@
* Source/NSCalendar.m (calendarWithIdentifier:):
New convenience method implemented by Cocoa.
2018-05-29 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSObject.m: avoid static initialisation macro for allocation
locks in case some systems implement it in a way that doesn't work
after static initialisation takes place.
2018-05-27 Fred Kiefer <fredkiefer@gmx.de>
* Tests/base/NSProcessInfo/general.m: Mark test for -systemUptime
as hopeful as it may fail in GNU Hurd.
Fixes bug #53941.
Based on idea by Yavor Doganov <yavor@gnu.org>
2018-05-21 Fred Kiefer <fredkiefer@gmx.de>
* Source/GSConcreteValueTemplate.m: Add hack to make point and
size subclasses for NSValue interchangable.
2018-05-20 Ivan Vucica <ivan@vucica.net>
* Source/NSThread.m:
Fix typo in code branch for platforms without pthread_spin_lock().
Check for value of HAVE_PTHREAD_SPIN_LOCK instead of whether the
macro is defined.
2018-05-18 Richard Frith-Macdonald <rfm@gnu.org>
* Tools/gdnc.m: Remove a little unused code
* Headers/Foundation/NSFileHandle.h:
* Source/GSHTTPURLHandle.m:
* Source/GSSocketStream.m:
* Source/GSTLS.h:
* Source/GSTLS.m:
* Source/NSURLProtocol.m:
Add support for TLS SNI (Server Name Indication) and a new option
(GSTLSServerName) to control what name (if any) is passed in the TLS
handshake.
2018-05-17 Yavor Doganov <yavor@gnu.org>
* Tests/base/NSNumberFormatter/basic10_4.m: Avoid test failure on
big-endian platforms by converting unichar to an NSString.
2018-05-10 Fred Kiefer <fredkiefer@gmx.de>
* Tools/pl2link.m (main): Don't write deprecated fields to desktop
link file.
Patch by: Josh Freeman <gnustep_lists@twilightedge.com>
2018-04-24 Richard Frith-Macdonald <rfm@gnu.org>
* configure: regenerate

View file

@ -287,7 +287,7 @@ GS_EXPORT NSString * const NSFileHandleOperationException;
* be set.<br />
* You may use the same options as property settings with the GNUstep
* implementation of NSStream.<br />
* Expects key value pairs with the follwing names/meanings:
* Expects key value pairs with the following names/meanings:
* <deflist>
* <term>GSTLSCAFile</term>
* <desc>A string identifying the full path to the file containing any
@ -330,6 +330,18 @@ GS_EXPORT NSString * const NSFileHandleOperationException;
* information for certificates issued by our trusted authorites but
* no longer valid.
* </desc>
* <term>GSTLSServerName</term>
* <desc>By default the TLS layer when making an HTTPS request sets the
* 'Server Name Indication' (SNI) to be the name of the host in the URL
* that is being fetched.<br />
* This option allows the SNI to be set for other connections and permits
* overriding of the default behavior for HTTPS requests. Setting the
* value of GSTLSServerName to an empty string will prevent the SNI from
* being sent in the TLS handshake (this is sometimes desirable to prevent
* information leakage; the SNI information is sent unencrypted).<br />
* Some web servers require SNI in order to tell what hostname an HTTPS
* request is for and decide which certificate to present to the client.
* </desc>
* <term>GSTLSVerify</term>
* <desc>A boolean specifying whether we should require the remote end to
* supply a valid certificate in order to establish an encrypted connection.
@ -386,6 +398,11 @@ GS_EXPORT NSString * const GSTLSRemoteHosts;
*/
GS_EXPORT NSString * const GSTLSRevokeFile;
/** Dictionary key for the value controlling the Server Name Indication
* (SNI) sent as part of the TLS handshake.
*/
GS_EXPORT NSString * const GSTLSServerName;
/** Dictionary key for a boolean to enable certificate verification.
*/
GS_EXPORT NSString * const GSTLSVerify;

View file

@ -55,7 +55,7 @@ base-resources_INSTALL_DIR = $(GNUSTEP_LIBRARY)/Libraries/gnustep-base/Versions/
endif
base-resources_LANGUAGES = English German French Italian TraditionalChinese \
Spanish Esperanto Korean
Spanish Esperanto Korean Japanese
base-resources_LOCALIZED_RESOURCE_FILES = Localizable.strings
base-resources_RESOURCE_DIRS = Languages GSTLS
base-resources_RESOURCE_FILES = \
@ -75,7 +75,8 @@ Languages/TraditionalChinese \
Languages/Slovak \
Languages/Ukrainian \
Languages/Esperanto \
Languages/Korean
Languages/Korean \
Languages/Japanese
LANGUAGE_INSTALL_FILES = $(LANGUAGE_FILES) Languages/Locale.aliases \
Languages/Locale.encodings Languages/Locale.canonical

View file

@ -0,0 +1,34 @@
/* Japanese string encodings */
GSUndefinedEncoding = "Unknown";
NSProprietaryStringEncoding = "Installation-specific";
NSASCIIStringEncoding = "7 bit ASCII";
NSNonLossyASCIIStringEncoding = "Non-lossy ASCII (7 bit)";
NSMacOSRomanStringEncoding = "MacOS Roman";
NSNEXTSTEPStringEncoding = "NEXTSTEP";
NSSymbolStringEncoding = "Adobe Symbol";
NSWindowsCP1251StringEncoding = "Windows \u30ad\u30ea\u30eb\u8a9e (CP1251)";
NSWindowsCP1252StringEncoding = "Windows Latin-1 (CP1252)";
NSWindowsCP1253StringEncoding = "Windows \u30ae\u30ea\u30b7\u30a2\u8a9e (CP1253)";
NSWindowsCP1254StringEncoding = "Windows \u30c8\u30eb\u30b3\u8a9e (CP1254)";
NSWindowsCP1250StringEncoding = "Windows Latin-2 (CP1250)";
NSISOLatin1StringEncoding = "ISO Latin-1 \u897f\u30e8\u30fc\u30ed\u30c3\u30d1\u8a00\u8a9e (ISO-8859-1)";
NSISOLatin2StringEncoding = "ISO Latin-2 \u4e2d\u592e\u30e8\u30fc\u30ed\u30c3\u30d1\u8a00\u8a9e (ISO-8859-2)";
NSISOLatin3StringEncoding = "ISO Latin-3 \u5357\u30e8\u30fc\u30ed\u30c3\u30d1\u8a00\u8a9e (ISO-8859-3)";
NSISOLatin4StringEncoding = "ISO Latin-4 \u5317\u30e8\u30fc\u30ed\u30c3\u30d1\u8a00\u8a9e (ISO-8859-4)";
NSISOLatin5StringEncoding = "ISO Latin-5 \u30c8\u30eb\u30b3\u8a9e (ISO-8859-9)";
NSISOLatin6StringEncoding = "ISO Latin-6 \u5317\u6b27 (ISO-8859-10)";
NSISOLatin7StringEncoding = "ISO Latin-7 \u30d0\u30eb\u30c8\u8a9e (ISO-8859-13)";
NSISOLatin8StringEncoding = "ISO Latin-8 \u30b1\u30eb\u30c8\u8a9e (ISO-8859-14)";
NSISOLatin9StringEncoding = "ISO Latin-9 West European (new) (ISO-8859-15)";
NSISOCyrillicStringEncoding = "\u30ad\u30ea\u30eb\u8a9e (ISO-8859-5)";
NSISOArabicStringEncoding = "\u30a2\u30e9\u30d3\u30a2\u8a9e (ISO-8859-6)";
NSISOGreekStringEncoding = "\u30ae\u30ea\u30b7\u30a2\u8a9e (ISO-8859-7)";
NSISOHebrewStringEncoding = "\u30d8\u30d6\u30e9\u30a4\u8a9e (ISO-8859-8)";
NSUTF7StringEncoding = "Unicode UTF-7 (RFC 2152)";
NSUTF8StringEncoding = "Unicode UTF-8";
NSUnicodeStringEncoding = "Unicode UTF-16";
NSKOI8RStringEncoding = "\u30b1\u30eb\u30c8\u8a9e KOI8-R (\u30ed\u30b7\u30a2\u8a9e)";
NSJapaneseEUCStringEncoding = "\u65e5\u672c\u8a9e EUC";
NSShiftJISStringEncoding = "\u65e5\u672c\u8a9e Shift-JIS";
NSISO2022JPStringEncoding = "\u65e5\u672c\u8a9e JIS (7 bits) (ISO 2022)";
NSGB2312StringEncoding = "\u7c21\u4f53\u4e2d\u56fd\u8a9e GB2312";

View file

@ -0,0 +1,35 @@
/* Japanese */
{
NSLanguageName = "Japanese";
NSLanguageCode = JPN;
NSFormalName = "\u65e5\u672c\u8a9e";
NSCurrencySymbol = "\u5186";
NSPositiveCurrencyFormatString = "9,999.00\u5186";
NSNegativeCurrencyFormatString = "-9,999.00\u5186";
NSInternationalCurrencyString = "JPY";
NSDecimalDigits = ("0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
NSDecimalSeparator = ".";
NSThousandsSeparator = ",";
NSAMPMDesignation = ("\u5348\u524d", "\u5348\u5f8c");
NSDateFormatString = "%Y\u5e74%B%d\u65e5 %A";
NSDateTimeOrdering = YMDH;
NSEarlierTimeDesignations = (prior, last, past, ago);
NSHourNameDesignations = ((0, "\u771f\u591c\u4e2d"), (12, "\u6b63\u5348", "\u663c\u98df"), (10, "\u671d"), (14, "\u5348\u5f8c"), (19, "\u5915\u98df"));
NSLaterTimeDesignations = ("\u5148");
NSMonthNameArray = ("1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708");
NSNextDayDesignations = ("\u660e\u65e5");
NSNextNextDayDesignations = ("\u660e\u5f8c\u65e5");
NSPriorDayDesignations = ("\u6628\u65e5");
NSShortDateFormatString = "%Y/%m/%d";
NSShortMonthNameArray = ("1\u6708", "2\u6708", "3\u6708", "4\u6708", "5\u6708", "6\u6708", "7\u6708", "8\u6708", "9\u6708", "10\u6708", "11\u6708", "12\u6708");
NSShortTimeDateFormatString = "%Y %b %d %H:%M";
NSShortWeekDayNameArray = ("\u65e5", "\u6708", "\u706b", "\u6c34", "\u6728", "\u91d1", "\u571f");
NSThisDayDesignations = ("\u4eca\u65e5");
NSTimeDateFormatString = "%Y\u5e74%b%d\u65e5(%a) %H:%M:%S %z";
NSTimeFormatString = "%H:%M:%S";
NSWeekDayNameArray = ("\u65e5\u66dc\u65e5", "\u6708\u66dc\u65e5", "\u706b\u66dc\u65e5", "\u6c34\u66dc\u65e5", "\u6728\u66dc\u65e5", "\u91d1\u66dc\u65e5", "\u571f\u66dc\u65e5");
NSYearMonthWeekDesignations = ("\u5e74", "\u6708", "\u9031");
}

View file

@ -245,6 +245,18 @@
#endif
}
#if TYPE_ORDER == 1
- (NSSize)sizeValue
{
return NSMakeSize(data.x, data.y);
}
#elif TYPE_ORDER == 5
- (NSPoint)pointValue
{
return NSMakePoint(data.width, data.height);
}
#endif
// NSCoding
- (void) encodeWithCoder: (NSCoder*)coder
{

View file

@ -1112,6 +1112,7 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
GSTLSPriority,
GSTLSRemoteHosts,
GSTLSRevokeFile,
GSTLSServerName,
GSTLSVerify,
nil];
}
@ -1127,6 +1128,21 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
[opts setObject: str forKey: key];
}
}
/* If there is no value set for the server name, and the host in the
* URL is a domain name rather than an address, we use that.
*/
if (nil == [opts objectForKey: GSTLSServerName])
{
NSString *host = [u host];
unichar c = [host length] == 0 ? 0 : [host characterAtIndex: 0];
if (c != 0 && c != ':' && !isdigit(c))
{
[opts setObject: host forKey: GSTLSServerName];
}
}
if (debug) [opts setObject: @"YES" forKey: GSTLSDebug];
[sock sslSetOptions: opts];
[opts release];

View file

@ -455,6 +455,7 @@ static NSArray *keys = nil;
GSTLSPriority,
GSTLSRemoteHosts,
GSTLSRevokeFile,
GSTLSServerName,
GSTLSVerify,
nil];
[[NSObject leakAt: &keys] release];

View file

@ -36,6 +36,7 @@ extern NSString * const GSTLSDebug;
extern NSString * const GSTLSPriority;
extern NSString * const GSTLSRemoteHosts;
extern NSString * const GSTLSRevokeFile;
extern NSString * const GSTLSServerName;
extern NSString * const GSTLSVerify;
#if defined(HAVE_GNUTLS)

View file

@ -81,6 +81,7 @@ NSString * const GSTLSDebug = @"GSTLSDebug";
NSString * const GSTLSPriority = @"GSTLSPriority";
NSString * const GSTLSRemoteHosts = @"GSTLSRemoteHosts";
NSString * const GSTLSRevokeFile = @"GSTLSRevokeFile";
NSString * const GSTLSServerName = @"GSTLSServerName";
NSString * const GSTLSVerify = @"GSTLSVerify";
#if defined(HAVE_GNUTLS)
@ -1533,6 +1534,32 @@ retrieve_callback(gnutls_session_t session,
if (YES == outgoing)
{
gnutls_init(&session, GNUTLS_CLIENT);
str = [opts objectForKey: GSTLSServerName];
if ([str length] > 0)
{
const char *ptr = [str UTF8String];
unsigned len = strlen(ptr);
int ret;
ret = gnutls_server_name_set(session, GNUTLS_NAME_DNS, ptr, len);
if (YES == debug)
{
if (ret < 0)
{
NSLog(@"%@ %@: failed '%s'", self, GSTLSServerName,
gnutls_strerror(ret));
}
else
{
NSLog(@"%@ %@: set to '%s'", self, GSTLSServerName, ptr);
}
}
}
else if (YES == debug)
{
NSLog(@"%@ %@: not set", self, GSTLSServerName);
}
}
else
{

View file

@ -1044,7 +1044,7 @@ static id gs_weak_load(id obj)
for (i = 0; i < LOCKCOUNT; i++)
{
allocationLocks[i] = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_init(&allocationLocks[i], NULL);
}
}
#endif

View file

@ -37,10 +37,10 @@
// Dummy implementatation
// cleaner than IFDEF'ing the code everywhere
#ifndef HAVE_PTHREAD_SPIN_LOCK
#if !(HAVE_PTHREAD_SPIN_LOCK)
#warning no spin_locks, using dummy versions
typedef int pthread_spinlock_t;
int pthread_spin_init(pthread_spinlock_t *lock, int pshared
int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
{
NSDebugLog(@"NSThread.m: Warning this platform does not support spin locks");
return 0;
@ -51,7 +51,7 @@ int pthread_spin_lock(pthread_spinlock_t *lock)
}
int pthread_spin_unlock(pthread_spinlock_t *lock)
{
return 0;c
return 0;
}
int pthread_spin_destroy(pthread_spinlock_t *lock)
{

View file

@ -882,6 +882,7 @@ static NSURLProtocol *placeholder = nil;
GSTLSPriority,
GSTLSRemoteHosts,
GSTLSRevokeFile,
GSTLSServerName,
GSTLSVerify,
nil];
}
@ -896,6 +897,20 @@ static NSURLProtocol *placeholder = nil;
[this->output setProperty: str forKey: key];
}
}
/* If there is no value set for the server name, and the host in the
* URL is a domain name rather than an address, we use that.
*/
if (nil == [this->output propertyForKey: GSTLSServerName])
{
NSString *host = [url host];
unichar c;
c = [host length] == 0 ? 0 : [host characterAtIndex: 0];
if (c != 0 && c != ':' && !isdigit(c))
{
[this->output setProperty: host forKey: GSTLSServerName];
}
}
if (_debug) [this->output setProperty: @"YES" forKey: GSTLSDebug];
}
[this->input setDelegate: self];

View file

@ -58,7 +58,8 @@ int main()
START_SET("NSLocale")
NSLocale *sys;
NSLocale *en;
unichar spc[1] = {0x00a0};
const unichar uspc[1] = {0x00a0};
NSString *spc = [NSString stringWithCharacters: uspc length: 1];
if (!NSLOCALE_SUPPORTED)
SKIP("NSLocale not supported\nThe ICU library was not available when GNUstep-base was built")
@ -159,7 +160,7 @@ int main()
num = [[[NSNumber alloc] initWithFloat: -1234.56] autorelease];
str = [fmt stringFromNumber: num];
PASS(([str isEqual: @"(R$1.235)"] || [str isEqual: @"_R$1.235"]
|| [str isEqual: [NSString stringWithFormat: @"_R$%s%@",
|| [str isEqual: [NSString stringWithFormat: @"_R$%@%@",
spc, @"1.235"]]),
"negativeFormat used for -ve number");

View file

@ -1,6 +1,7 @@
#import "Testing.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSAutoreleasePool.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSProcessInfo.h>
#import <Foundation/NSString.h>
@ -43,9 +44,11 @@ int main()
val = [info operatingSystem];
PASS(val != 0, "-operatingSystem works");
testHopeful = YES;
val = [info systemUptime];
NSLog(@"systemUptime %lu", val);
PASS(val != 0, "-systemUptime works");
testHopeful = NO;
obj = [info hostName];
PASS((obj != nil && [obj isKindOfClass:[NSString class]] && [obj length] > 0),

View file

@ -425,7 +425,6 @@ ihandler(int sig)
NSString *service;
BOOL isNetwork = NO;
BOOL isPublic = NO;
BOOL isLocal = NO;
NSPort *port;
NSPortNameServer *ns;
NSUserDefaults *defs;
@ -451,11 +450,6 @@ ihandler(int sig)
{
isNetwork = YES;
}
else
{
isLocal = YES;
}
if (isNetwork)
{

View file

@ -101,7 +101,7 @@ main(int argc, char** argv, char **env)
fileContents = [NSMutableString stringWithCapacity: 200];
[fileContents appendString:
@"[Desktop Entry]\nEncoding=UTF-8\nType=Application\n"];
@"[Desktop Entry]\nType=Application\n"];
list = [plist objectForKey: @"FreeDesktopCategories"];
if (list != nil && [list isKindOfClass: [NSArray class]] && [list count] > 0)
{
@ -216,7 +216,6 @@ main(int argc, char** argv, char **env)
execPath = [NSString stringWithCString: line
encoding: NSASCIIStringEncoding];
[fileContents appendFormat: @"Exec=%@ %@\n", execPath, entry];
[fileContents appendFormat: @"FilePattern=%@.app;%@;\n", entry, entry];
}
list = [plist objectForKey: @"NSTypes"];