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

CCurl available only for Linux or macOS #304

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
6 changes: 5 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
**/

import PackageDescription
import Foundation

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/IBM-Swift/LoggerAPI.git", from: "1.7.3"),
Expand All @@ -29,10 +30,13 @@ var kituraNetDependencies: [Target.Dependency] = [
.byName(name: "CHTTPParser"),
.byName(name: "LoggerAPI"),
.byName(name: "Socket"),
.target(name: "CCurl"),
.byName(name: "SSLService")
]

if ProcessInfo.processInfo.environment["KITURA_IOS"] == nil {
kituraNetDependencies.append(.target(name: "CCurl"))
}

#if os(Linux)
dependencies.append(contentsOf: [
.package(url: "https://github.com/IBM-Swift/BlueSignals.git", from: "1.0.0")
Expand Down
7 changes: 5 additions & 2 deletions Sources/KituraNet/ClientRequest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@
* limitations under the License.
*/



#if os(Linux) || os(macOS)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd prefer us to test on the KITURA_IOS flag as it's then consistent with the conditions for the CCurl dependency in Package.swift, eg:

#if !KITURA_IOS

import LoggerAPI
import CCurl
import Socket

import CCurl
import Foundation

// The public API for ClientRequest erroneously defines the port as an Int16, which is
Expand Down Expand Up @@ -847,3 +849,4 @@ private struct OneTimeInitializations {
}
}

#endif
3 changes: 2 additions & 1 deletion Sources/KituraNet/HTTP/HTTP.swift
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public class HTTP {
public static func createServer() -> HTTPServer {
return HTTPServer()
}

#if os(Linux) || os(macOS)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment as above

/**
Create a new `ClientRequest` using URL.

Expand Down Expand Up @@ -153,6 +153,7 @@ public class HTTP {
req.end()
return req
}
#endif

/// A set of characters that are valid in requests.
private static let allowedCharacterSet = NSCharacterSet(charactersIn:"\"#%/<>?@\\^`{|} ").inverted
Expand Down