فهرست منبع

Version changed to 1.0.7.
[multipart] filename and name multipart properties are returned without quotation mark.

Damian Kołakowski 10 سال پیش
والد
کامیت
1d4a825d29

+ 2 - 2
Sources/HttpRequest.swift

@@ -40,11 +40,11 @@ public class HttpRequest {
         public let body: [UInt8]
         
         public var name: String? {
-            return valueFor("content-disposition", parameterName: "name")
+            return valueFor("content-disposition", parameterName: "name")?.unquote()
         }
         
         public var fileName: String? {
-            return valueFor("content-disposition", parameterName: "filename")
+            return valueFor("content-disposition", parameterName: "filename")?.unquote()
         }
         
         private func valueFor(headerName: String, parameterName: String) -> String? {

+ 1 - 1
Sources/HttpServer.swift

@@ -10,7 +10,7 @@ import Foundation
 
 public class HttpServer: HttpServerIO {
     
-    public static let VERSION = "1.0.6"
+    public static let VERSION = "1.0.7"
     
     private let router = HttpRouter()
     

+ 1 - 1
Sources/HttpServerIO.swift

@@ -89,7 +89,7 @@ public class HttpServerIO {
         
         let content = response.content()
         
-        if content.length > 0 {
+        if content.length >= 0 {
             try socket.writeUTF8("Content-Length: \(content.length)\r\n")
         }
         

+ 10 - 0
Sources/String+Misc.swift

@@ -22,6 +22,16 @@ extension String {
         return String(buffer)
     }
     
+    public func unquote() -> String {
+        var scalars = self.unicodeScalars;
+        if scalars.first == "\"" && scalars.last == "\"" && scalars.count >= 2 {
+            scalars.removeFirst();
+            scalars.removeLast();
+            return String(scalars)
+        }
+        return self
+    }
+    
     public func trim() -> String {
         var scalars = self.unicodeScalars
         while let _ = unicodeScalarToUInt32Whitespace(scalars.first) { scalars.removeFirst() }

+ 2 - 2
Swifter.podspec

@@ -1,14 +1,14 @@
 Pod::Spec.new do |s|
 
   s.name                  = "Swifter"
-  s.version               = "1.0.6"
+  s.version               = "1.0.7"
   s.summary               = "Tiny http server engine written in Swift programming language."
   s.homepage              = "https://github.com/glock45/swifter"
   s.license               = { :type => 'Copyright', :file => 'LICENSE' }
   s.author                = { "Damian Kołakowski" => "kolakowski.damian@gmail.com" }
   s.ios.deployment_target = "8.0"
   s.osx.deployment_target = "10.9"
-  s.source                = { :git => "https://github.com/glock45/swifter.git", :tag => "1.0.6" }
+  s.source                = { :git => "https://github.com/glock45/swifter.git", :tag => "1.0.7" }
   s.source_files          = 'Sources/*.{h,m,swift}'
 
 end

+ 6 - 6
Swifter.xcodeproj/project.pbxproj

@@ -492,7 +492,7 @@
 		7AE893ED1C05127900A29F63 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			buildSettings = {
-				CURRENT_PROJECT_VERSION = 1.0.6;
+				CURRENT_PROJECT_VERSION = 1.0.7;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
@@ -516,7 +516,7 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 1.0.6;
+				CURRENT_PROJECT_VERSION = 1.0.7;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
@@ -541,7 +541,7 @@
 			buildSettings = {
 				CODE_SIGN_IDENTITY = "Mac Developer";
 				COMBINE_HIDPI_IMAGES = YES;
-				CURRENT_PROJECT_VERSION = 1.0.6;
+				CURRENT_PROJECT_VERSION = 1.0.7;
 				DEBUG_INFORMATION_FORMAT = dwarf;
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
@@ -569,7 +569,7 @@
 				CODE_SIGN_IDENTITY = "Mac Developer";
 				COMBINE_HIDPI_IMAGES = YES;
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 1.0.6;
+				CURRENT_PROJECT_VERSION = 1.0.7;
 				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
 				DEFINES_MODULE = YES;
 				DYLIB_COMPATIBILITY_VERSION = 1;
@@ -610,7 +610,7 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = NO;
-				CURRENT_PROJECT_VERSION = 1.0.6;
+				CURRENT_PROJECT_VERSION = 1.0.7;
 				EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;
 				ENABLE_TESTABILITY = YES;
@@ -657,7 +657,7 @@
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
 				COPY_PHASE_STRIP = YES;
-				CURRENT_PROJECT_VERSION = 1.0.6;
+				CURRENT_PROJECT_VERSION = 1.0.7;
 				EMBEDDED_CONTENT_CONTAINS_SWIFT = YES;
 				ENABLE_NS_ASSERTIONS = NO;
 				ENABLE_STRICT_OBJC_MSGSEND = YES;

BIN
Swifter.xcodeproj/project.xcworkspace/xcuserdata/damiankolakowski.xcuserdatad/UserInterfaceState.xcuserstate


+ 78 - 0
Swifter.xcodeproj/xcuserdata/damiankolakowski.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

@@ -1614,5 +1614,83 @@
             landmarkType = "5">
          </BreakpointContent>
       </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Sources/HttpServerIO.swift"
+            timestampString = "473278998.673742"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "92"
+            endingLineNumber = "92"
+            landmarkName = "respond(_:response:keepAlive:)"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Sources/DemoServer.swift"
+            timestampString = "473961563.823599"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "61"
+            endingLineNumber = "61"
+            landmarkName = "demoServer(_:)"
+            landmarkType = "7">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Sources/HttpRequest.swift"
+            timestampString = "473961611.640798"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "85"
+            endingLineNumber = "85"
+            landmarkName = "parseMultiPartFormData()"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "Sources/HttpRequest.swift"
+            timestampString = "473961921.681296"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "84"
+            endingLineNumber = "84"
+            landmarkName = "parseMultiPartFormData()"
+            landmarkType = "5">
+         </BreakpointContent>
+      </BreakpointProxy>
+      <BreakpointProxy
+         BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
+         <BreakpointContent
+            shouldBeEnabled = "No"
+            ignoreCount = "0"
+            continueAfterRunningActions = "No"
+            filePath = "SwifterSampleOSX/main.swift"
+            timestampString = "473962825.76977"
+            startingColumnNumber = "9223372036854775807"
+            endingColumnNumber = "9223372036854775807"
+            startingLineNumber = "18"
+            endingLineNumber = "18">
+         </BreakpointContent>
+      </BreakpointProxy>
    </Breakpoints>
 </Bucket>

+ 1 - 0
SwifterSampleOSX/main.swift

@@ -7,6 +7,7 @@
 import Foundation
 import Swifter
 
+
 let server = demoServer(NSBundle.mainBundle().resourcePath!)
 
 do {