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

Fixing swift errors on heroku server & public access control in some places #25

Merged
merged 3 commits into from
Feb 15, 2016
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sources/Request.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public class Request {
let cookieArray = cookie.split("=")

if cookieArray.count == 2 {
let key = cookieArray[0].stringByReplacingOccurrencesOfString(" ", withString: "")
let key = cookieArray[0].split(" ").joinWithSeparator("")
cookies[key] = cookieArray[1]
}
}
Expand Down
8 changes: 4 additions & 4 deletions Sources/Response.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ public class Redirect: Response {

Inspired by elliottminns
*/
class AsyncResponse: Response {
typealias Writer = Socket throws -> Void
var writer: Writer
public class AsyncResponse: Response {
public typealias Writer = Socket throws -> Void
public let writer: Writer

init(writer: Writer) {
public init(writer: Writer) {
self.writer = writer
super.init(status: .OK, data: [], contentType: .None)
}
Expand Down
14 changes: 7 additions & 7 deletions Sources/Socket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation
#endif

enum SocketError: ErrorType {
public enum SocketError: ErrorType {
case SocketCreationFailed(String)
case SocketSettingReUseAddrFailed(String)
case BindFailed(String)
Expand All @@ -23,7 +23,7 @@ enum SocketError: ErrorType {

public class Socket: Hashable, Equatable {

class func tcpSocketForListen(port: in_port_t, maxPendingConnection: Int32 = SOMAXCONN) throws -> Socket {
public class func tcpSocketForListen(port: in_port_t, maxPendingConnection: Int32 = SOMAXCONN) throws -> Socket {

#if os(Linux)
let socketFileDescriptor = socket(AF_INET, Int32(SOCK_STREAM.rawValue), 0)
Expand Down Expand Up @@ -83,11 +83,11 @@ public class Socket: Hashable, Equatable {

public var hashValue: Int { return Int(self.socketFileDescriptor) }

func release() {
public func release() {
Socket.release(self.socketFileDescriptor)
}

func shutdwn() {
public func shutdwn() {
Socket.shutdwn(self.socketFileDescriptor)
}

Expand Down Expand Up @@ -123,7 +123,7 @@ public class Socket: Hashable, Equatable {
}
}

func read() throws -> UInt8 {
public func read() throws -> UInt8 {
var buffer = [UInt8](count: 1, repeatedValue: 0)
let next = recv(self.socketFileDescriptor as Int32, &buffer, Int(buffer.count), 0)
if next <= 0 {
Expand All @@ -135,7 +135,7 @@ public class Socket: Hashable, Equatable {
private static let CR = UInt8(13)
private static let NL = UInt8(10)

func readLine() throws -> String {
public func readLine() throws -> String {
var characters: String = ""
var n: UInt8 = 0
repeat {
Expand All @@ -147,7 +147,7 @@ public class Socket: Hashable, Equatable {

var cachedPeerName: String?

func peername() throws -> String {
public func peername() throws -> String {
if let name = self.cachedPeerName {
return name
}
Expand Down