Skip to content

Commit 572d35c

Browse files
committed
Merge branch 'master' of https://github.com/itaiferber/swift-corelibs-foundation into itaiferber-master
2 parents c6758e4 + c3db0fb commit 572d35c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

Foundation/NSHTTPCookie.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ open class HTTPCookie : NSObject {
259259
_expiresDate = date
260260
} else if let dateString = expiresProperty as? String {
261261
let formatter = DateFormatter()
262+
formatter.locale = Locale(localeIdentifier: "en_US_POSIX")
262263
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss O" // per RFC 6265 '<rfc1123-date, defined in [RFC2616], Section 3.3.1>'
263264
let timeZone = TimeZone(abbreviation: "GMT")
264265
formatter.timeZone = timeZone

TestFoundation/TestNSHTTPCookie.swift

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,14 @@ class TestNSHTTPCookie: XCTestCase {
156156
let cookies = HTTPCookie.cookies(withResponseHeaderFields: header, forURL: URL(string: "http://example.com")!)
157157
XCTAssertEqual(cookies[0].domain, "http://example.com")
158158
let formatter = DateFormatter()
159-
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss O"
159+
formatter.locale = Locale(localeIdentifier: "en_US_POSIX")
160+
formatter.dateFormat = "EEE, dd MMM yyyy HH:mm:ss O"
160161
formatter.timeZone = TimeZone(abbreviation: "GMT")
161-
#if false // disabled for now
162162
if let expiresDate = formatter.date(from: "Wed, 21 Sep 2016 05:33:00 GMT") {
163163
XCTAssertTrue(expiresDate.compare(cookies[0].expiresDate!) == .orderedSame)
164164
} else {
165165
XCTFail("Unable to parse the given date from the formatter")
166166
}
167-
#endif
168167
}
169168

170169
func test_cookiesWithResponseHeaderNoPathNoDomain() {

0 commit comments

Comments
 (0)