Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Bionic module and new Android overlay in Swift 6 #468

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Sources/NIOSSL/ByteBufferBIO.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Bionic)
import Bionic
#else
#error("unsupported os")
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/NIOSSL/IdentityVerification.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("unsupported os")
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/NIOSSL/NIOSSLClientHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("unsupported os")
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/NIOSSL/PosixPort.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("unsupported os")
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/NIOSSL/SSLCallbacks.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Bionic)
import Bionic
#else
#error("unsupported os")
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/NIOSSL/SSLCertificate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Bionic)
import Bionic
#else
#error("unsupported os")
#endif
Expand Down
8 changes: 5 additions & 3 deletions Sources/NIOSSL/SSLContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("unsupported os")
#endif
Expand All @@ -44,7 +46,7 @@ internal enum FileSystemObject {
}

#if os(Android) && arch(arm)
return (statObj.st_mode & UInt32(Glibc.S_IFDIR)) != 0 ? .directory : .file
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Glibc scoping on Android armv7 was added for whatever reason in #45, but my testing now shows it isn't needed, so I removed it here and below.

return (statObj.st_mode & UInt32(S_IFDIR)) != 0 ? .directory : .file
#else
return (statObj.st_mode & S_IFDIR) != 0 ? .directory : .file
#endif
Expand Down Expand Up @@ -733,7 +735,7 @@ extension NIOSSLContext {
let _ = try Posix.lstat(path: path, buf: &buffer)
// Check the mode to make sure this is a symlink
#if os(Android) && arch(arm)
if (buffer.st_mode & UInt32(Glibc.S_IFMT)) != UInt32(Glibc.S_IFLNK) { return false }
if (buffer.st_mode & UInt32(S_IFMT)) != UInt32(S_IFLNK) { return false }
#else
if (buffer.st_mode & S_IFMT) != S_IFLNK { return false }
#endif
Expand Down
4 changes: 3 additions & 1 deletion Sources/NIOSSL/SubjectAlternativeName.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ import NIOCore
import Darwin.C
#elseif canImport(Musl)
import Musl
#elseif os(Linux) || os(FreeBSD) || os(Android)
#elseif canImport(Glibc)
import Glibc
#elseif canImport(Android)
import Android
#else
#error("unsupported os")
#endif
Expand Down