Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cf13851d19 | |||
| fe0036eb7e | |||
| 4a49a6fa02 | |||
| 6ae4efcc03 | |||
| b84e6149d6 | |||
| 1f96a271cb | |||
| b38a78a34a | |||
| ce098e3f7b | |||
| 8e117daaca | |||
| 15e063264b | |||
| 2012a6546a | |||
| ef4b622b13 | |||
| f90cd113ba | |||
| f993a1b5d5 | |||
| c6d118f4ec | |||
| 0da9ee6afe | |||
| 6c93927e12 | |||
| f4cf591e50 | |||
| 5c737549fc | |||
| 1c36bf07c8 | |||
| df8d66f6c8 | |||
| 45432e6563 | |||
| 7720b1363d | |||
| a7a6cfdbc7 | |||
| 70f687e34b | |||
| 11967061a1 | |||
| 2d8dc8775d | |||
| 9cb7caacbd | |||
| ac10c0c5b0 | |||
| acdb5c9262 | |||
| f54cc20bd6 | |||
| 02738433bf | |||
| c9563db0a6 | |||
| cd1eea5612 | |||
| f7c1c4eff5 | |||
| fdc0feddf0 | |||
| 25dbee032d | |||
| c3c7aaad00 | |||
| 2c53064f5d | |||
| 8d0a3599ee | |||
| 653dfb727b | |||
| 7e4dd53c98 | |||
| 11254331d1 | |||
| 9f345c6858 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ xcuserdata
|
||||
project.xcworkspace
|
||||
/build
|
||||
/Carthage/Build
|
||||
/.build
|
||||
@ -1,3 +1,3 @@
|
||||
language: objective-c
|
||||
script: ./Run-Tests.sh
|
||||
osx_image: xcode10.1
|
||||
osx_image: xcode11.3
|
||||
|
||||
24
.vscode/launch.json
vendored
Normal file
24
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"type": "swift",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder:GCDWebServer}",
|
||||
"name": "Debug _spmcheck",
|
||||
"target": "_spmcheck",
|
||||
"configuration": "debug",
|
||||
"preLaunchTask": "swift: Build Debug _spmcheck"
|
||||
},
|
||||
{
|
||||
"type": "swift",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder:GCDWebServer}",
|
||||
"name": "Release _spmcheck",
|
||||
"target": "_spmcheck",
|
||||
"configuration": "release",
|
||||
"preLaunchTask": "swift: Build Release _spmcheck"
|
||||
}
|
||||
]
|
||||
}
|
||||
103
CLAUDE.md
Normal file
103
CLAUDE.md
Normal file
@ -0,0 +1,103 @@
|
||||
# CLAUDE.md
|
||||
|
||||
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
||||
|
||||
## Overview
|
||||
|
||||
GCDWebServer is a lightweight, GCD-based HTTP 1.1 server written in Objective-C (ARC) for embedding in iOS, macOS, and tvOS apps. It has no third-party dependencies. This fork targets iOS 16 / tvOS 16 / macOS 12 (set in both `GCDWebServer.xcodeproj` and `GCDWebServer.podspec`).
|
||||
|
||||
Not supported by design: keep-alive connections and HTTPS.
|
||||
|
||||
## Build & Test
|
||||
|
||||
The library can be built three ways: the Xcode project (`GCDWebServer.xcodeproj`), CocoaPods (`GCDWebServer.podspec`), and Swift Package Manager (`Package.swift`). All three compile the same source files in place — see "Swift Package Manager layout" below for how the SPM `include/` directories relate to the real sources.
|
||||
|
||||
Build via SPM:
|
||||
```sh
|
||||
swift build # builds GCDWebServer, GCDWebUploader, GCDWebDAVServer
|
||||
```
|
||||
|
||||
Schemes (`xcodebuild -list -project GCDWebServer.xcodeproj`):
|
||||
- `GCDWebServer (Mac|iOS|tvOS)` — the static library / framework per platform.
|
||||
- `GCDWebServers (Mac|iOS|tvOS)` — the framework target plus the XCTest unit tests (`Frameworks/Tests.m`).
|
||||
- `Build All`.
|
||||
|
||||
Run the unit tests (XCTest):
|
||||
```sh
|
||||
xcodebuild test -scheme "GCDWebServers (Mac)"
|
||||
```
|
||||
|
||||
Run a single XCTest method:
|
||||
```sh
|
||||
xcodebuild test -scheme "GCDWebServers (Mac)" -only-testing:Tests/Tests/testPaths
|
||||
```
|
||||
|
||||
Full CI test suite (builds for all platforms at oldest + current deployment targets, then runs the request/response replay tests):
|
||||
```sh
|
||||
./Run-Tests.sh
|
||||
```
|
||||
|
||||
`Run-Tests.sh` does the bulk of the real testing. It builds the `GCDWebServer (Mac)` target, then runs the resulting command-line `GCDWebServer` executable in test modes (`webServer`, `webDAV`, `htmlForm`, `htmlFileUpload`) against recorded fixtures.
|
||||
|
||||
This script was originally written for Xcode 11.3 and was updated for current Xcode/SDKs in this fork:
|
||||
- The hardcoded "oldest deployment target" builds now use 12.0 (macOS) / 16.0 (iOS) to match the project (the old 10.7/8.0 values fail on modern SDKs — no `libarclite`).
|
||||
- The `webUploader` fixture test is **commented out**: this fork customized `GCDWebUploader` (delete/move/create disabled in commit `ef4b622`), so the recorded `Tests/WebUploader` fixtures no longer match. Re-record them or re-enable the line if those features are restored.
|
||||
- The **tvOS build step is commented out** because it requires the tvOS Simulator runtime to be installed (`xcodebuild -downloadPlatform tvOS`); without it the storyboard compile fails with "tvOS … Platform Not Installed". Re-enable once the runtime is present.
|
||||
|
||||
A project adjustment was also needed for the suite to build under current Xcode: the `Tests (Mac)` target sets `GENERATE_INFOPLIST_FILE = YES`. MIME-type lookup in `GCDWebServerFunctions.m` uses the modern `UTType` API (UniformTypeIdentifiers), so that framework is linked in all three build systems (Xcode `OTHER_LDFLAGS`, the podspec Core subspec, and `Package.swift`).
|
||||
|
||||
### How the fixture-replay tests work
|
||||
|
||||
The `Tests/` directory holds recorded HTTP exchanges, not code. Each test case is a pair of files: `NNN-<method>.request` (raw bytes sent to the server) and `NNN-<code>.response` (expected raw response bytes). The test runner (`-mode <mode> -root <payload-dir> -tests <test-dir>`) replays each `.request` against a server rooted at an extracted copy of `Tests/Payload.zip` and byte-compares the reply to the `.response`. To add coverage for a new behavior, add a matching `.request`/`.response` pair to the relevant `Tests/<Mode>` directory rather than writing new XCTest code.
|
||||
|
||||
## Formatting
|
||||
|
||||
Source style for Objective-C is defined by `.clang-format` (Google base style, `ColumnLimit: 0`). Format files with `clang-format -style=file -i <files>`. The Swift example apps use 2-space indentation (SwiftFormat).
|
||||
|
||||
## Architecture
|
||||
|
||||
The entire library is built around 4 core classes in `GCDWebServer/Core/`:
|
||||
- **GCDWebServer** — owns the listening socket and the ordered list of handlers. Manages start/stop, options, Bonjour, NAT port mapping, and (on iOS) automatic suspend/resume across foreground/background transitions.
|
||||
- **GCDWebServerConnection** — one instance per open HTTP connection, lives until the connection closes. Drives reading the request and writing the response. Subclassable via hooks (it's exposed but not used directly).
|
||||
- **GCDWebServerRequest** — created once HTTP headers arrive; wraps the request and consumes the body. Subclasses in `GCDWebServer/Requests/` choose how the body is handled (in memory, streamed to disk, parsed as a form, etc.).
|
||||
- **GCDWebServerResponse** — produced by a handler; wraps response headers and an optional body. Subclasses in `GCDWebServer/Responses/` cover data-in-memory, file-on-disk, streamed, and error responses.
|
||||
|
||||
`GCDWebServer/Core/GCDWebServerFunctions.{h,m}` holds shared C helpers (e.g. `GCDWebServerNormalizePath`, MIME-type and date helpers). `GCDWebServerPrivate.h` is the internal/private header (including the logging-facility abstraction). `GCDWebServerHTTPStatusCodes.h` enumerates status codes.
|
||||
|
||||
### Handler model
|
||||
|
||||
A request is matched and processed by **handlers** added to the server, evaluated in **LIFO order** (last added wins). Each handler is two GCD blocks:
|
||||
- `GCDWebServerMatchBlock` — runs as soon as headers are received; inspects method/URL/headers and returns a `GCDWebServerRequest` subclass instance to claim the request, or `nil` to pass.
|
||||
- `GCDWebServerProcessBlock` (sync) or `GCDWebServerAsyncProcessBlock` (async) — runs after the full request body is received and returns a `GCDWebServerResponse` (or `nil`/error response → 500).
|
||||
|
||||
Handlers run on **arbitrary GCD threads**, so handler code must be thread-safe and re-entrant.
|
||||
|
||||
### Extensions (subclasses of GCDWebServer)
|
||||
|
||||
- `GCDWebUploader/` — `GCDWebUploader`, an HTML5 web UI for uploading/downloading/managing files in a directory. Ships front-end assets in `GCDWebUploader.bundle`.
|
||||
- `GCDWebDAVServer/` — `GCDWebDAVServer`, a class-1 WebDAV server (partial class-2 for macOS Finder). Depends on `libxml2`.
|
||||
|
||||
### Example apps & framework packaging
|
||||
|
||||
- `Mac/main.m` — macOS command-line example (also serves as the test-runner executable).
|
||||
- `iOS/`, `tvOS/` — Swift example apps (`AppDelegate.swift`, `ViewController.swift`).
|
||||
- `Frameworks/` — umbrella header (`GCDWebServers.h`), module map, and the XCTest target source (`Tests.m`).
|
||||
|
||||
## Swift Package Manager layout
|
||||
|
||||
SPM needs each target's public headers in a single directory, but the real headers live spread across `GCDWebServer/Core`, `GCDWebServer/Requests`, and `GCDWebServer/Responses`. To support SPM **without moving any files** (keeping the Xcode project and CocoaPods working), the public headers are surfaced through symlinks:
|
||||
|
||||
- `GCDWebServer/include/*.h` are **symlinks** to the real public headers (everything except the private `GCDWebServerPrivate.h`, which is deliberately not linked so it stays out of the public module). `GCDWebUploader/include/GCDWebUploader.h` works the same way.
|
||||
- `GCDWebServer/include/module.modulemap` is hand-written with `umbrella "."`. This is required: if SPM auto-generated the module map it would pick `include/GCDWebServer.h` as an umbrella *header* (name matches the module) and only export what that one header imports, hiding the request/response subclasses. The umbrella *directory* exports them all.
|
||||
- All cross-header imports inside the library (including the framework umbrella `Frameworks/GCDWebServers.h`) use quoted form (`#import "GCDWebServerRequest.h"`), not framework-style (`#import <GCDWebServers/...>`); the quoted form is what lets the flat `include/` symlink directory resolve them. Keep new imports quoted.
|
||||
- `GCDWebUploader.bundle` is a `.copy` resource. Because SPM nests it inside a generated module bundle, `GCDWebUploader.m` has a `#if SWIFT_PACKAGE` branch that finds it via `SWIFTPM_MODULE_BUNDLE` instead of `bundleForClass:`.
|
||||
|
||||
When adding or renaming a public header, add/remove the matching symlink in the relevant `include/` directory or it won't be visible to SPM consumers. `libxml2` (for WebDAV) needs no special SPM include flag — the macOS/iOS SDK ships a module map that resolves `<libxml/parser.h>` automatically.
|
||||
|
||||
## Consumer linking requirements
|
||||
|
||||
When integrated manually (not via CocoaPods), consuming apps must link `libz`, and WebDAV additionally needs `libxml2` with `$(SDKROOT)/usr/include/libxml2` on the header search path. The `GCDWebServer.podspec` defines three subspecs: `Core` (default), `WebDAV`, and `WebUploader`.
|
||||
|
||||
## Logging & debug builds
|
||||
|
||||
Define `DEBUG=1` in `GCC_PREPROCESSOR_DEFINITIONS` to enable verbose logging plus internal consistency checks. Runtime verbosity is controlled via `+[GCDWebServer setLogLevel:]`. If XLFacility is present in the same Xcode project, GCDWebServer routes logging through it automatically (see `GCDWebServerPrivate.h`).
|
||||
@ -7,16 +7,16 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUNDLE_VERSION_STRING}</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>${BUNDLE_VERSION_STRING}</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>${BUNDLE_VERSION_STRING}</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@ -358,9 +358,14 @@ static inline BOOL _IsMacFinder(GCDWebServerRequest* request) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Conflict message:@"Invalid destination \"%@\"", dstRelativePath];
|
||||
}
|
||||
|
||||
NSString* itemName = [dstAbsolutePath lastPathComponent];
|
||||
if ((!_allowHiddenItems && [itemName hasPrefix:@"."]) || (!isDirectory && ![self _checkFileExtension:itemName])) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Forbidden message:@"%@ to item name \"%@\" is not allowed", isMove ? @"Moving" : @"Copying", itemName];
|
||||
NSString* srcName = [srcAbsolutePath lastPathComponent];
|
||||
if ((!_allowHiddenItems && [srcName hasPrefix:@"."]) || (!isDirectory && ![self _checkFileExtension:srcName])) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Forbidden message:@"%@ from item name \"%@\" is not allowed", isMove ? @"Moving" : @"Copying", srcName];
|
||||
}
|
||||
|
||||
NSString* dstName = [dstAbsolutePath lastPathComponent];
|
||||
if ((!_allowHiddenItems && [dstName hasPrefix:@"."]) || (!isDirectory && ![self _checkFileExtension:dstName])) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Forbidden message:@"%@ to item name \"%@\" is not allowed", isMove ? @"Moving" : @"Copying", dstName];
|
||||
}
|
||||
|
||||
NSString* overwriteHeader = [request.headers objectForKey:@"Overwrite"];
|
||||
|
||||
@ -1,34 +1,26 @@
|
||||
# http://guides.cocoapods.org/syntax/podspec.html
|
||||
# http://guides.cocoapods.org/making/getting-setup-with-trunk.html
|
||||
# $ sudo gem update cocoapods
|
||||
# (optional) $ pod trunk register {email} {name} --description={computer}
|
||||
# $ pod trunk --verbose push
|
||||
# DELETE THIS SECTION BEFORE PROCEEDING!
|
||||
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'GCDWebServer'
|
||||
s.version = '3.5.2'
|
||||
s.version = '3.5.5'
|
||||
s.author = { 'Pierre-Olivier Latour' => 'info@pol-online.net' }
|
||||
s.license = { :type => 'BSD', :file => 'LICENSE' }
|
||||
s.homepage = 'https://github.com/swisspol/GCDWebServer'
|
||||
s.summary = 'Lightweight GCD based HTTP server for OS X & iOS (includes web based uploader & WebDAV server)'
|
||||
|
||||
s.source = { :git => 'https://github.com/swisspol/GCDWebServer.git', :tag => s.version.to_s }
|
||||
s.ios.deployment_target = '8.0'
|
||||
s.tvos.deployment_target = '9.0'
|
||||
s.osx.deployment_target = '10.7'
|
||||
s.requires_arc = true
|
||||
s.source = { :git => 'https://git.g7software.net/cuong/GCDWebServer.git', :tag => s.version.to_s }
|
||||
s.ios.deployment_target = '16.0'
|
||||
s.tvos.deployment_target = '16.0'
|
||||
s.osx.deployment_target = '12.0'
|
||||
|
||||
s.default_subspec = 'Core'
|
||||
|
||||
s.subspec 'Core' do |cs|
|
||||
cs.source_files = 'GCDWebServer/**/*.{h,m}'
|
||||
cs.private_header_files = "GCDWebServer/Core/GCDWebServerPrivate.h"
|
||||
cs.requires_arc = true
|
||||
cs.frameworks = 'UniformTypeIdentifiers'
|
||||
cs.ios.library = 'z'
|
||||
cs.ios.frameworks = 'MobileCoreServices', 'CFNetwork'
|
||||
cs.ios.frameworks = 'CoreServices', 'CFNetwork'
|
||||
cs.tvos.library = 'z'
|
||||
cs.tvos.frameworks = 'MobileCoreServices', 'CFNetwork'
|
||||
cs.tvos.frameworks = 'CoreServices', 'CFNetwork'
|
||||
cs.osx.library = 'z'
|
||||
cs.osx.framework = 'SystemConfiguration'
|
||||
end
|
||||
@ -36,17 +28,14 @@ Pod::Spec.new do |s|
|
||||
s.subspec 'WebDAV' do |cs|
|
||||
cs.dependency 'GCDWebServer/Core'
|
||||
cs.source_files = 'GCDWebDAVServer/*.{h,m}'
|
||||
cs.requires_arc = true
|
||||
cs.ios.library = 'xml2'
|
||||
cs.tvos.library = 'xml2'
|
||||
cs.osx.library = 'xml2'
|
||||
cs.compiler_flags = '-I$(SDKROOT)/usr/include/libxml2'
|
||||
end
|
||||
|
||||
s.subspec 'WebUploader' do |cs|
|
||||
cs.dependency 'GCDWebServer/Core'
|
||||
cs.source_files = 'GCDWebUploader/*.{h,m}'
|
||||
cs.requires_arc = true
|
||||
cs.resource = "GCDWebUploader/GCDWebUploader.bundle"
|
||||
end
|
||||
end
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 48;
|
||||
objectVersion = 77;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXAggregateTarget section */
|
||||
@ -96,7 +96,7 @@
|
||||
CEE28D501AE0098600F4023C /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2BE851018E79DAF0061360B /* SystemConfiguration.framework */; };
|
||||
CEE28D511AE0098C00F4023C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E208D1B2167BB17E00500836 /* CoreServices.framework */; };
|
||||
CEE28D521AE00A7A00F4023C /* GCDWebServers.h in Headers */ = {isa = PBXBuildFile; fileRef = CEE28CF31AE0051F00F4023C /* GCDWebServers.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
CEE28D571AE00AFE00F4023C /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E221129C1690B7BA0048D2B2 /* MobileCoreServices.framework */; };
|
||||
CEE28D571AE00AFE00F4023C /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E221129C1690B7BA0048D2B2 /* CoreServices.framework */; };
|
||||
CEE28D591AE00AFE00F4023C /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E22112981690B7AA0048D2B2 /* CFNetwork.framework */; };
|
||||
CEE28D6A1AE1ABAA00F4023C /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CEE28D691AE1ABAA00F4023C /* UIKit.framework */; };
|
||||
E208D149167B76B700500836 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E208D148167B76B700500836 /* CFNetwork.framework */; };
|
||||
@ -161,7 +161,7 @@
|
||||
E2DDD1B71BE6951A002CE867 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2DDD1B61BE6951A002CE867 /* CFNetwork.framework */; };
|
||||
E2DDD1BA1BE69545002CE867 /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E2DDD1B91BE69545002CE867 /* libz.tbd */; };
|
||||
E2DDD1BC1BE69551002CE867 /* libxml2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = E2DDD1BB1BE69551002CE867 /* libxml2.tbd */; };
|
||||
E2DDD1BE1BE6956F002CE867 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2DDD1BD1BE6956F002CE867 /* MobileCoreServices.framework */; };
|
||||
E2DDD1BE1BE6956F002CE867 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2DDD1BD1BE6956F002CE867 /* CoreServices.framework */; };
|
||||
E2DDD1C01BE69576002CE867 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E2DDD1BF1BE69576002CE867 /* UIKit.framework */; };
|
||||
E2DDD1CE1BE698A8002CE867 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2DDD1CD1BE698A8002CE867 /* AppDelegate.swift */; };
|
||||
E2DDD1D11BE698A8002CE867 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E2DDD1D01BE698A8002CE867 /* ViewController.swift */; };
|
||||
@ -293,7 +293,7 @@
|
||||
E208D1B2167BB17E00500836 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = System/Library/Frameworks/CoreServices.framework; sourceTree = SDKROOT; };
|
||||
E221128E1690B6470048D2B2 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
E22112981690B7AA0048D2B2 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E221129C1690B7BA0048D2B2 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E221129C1690B7BA0048D2B2 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/System/Library/Frameworks/CoreServices.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E24039251BA09207000B7089 /* Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = Tests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E24039311BA092B7000B7089 /* Tests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Tests.m; sourceTree = "<group>"; };
|
||||
E24A3C4021E2940600C58878 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
|
||||
@ -335,7 +335,7 @@
|
||||
E2DDD1B61BE6951A002CE867 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E2DDD1B91BE69545002CE867 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/usr/lib/libz.tbd; sourceTree = DEVELOPER_DIR; };
|
||||
E2DDD1BB1BE69551002CE867 /* libxml2.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libxml2.tbd; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/usr/lib/libxml2.tbd; sourceTree = DEVELOPER_DIR; };
|
||||
E2DDD1BD1BE6956F002CE867 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/MobileCoreServices.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E2DDD1BD1BE6956F002CE867 /* CoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreServices.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/CoreServices.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E2DDD1BF1BE69576002CE867 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
|
||||
E2DDD1C71BE698A8002CE867 /* GCDWebServer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GCDWebServer.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
E2DDD1CD1BE698A8002CE867 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||
@ -387,7 +387,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
CEE28D6A1AE1ABAA00F4023C /* UIKit.framework in Frameworks */,
|
||||
CEE28D571AE00AFE00F4023C /* MobileCoreServices.framework in Frameworks */,
|
||||
CEE28D571AE00AFE00F4023C /* CoreServices.framework in Frameworks */,
|
||||
CEE28D591AE00AFE00F4023C /* CFNetwork.framework in Frameworks */,
|
||||
E2DDD2251BE6A0AE002CE867 /* libxml2.tbd in Frameworks */,
|
||||
E2DDD2271BE6A0B4002CE867 /* libz.tbd in Frameworks */,
|
||||
@ -407,7 +407,7 @@
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
E2DDD1C01BE69576002CE867 /* UIKit.framework in Frameworks */,
|
||||
E2DDD1BE1BE6956F002CE867 /* MobileCoreServices.framework in Frameworks */,
|
||||
E2DDD1BE1BE6956F002CE867 /* CoreServices.framework in Frameworks */,
|
||||
E2DDD1B71BE6951A002CE867 /* CFNetwork.framework in Frameworks */,
|
||||
E2DDD1BC1BE69551002CE867 /* libxml2.tbd in Frameworks */,
|
||||
E2DDD1BA1BE69545002CE867 /* libz.tbd in Frameworks */,
|
||||
@ -490,7 +490,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CEE28D691AE1ABAA00F4023C /* UIKit.framework */,
|
||||
E221129C1690B7BA0048D2B2 /* MobileCoreServices.framework */,
|
||||
E221129C1690B7BA0048D2B2 /* CoreServices.framework */,
|
||||
E22112981690B7AA0048D2B2 /* CFNetwork.framework */,
|
||||
E2DDD2241BE6A0AE002CE867 /* libxml2.tbd */,
|
||||
E2DDD2261BE6A0B4002CE867 /* libz.tbd */,
|
||||
@ -593,7 +593,7 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E2DDD1BF1BE69576002CE867 /* UIKit.framework */,
|
||||
E2DDD1BD1BE6956F002CE867 /* MobileCoreServices.framework */,
|
||||
E2DDD1BD1BE6956F002CE867 /* CoreServices.framework */,
|
||||
E2DDD1B61BE6951A002CE867 /* CFNetwork.framework */,
|
||||
E2DDD1BB1BE69551002CE867 /* libxml2.tbd */,
|
||||
E2DDD1B91BE69545002CE867 /* libz.tbd */,
|
||||
@ -838,7 +838,8 @@
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 1010;
|
||||
BuildIndependentTargetsInParallel = YES;
|
||||
LastUpgradeCheck = 2650;
|
||||
TargetAttributes = {
|
||||
CEE28CD01AE004D800F4023C = {
|
||||
CreatedOnToolsVersion = 6.3;
|
||||
@ -863,18 +864,14 @@
|
||||
};
|
||||
};
|
||||
buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "GCDWebServer" */;
|
||||
compatibilityVersion = "Xcode 8.0";
|
||||
developmentRegion = English;
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
en,
|
||||
Base,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* LittleCMS */;
|
||||
preferredProjectObjectVersion = 77;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
@ -1150,7 +1147,8 @@
|
||||
1DEB928608733DD80010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12;
|
||||
PRODUCT_NAME = GCDWebServer;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@ -1159,7 +1157,8 @@
|
||||
1DEB928708733DD80010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 12;
|
||||
PRODUCT_NAME = GCDWebServer;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
@ -1169,18 +1168,48 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BUNDLE_VERSION_STRING = 3.5.2;
|
||||
BUNDLE_VERSION_STRING = 3.5.5;
|
||||
OTHER_LDFLAGS = "-framework UniformTypeIdentifiers";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1";
|
||||
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = __GCDWEBSERVER_ENABLE_TESTING__;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "net.pol-online.GCDWebServers";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
WARNING_CFLAGS = (
|
||||
"-Wall",
|
||||
"-Weverything",
|
||||
@ -1210,16 +1239,45 @@
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
BUNDLE_VERSION_STRING = 3.5.2;
|
||||
BUNDLE_VERSION_STRING = 3.5.5;
|
||||
OTHER_LDFLAGS = "-framework UniformTypeIdentifiers";
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
CLANG_WARN_COMMA = YES;
|
||||
CLANG_WARN_CONSTANT_CONVERSION = YES;
|
||||
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
|
||||
CLANG_WARN_EMPTY_BODY = YES;
|
||||
CLANG_WARN_ENUM_CONVERSION = YES;
|
||||
CLANG_WARN_INFINITE_RECURSION = YES;
|
||||
CLANG_WARN_INT_CONVERSION = YES;
|
||||
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = YES;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = __GCDWEBSERVER_ENABLE_TESTING__;
|
||||
GCC_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
HEADER_SEARCH_PATHS = "$(SDKROOT)/usr/include/libxml2";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "net.pol-online.GCDWebServers";
|
||||
STRING_CATALOG_GENERATE_SYMBOLS = YES;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
SWIFT_TREAT_WARNINGS_AS_ERRORS = YES;
|
||||
SWIFT_VERSION = 4.2;
|
||||
SWIFT_VERSION = 5.0;
|
||||
WARNING_CFLAGS = "-Wall";
|
||||
};
|
||||
name = Release;
|
||||
@ -1227,13 +1285,21 @@
|
||||
CEE28CE41AE004D800F4023C /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = NO;
|
||||
INFOPLIST_FILE = Frameworks/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 12;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}";
|
||||
PRODUCT_NAME = GCDWebServers;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
@ -1243,13 +1309,21 @@
|
||||
CEE28CE51AE004D800F4023C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = NO;
|
||||
INFOPLIST_FILE = Frameworks/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 12;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}";
|
||||
PRODUCT_NAME = GCDWebServers;
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
@ -1259,14 +1333,22 @@
|
||||
CEE28D031AE0052000F4023C /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = NO;
|
||||
INFOPLIST_FILE = Frameworks/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MODULEMAP_FILE = Frameworks/module.modulemap;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}";
|
||||
PRODUCT_NAME = GCDWebServers;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
@ -1277,14 +1359,22 @@
|
||||
CEE28D041AE0052000F4023C /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = NO;
|
||||
INFOPLIST_FILE = Frameworks/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MODULEMAP_FILE = Frameworks/module.modulemap;
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}";
|
||||
PRODUCT_NAME = GCDWebServers;
|
||||
SDKROOT = iphoneos;
|
||||
SKIP_INSTALL = YES;
|
||||
@ -1295,12 +1385,18 @@
|
||||
E240392F1BA09207000B7089 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
"$(inherited)",
|
||||
);
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 12;
|
||||
PRODUCT_NAME = Tests;
|
||||
SDKROOT = macosx;
|
||||
WARNING_CFLAGS = (
|
||||
@ -1313,12 +1409,18 @@
|
||||
E24039301BA09207000B7089 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(DEVELOPER_FRAMEWORKS_DIR)",
|
||||
"$(inherited)",
|
||||
);
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||
GENERATE_INFOPLIST_FILE = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
"@loader_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 12;
|
||||
PRODUCT_NAME = Tests;
|
||||
SDKROOT = macosx;
|
||||
WARNING_CFLAGS = (
|
||||
@ -1331,6 +1433,7 @@
|
||||
E274F877187E77D8009E0582 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Debug;
|
||||
@ -1338,6 +1441,7 @@
|
||||
E274F878187E77D8009E0582 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
};
|
||||
name = Release;
|
||||
@ -1345,38 +1449,54 @@
|
||||
E2DDD1901BE69404002CE867 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = NO;
|
||||
INFOPLIST_FILE = Frameworks/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}";
|
||||
PRODUCT_NAME = GCDWebServers;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 16;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E2DDD1911BE69404002CE867 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
CODE_SIGN_IDENTITY = "";
|
||||
CODE_SIGN_STYLE = Manual;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
ENABLE_MODULE_VERIFIER = NO;
|
||||
INFOPLIST_FILE = Frameworks/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
"@loader_path/Frameworks",
|
||||
);
|
||||
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++14";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "${PRODUCT_BUNDLE_IDENTIFIER}";
|
||||
PRODUCT_NAME = GCDWebServers;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
SKIP_INSTALL = YES;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 16;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -1387,11 +1507,14 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = tvOS/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = GCDWebServer;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 16;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -1402,11 +1525,14 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
INFOPLIST_FILE = tvOS/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = GCDWebServer;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = appletvos;
|
||||
TVOS_DEPLOYMENT_TARGET = 9.0;
|
||||
TVOS_DEPLOYMENT_TARGET = 16;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -1416,8 +1542,11 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_BITCODE = YES;
|
||||
INFOPLIST_FILE = iOS/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = GCDWebServer;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
@ -1430,8 +1559,11 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_BITCODE = YES;
|
||||
INFOPLIST_FILE = iOS/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 16;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/Frameworks",
|
||||
);
|
||||
PRODUCT_NAME = GCDWebServer;
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "2650"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -26,8 +26,8 @@
|
||||
buildConfiguration = "Debug"
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
enableAddressSanitizer = "YES"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
enableAddressSanitizer = "YES">
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
@ -40,8 +40,6 @@
|
||||
</BuildableReference>
|
||||
</TestableReference>
|
||||
</Testables>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@ -62,8 +60,6 @@
|
||||
ReferencedContainer = "container:GCDWebServer.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "2650"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -27,8 +27,6 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
@ -38,8 +36,8 @@
|
||||
ReferencedContainer = "container:GCDWebServer.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@ -60,8 +58,6 @@
|
||||
ReferencedContainer = "container:GCDWebServer.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1010"
|
||||
LastUpgradeVersion = "2650"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
@ -27,8 +27,6 @@
|
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES">
|
||||
<Testables>
|
||||
</Testables>
|
||||
<MacroExpansion>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
@ -38,8 +36,8 @@
|
||||
ReferencedContainer = "container:GCDWebServer.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
<Testables>
|
||||
</Testables>
|
||||
</TestAction>
|
||||
<LaunchAction
|
||||
buildConfiguration = "Debug"
|
||||
@ -60,8 +58,6 @@
|
||||
ReferencedContainer = "container:GCDWebServer.xcodeproj">
|
||||
</BuildableReference>
|
||||
</MacroExpansion>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
buildConfiguration = "Release"
|
||||
|
||||
@ -69,6 +69,13 @@ typedef GCDWebServerResponse* _Nullable (^GCDWebServerProcessBlock)(__kindof GCD
|
||||
typedef void (^GCDWebServerCompletionBlock)(GCDWebServerResponse* _Nullable response);
|
||||
typedef void (^GCDWebServerAsyncProcessBlock)(__kindof GCDWebServerRequest* request, GCDWebServerCompletionBlock completionBlock);
|
||||
|
||||
/**
|
||||
* The GCDWebServerBuiltInLoggerBlock is used to override the built-in logger at runtime.
|
||||
* The block will be passed the log level and the log message, see setLogLevel for
|
||||
* documentation of the log levels for the built-in logger.
|
||||
*/
|
||||
typedef void (^GCDWebServerBuiltInLoggerBlock)(int level, NSString* _Nonnull message);
|
||||
|
||||
/**
|
||||
* The port used by the GCDWebServer (NSNumber / NSUInteger).
|
||||
*
|
||||
@ -85,6 +92,13 @@ extern NSString* const GCDWebServerOption_Port;
|
||||
*/
|
||||
extern NSString* const GCDWebServerOption_BonjourName;
|
||||
|
||||
/**
|
||||
* The Bonjour TXT Data used by the GCDWebServer (NSDictionary<NSString, NSString>).
|
||||
*
|
||||
* The default value is nil.
|
||||
*/
|
||||
extern NSString* const GCDWebServerOption_BonjourTXTData;
|
||||
|
||||
/**
|
||||
* The Bonjour service type used by the GCDWebServer (NSString).
|
||||
*
|
||||
@ -573,6 +587,14 @@ extern NSString* const GCDWebServerAuthenticationMethod_DigestAccess;
|
||||
*/
|
||||
+ (void)setLogLevel:(int)level;
|
||||
|
||||
/**
|
||||
* Set a logger to be used instead of the built-in logger which logs to stderr.
|
||||
*
|
||||
* IMPORTANT: In order for this override to work, you should not be specifying
|
||||
* a custom logger at compile time with "__GCDWEBSERVER_LOGGING_HEADER__".
|
||||
*/
|
||||
+ (void)setBuiltInLogger:(GCDWebServerBuiltInLoggerBlock)block;
|
||||
|
||||
/**
|
||||
* Logs a message to the logging facility at the VERBOSE level.
|
||||
*/
|
||||
|
||||
@ -53,6 +53,7 @@
|
||||
NSString* const GCDWebServerOption_Port = @"Port";
|
||||
NSString* const GCDWebServerOption_BonjourName = @"BonjourName";
|
||||
NSString* const GCDWebServerOption_BonjourType = @"BonjourType";
|
||||
NSString* const GCDWebServerOption_BonjourTXTData = @"BonjourTXTData";
|
||||
NSString* const GCDWebServerOption_RequestNATPortMapping = @"RequestNATPortMapping";
|
||||
NSString* const GCDWebServerOption_BindToLocalhost = @"BindToLocalhost";
|
||||
NSString* const GCDWebServerOption_MaxPendingConnections = @"MaxPendingConnections";
|
||||
@ -85,18 +86,24 @@ static BOOL _run;
|
||||
|
||||
#ifdef __GCDWEBSERVER_LOGGING_FACILITY_BUILTIN__
|
||||
|
||||
static GCDWebServerBuiltInLoggerBlock _builtInLoggerBlock;
|
||||
|
||||
void GCDWebServerLogMessage(GCDWebServerLoggingLevel level, NSString* format, ...) {
|
||||
static const char* levelNames[] = {"DEBUG", "VERBOSE", "INFO", "WARNING", "ERROR"};
|
||||
static int enableLogging = -1;
|
||||
if (enableLogging < 0) {
|
||||
enableLogging = (isatty(STDERR_FILENO) ? 1 : 0);
|
||||
}
|
||||
if (enableLogging) {
|
||||
if (_builtInLoggerBlock || enableLogging) {
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
NSString* message = [[NSString alloc] initWithFormat:format arguments:arguments];
|
||||
va_end(arguments);
|
||||
fprintf(stderr, "[%s] %s\n", levelNames[level], [message UTF8String]);
|
||||
if (_builtInLoggerBlock) {
|
||||
_builtInLoggerBlock(level, message);
|
||||
} else {
|
||||
fprintf(stderr, "[%s] %s\n", levelNames[level], [message UTF8String]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -117,7 +124,7 @@ static void _SignalHandler(int signal) {
|
||||
// https://developer.apple.com/library/mac/documentation/General/Conceptual/ConcurrencyProgrammingGuide/OperationQueues/OperationQueues.html
|
||||
// The main queue works with the application’s run loop to interleave the execution of queued tasks with the execution of other event sources attached to the run loop
|
||||
// TODO: Ensure all scheduled blocks on the main queue are also executed
|
||||
static void _ExecuteMainThreadRunLoopSources() {
|
||||
static void _ExecuteMainThreadRunLoopSources(void) {
|
||||
SInt32 result;
|
||||
do {
|
||||
result = CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, true);
|
||||
@ -584,6 +591,29 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
||||
CFNetServiceSetClient(_registrationService, _NetServiceRegisterCallBack, &context);
|
||||
CFNetServiceScheduleWithRunLoop(_registrationService, CFRunLoopGetMain(), kCFRunLoopCommonModes);
|
||||
CFStreamError streamError = {0};
|
||||
|
||||
NSDictionary* txtDataDictionary = _GetOption(_options, GCDWebServerOption_BonjourTXTData, nil);
|
||||
if (txtDataDictionary != nil) {
|
||||
NSUInteger count = txtDataDictionary.count;
|
||||
CFStringRef keys[count];
|
||||
CFStringRef values[count];
|
||||
NSUInteger index = 0;
|
||||
for (NSString *key in txtDataDictionary) {
|
||||
NSString *value = txtDataDictionary[key];
|
||||
keys[index] = (__bridge CFStringRef)(key);
|
||||
values[index] = (__bridge CFStringRef)(value);
|
||||
index ++;
|
||||
}
|
||||
CFDictionaryRef txtDictionary = CFDictionaryCreate(CFAllocatorGetDefault(), (void *)keys, (void *)values, count, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
|
||||
if (txtDictionary != NULL) {
|
||||
CFDataRef txtData = CFNetServiceCreateTXTDataWithDictionary(nil, txtDictionary);
|
||||
Boolean setTXTDataResult = CFNetServiceSetTXTData(_registrationService, txtData);
|
||||
if (!setTXTDataResult) {
|
||||
GWS_LOG_ERROR(@"Failed setting TXTData");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CFNetServiceRegisterWithOptions(_registrationService, 0, &streamError);
|
||||
|
||||
_resolutionService = CFNetServiceCreateCopy(kCFAllocatorDefault, _registrationService);
|
||||
@ -870,13 +900,14 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
||||
}
|
||||
|
||||
- (void)addDefaultHandlerForMethod:(NSString*)method requestClass:(Class)aClass asyncProcessBlock:(GCDWebServerAsyncProcessBlock)block {
|
||||
[self addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:method]) {
|
||||
return nil;
|
||||
}
|
||||
return [(GCDWebServerRequest*)[aClass alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
}
|
||||
asyncProcessBlock:block];
|
||||
[self
|
||||
addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:method]) {
|
||||
return nil;
|
||||
}
|
||||
return [(GCDWebServerRequest*)[aClass alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
}
|
||||
asyncProcessBlock:block];
|
||||
}
|
||||
|
||||
- (void)addHandlerForMethod:(NSString*)method path:(NSString*)path requestClass:(Class)aClass processBlock:(GCDWebServerProcessBlock)block {
|
||||
@ -890,16 +921,17 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
||||
|
||||
- (void)addHandlerForMethod:(NSString*)method path:(NSString*)path requestClass:(Class)aClass asyncProcessBlock:(GCDWebServerAsyncProcessBlock)block {
|
||||
if ([path hasPrefix:@"/"] && [aClass isSubclassOfClass:[GCDWebServerRequest class]]) {
|
||||
[self addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:method]) {
|
||||
return nil;
|
||||
}
|
||||
if ([urlPath caseInsensitiveCompare:path] != NSOrderedSame) {
|
||||
return nil;
|
||||
}
|
||||
return [(GCDWebServerRequest*)[aClass alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
}
|
||||
asyncProcessBlock:block];
|
||||
[self
|
||||
addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:method]) {
|
||||
return nil;
|
||||
}
|
||||
if ([urlPath caseInsensitiveCompare:path] != NSOrderedSame) {
|
||||
return nil;
|
||||
}
|
||||
return [(GCDWebServerRequest*)[aClass alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
}
|
||||
asyncProcessBlock:block];
|
||||
} else {
|
||||
GWS_DNOT_REACHED();
|
||||
}
|
||||
@ -917,34 +949,35 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
||||
- (void)addHandlerForMethod:(NSString*)method pathRegex:(NSString*)regex requestClass:(Class)aClass asyncProcessBlock:(GCDWebServerAsyncProcessBlock)block {
|
||||
NSRegularExpression* expression = [NSRegularExpression regularExpressionWithPattern:regex options:NSRegularExpressionCaseInsensitive error:NULL];
|
||||
if (expression && [aClass isSubclassOfClass:[GCDWebServerRequest class]]) {
|
||||
[self addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:method]) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSArray* matches = [expression matchesInString:urlPath options:0 range:NSMakeRange(0, urlPath.length)];
|
||||
if (matches.count == 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableArray* captures = [NSMutableArray array];
|
||||
for (NSTextCheckingResult* result in matches) {
|
||||
// Start at 1; index 0 is the whole string
|
||||
for (NSUInteger i = 1; i < result.numberOfRanges; i++) {
|
||||
NSRange range = [result rangeAtIndex:i];
|
||||
// range is {NSNotFound, 0} "if one of the capture groups did not participate in this particular match"
|
||||
// see discussion in -[NSRegularExpression firstMatchInString:options:range:]
|
||||
if (range.location != NSNotFound) {
|
||||
[captures addObject:[urlPath substringWithRange:range]];
|
||||
[self
|
||||
addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:method]) {
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GCDWebServerRequest* request = [(GCDWebServerRequest*)[aClass alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
[request setAttribute:captures forKey:GCDWebServerRequestAttribute_RegexCaptures];
|
||||
return request;
|
||||
}
|
||||
asyncProcessBlock:block];
|
||||
NSArray* matches = [expression matchesInString:urlPath options:0 range:NSMakeRange(0, urlPath.length)];
|
||||
if (matches.count == 0) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSMutableArray* captures = [NSMutableArray array];
|
||||
for (NSTextCheckingResult* result in matches) {
|
||||
// Start at 1; index 0 is the whole string
|
||||
for (NSUInteger i = 1; i < result.numberOfRanges; i++) {
|
||||
NSRange range = [result rangeAtIndex:i];
|
||||
// range is {NSNotFound, 0} "if one of the capture groups did not participate in this particular match"
|
||||
// see discussion in -[NSRegularExpression firstMatchInString:options:range:]
|
||||
if (range.location != NSNotFound) {
|
||||
[captures addObject:[urlPath substringWithRange:range]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
GCDWebServerRequest* request = [(GCDWebServerRequest*)[aClass alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
[request setAttribute:captures forKey:GCDWebServerRequestAttribute_RegexCaptures];
|
||||
return request;
|
||||
}
|
||||
asyncProcessBlock:block];
|
||||
} else {
|
||||
GWS_DNOT_REACHED();
|
||||
}
|
||||
@ -1015,15 +1048,16 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
||||
- (void)addGETHandlerForBasePath:(NSString*)basePath directoryPath:(NSString*)directoryPath indexFilename:(NSString*)indexFilename cacheAge:(NSUInteger)cacheAge allowRangeRequests:(BOOL)allowRangeRequests {
|
||||
if ([basePath hasPrefix:@"/"] && [basePath hasSuffix:@"/"]) {
|
||||
GCDWebServer* __unsafe_unretained server = self;
|
||||
[self addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:@"GET"]) {
|
||||
return nil;
|
||||
}
|
||||
if (![urlPath hasPrefix:basePath]) {
|
||||
return nil;
|
||||
}
|
||||
return [[GCDWebServerRequest alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
}
|
||||
[self
|
||||
addHandlerWithMatchBlock:^GCDWebServerRequest*(NSString* requestMethod, NSURL* requestURL, NSDictionary<NSString*, NSString*>* requestHeaders, NSString* urlPath, NSDictionary<NSString*, NSString*>* urlQuery) {
|
||||
if (![requestMethod isEqualToString:@"GET"]) {
|
||||
return nil;
|
||||
}
|
||||
if (![urlPath hasPrefix:basePath]) {
|
||||
return nil;
|
||||
}
|
||||
return [[GCDWebServerRequest alloc] initWithMethod:requestMethod url:requestURL headers:requestHeaders path:urlPath query:urlQuery];
|
||||
}
|
||||
processBlock:^GCDWebServerResponse*(GCDWebServerRequest* request) {
|
||||
GCDWebServerResponse* response = nil;
|
||||
NSString* filePath = [directoryPath stringByAppendingPathComponent:GCDWebServerNormalizePath([request.path substringFromIndex:basePath.length])];
|
||||
@ -1071,6 +1105,14 @@ static inline NSString* _EncodeBase64(NSString* string) {
|
||||
#endif
|
||||
}
|
||||
|
||||
+ (void)setBuiltInLogger:(GCDWebServerBuiltInLoggerBlock)block {
|
||||
#if defined(__GCDWEBSERVER_LOGGING_FACILITY_BUILTIN__)
|
||||
_builtInLoggerBlock = block;
|
||||
#else
|
||||
GWS_DNOT_REACHED(); // Built-in logger must be enabled in order to override
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)logVerbose:(NSString*)format, ... {
|
||||
va_list arguments;
|
||||
va_start(arguments, format);
|
||||
|
||||
@ -779,7 +779,7 @@ static inline BOOL _CompareResources(NSString* responseETag, NSString* requestET
|
||||
|
||||
- (GCDWebServerResponse*)overrideResponse:(GCDWebServerResponse*)response forRequest:(GCDWebServerRequest*)request {
|
||||
if ((response.statusCode >= 200) && (response.statusCode < 300) && _CompareResources(response.eTag, request.ifNoneMatch, response.lastModifiedDate, request.ifModifiedSince)) {
|
||||
NSInteger code = [request.method isEqualToString:@"HEAD"] || [request.method isEqualToString:@"GET"] ? kGCDWebServerHTTPStatusCode_NotModified : kGCDWebServerHTTPStatusCode_PreconditionFailed;
|
||||
NSInteger code = [request.method isEqualToString:@"HEAD"] || [request.method isEqualToString:@"GET"] ? (NSInteger)kGCDWebServerHTTPStatusCode_NotModified : (NSInteger)kGCDWebServerHTTPStatusCode_PreconditionFailed;
|
||||
GCDWebServerResponse* newResponse = [GCDWebServerResponse responseWithStatusCode:code];
|
||||
newResponse.cacheControlMaxAge = response.cacheControlMaxAge;
|
||||
newResponse.lastModifiedDate = response.lastModifiedDate;
|
||||
@ -794,8 +794,8 @@ static inline BOOL _CompareResources(NSString* responseETag, NSString* requestET
|
||||
GWS_DCHECK(_responseMessage == NULL);
|
||||
GWS_DCHECK((statusCode >= 400) && (statusCode < 600));
|
||||
[self _initializeResponseHeadersWithStatusCode:statusCode];
|
||||
[self writeHeadersWithCompletionBlock:^(BOOL success) {
|
||||
; // Nothing more to do
|
||||
[self writeHeadersWithCompletionBlock:^(BOOL success){
|
||||
// Nothing more to do
|
||||
}];
|
||||
GWS_LOG_DEBUG(@"Connection aborted with status code %i on socket %i", (int)statusCode, _socket);
|
||||
}
|
||||
|
||||
@ -31,10 +31,11 @@
|
||||
|
||||
#import <TargetConditionals.h>
|
||||
#if TARGET_OS_IPHONE
|
||||
#import <MobileCoreServices/MobileCoreServices.h>
|
||||
#import <CoreServices/CoreServices.h>
|
||||
#else
|
||||
#import <SystemConfiguration/SystemConfiguration.h>
|
||||
#endif
|
||||
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#import <ifaddrs.h>
|
||||
@ -48,7 +49,7 @@ static NSDateFormatter* _dateFormatterISO8601 = nil;
|
||||
static dispatch_queue_t _dateFormatterQueue = NULL;
|
||||
|
||||
// TODO: Handle RFC 850 and ANSI C's asctime() format
|
||||
void GCDWebServerInitializeFunctions() {
|
||||
void GCDWebServerInitializeFunctions(void) {
|
||||
GWS_DCHECK([NSThread isMainThread]); // NSDateFormatter should be initialized on main thread
|
||||
if (_dateFormatterRFC822 == nil) {
|
||||
_dateFormatterRFC822 = [[NSDateFormatter alloc] init];
|
||||
@ -176,11 +177,7 @@ NSString* GCDWebServerGetMimeTypeForExtension(NSString* extension, NSDictionary<
|
||||
mimeType = [builtInOverrides objectForKey:extension];
|
||||
}
|
||||
if (mimeType == nil) {
|
||||
CFStringRef uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL);
|
||||
if (uti) {
|
||||
mimeType = CFBridgingRelease(UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType));
|
||||
CFRelease(uti);
|
||||
}
|
||||
mimeType = [UTType typeWithFilenameExtension:extension].preferredMIMEType;
|
||||
}
|
||||
}
|
||||
return mimeType ? mimeType : kGCDWebServerDefaultMimeType;
|
||||
@ -302,7 +299,10 @@ NSString* GCDWebServerComputeMD5Digest(NSString* format, ...) {
|
||||
const char* string = [[[NSString alloc] initWithFormat:format arguments:arguments] UTF8String];
|
||||
va_end(arguments);
|
||||
unsigned char md5[CC_MD5_DIGEST_LENGTH];
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
CC_MD5(string, (CC_LONG)strlen(string), md5);
|
||||
#pragma clang diagnostic pop
|
||||
char buffer[2 * CC_MD5_DIGEST_LENGTH + 1];
|
||||
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; ++i) {
|
||||
unsigned char byte = md5[i];
|
||||
|
||||
@ -33,7 +33,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
* The GCDWebServerBodyReaderCompletionBlock is passed by GCDWebServer to the
|
||||
* GCDWebServerBodyReader object when reading data from it asynchronously.
|
||||
*/
|
||||
typedef void (^GCDWebServerBodyReaderCompletionBlock)(NSData* data, NSError* _Nullable error);
|
||||
typedef void (^GCDWebServerBodyReaderCompletionBlock)(NSData* _Nullable data, NSError* _Nullable error);
|
||||
|
||||
/**
|
||||
* This protocol is used by the GCDWebServerConnection to communicate with
|
||||
|
||||
1
GCDWebServer/include/GCDWebServer.h
Symbolic link
1
GCDWebServer/include/GCDWebServer.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Core/GCDWebServer.h
|
||||
1
GCDWebServer/include/GCDWebServerConnection.h
Symbolic link
1
GCDWebServer/include/GCDWebServerConnection.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Core/GCDWebServerConnection.h
|
||||
1
GCDWebServer/include/GCDWebServerDataRequest.h
Symbolic link
1
GCDWebServer/include/GCDWebServerDataRequest.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Requests/GCDWebServerDataRequest.h
|
||||
1
GCDWebServer/include/GCDWebServerDataResponse.h
Symbolic link
1
GCDWebServer/include/GCDWebServerDataResponse.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Responses/GCDWebServerDataResponse.h
|
||||
1
GCDWebServer/include/GCDWebServerErrorResponse.h
Symbolic link
1
GCDWebServer/include/GCDWebServerErrorResponse.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Responses/GCDWebServerErrorResponse.h
|
||||
1
GCDWebServer/include/GCDWebServerFileRequest.h
Symbolic link
1
GCDWebServer/include/GCDWebServerFileRequest.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Requests/GCDWebServerFileRequest.h
|
||||
1
GCDWebServer/include/GCDWebServerFileResponse.h
Symbolic link
1
GCDWebServer/include/GCDWebServerFileResponse.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Responses/GCDWebServerFileResponse.h
|
||||
1
GCDWebServer/include/GCDWebServerFunctions.h
Symbolic link
1
GCDWebServer/include/GCDWebServerFunctions.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Core/GCDWebServerFunctions.h
|
||||
1
GCDWebServer/include/GCDWebServerHTTPStatusCodes.h
Symbolic link
1
GCDWebServer/include/GCDWebServerHTTPStatusCodes.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Core/GCDWebServerHTTPStatusCodes.h
|
||||
1
GCDWebServer/include/GCDWebServerMultiPartFormRequest.h
Symbolic link
1
GCDWebServer/include/GCDWebServerMultiPartFormRequest.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Requests/GCDWebServerMultiPartFormRequest.h
|
||||
1
GCDWebServer/include/GCDWebServerRequest.h
Symbolic link
1
GCDWebServer/include/GCDWebServerRequest.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Core/GCDWebServerRequest.h
|
||||
1
GCDWebServer/include/GCDWebServerResponse.h
Symbolic link
1
GCDWebServer/include/GCDWebServerResponse.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Core/GCDWebServerResponse.h
|
||||
1
GCDWebServer/include/GCDWebServerStreamedResponse.h
Symbolic link
1
GCDWebServer/include/GCDWebServerStreamedResponse.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Responses/GCDWebServerStreamedResponse.h
|
||||
1
GCDWebServer/include/GCDWebServerURLEncodedFormRequest.h
Symbolic link
1
GCDWebServer/include/GCDWebServerURLEncodedFormRequest.h
Symbolic link
@ -0,0 +1 @@
|
||||
../Requests/GCDWebServerURLEncodedFormRequest.h
|
||||
4
GCDWebServer/include/module.modulemap
Normal file
4
GCDWebServer/include/module.modulemap
Normal file
@ -0,0 +1,4 @@
|
||||
module GCDWebServer {
|
||||
umbrella "."
|
||||
export *
|
||||
}
|
||||
@ -2377,7 +2377,7 @@ input[type="button"].btn-block {
|
||||
font-family: 'Glyphicons Halflings';
|
||||
|
||||
src: url('../fonts/glyphicons-halflings-regular.eot');
|
||||
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.woff') format('woff'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
|
||||
src: url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg');
|
||||
}
|
||||
.glyphicon {
|
||||
position: relative;
|
||||
|
||||
@ -1,3 +1,3 @@
|
||||
"PROLOGUE" = "<p>Drag & drop files on this window or use the \"Upload Files…\" button to upload new files.</p>";
|
||||
"PROLOGUE" = "<p>Drag & drop files on this window or use the \"Import Files…\" button to import new files.</p>";
|
||||
"EPILOGUE" = "";
|
||||
"FOOTER_FORMAT" = "%@ %@";
|
||||
|
||||
Binary file not shown.
@ -66,12 +66,12 @@
|
||||
|
||||
<div class="btn-toolbar">
|
||||
<button type="button" class="btn btn-primary fileinput-button" id="upload-file">
|
||||
<span class="glyphicon glyphicon-upload"></span> Upload Files…
|
||||
<span class="glyphicon glyphicon-upload"></span> Import Files…
|
||||
<input id="fileupload" type="file" name="files[]" multiple>
|
||||
</button>
|
||||
<button type="button" class="btn btn-success" id="create-folder">
|
||||
<span class="glyphicon glyphicon-folder-close"></span> Create Folder…
|
||||
</button>
|
||||
<!-- <button type="button" class="btn btn-success" id="create-folder">-->
|
||||
<!-- <span class="glyphicon glyphicon-folder-close"></span> Create Folder…-->
|
||||
<!-- </button>-->
|
||||
<button type="button" class="btn btn-default" id="reload">
|
||||
<span class="glyphicon glyphicon-refresh"></span> Refresh
|
||||
</button>
|
||||
@ -156,16 +156,16 @@
|
||||
<p>{%=formatFileSize(o.size)%}</p>
|
||||
{% } %}
|
||||
</td>
|
||||
<td class="column-move">
|
||||
<button type="button" class="btn btn-default btn-xs button-move">
|
||||
<span class="glyphicon glyphicon glyphicon-share-alt"></span>
|
||||
</button>
|
||||
</td>
|
||||
<td class="column-delete">
|
||||
<button type="button" class="btn btn-danger btn-xs button-delete">
|
||||
<span class="glyphicon glyphicon-trash"></span>
|
||||
</button>
|
||||
</td>
|
||||
<!-- <td class="column-move">-->
|
||||
<!-- <button type="button" class="btn btn-default btn-xs button-move">-->
|
||||
<!-- <span class="glyphicon glyphicon glyphicon-share-alt"></span>-->
|
||||
<!-- </button>-->
|
||||
<!-- </td>-->
|
||||
<!-- <td class="column-delete">-->
|
||||
<!-- <button type="button" class="btn btn-danger btn-xs button-delete">-->
|
||||
<!-- <span class="glyphicon glyphicon-trash"></span>-->
|
||||
<!-- </button>-->
|
||||
<!-- </td>-->
|
||||
</tr>
|
||||
</script>
|
||||
|
||||
|
||||
@ -66,7 +66,12 @@ NS_ASSUME_NONNULL_END
|
||||
|
||||
- (instancetype)initWithUploadDirectory:(NSString*)path {
|
||||
if ((self = [super init])) {
|
||||
#if SWIFT_PACKAGE
|
||||
// When built with Swift Package Manager, resources live inside the auto-generated module bundle
|
||||
NSString* bundlePath = [SWIFTPM_MODULE_BUNDLE pathForResource:@"GCDWebUploader" ofType:@"bundle"];
|
||||
#else
|
||||
NSString* bundlePath = [[NSBundle bundleForClass:[GCDWebUploader class]] pathForResource:@"GCDWebUploader" ofType:@"bundle"];
|
||||
#endif
|
||||
if (bundlePath == nil) {
|
||||
return nil;
|
||||
}
|
||||
@ -325,12 +330,17 @@ NS_ASSUME_NONNULL_END
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_NotFound message:@"\"%@\" does not exist", oldRelativePath];
|
||||
}
|
||||
|
||||
NSString* oldItemName = [oldAbsolutePath lastPathComponent];
|
||||
if ((!_allowHiddenItems && [oldItemName hasPrefix:@"."]) || (!isDirectory && ![self _checkFileExtension:oldItemName])) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Forbidden message:@"Moving from item name \"%@\" is not allowed", oldItemName];
|
||||
}
|
||||
|
||||
NSString* newRelativePath = [request.arguments objectForKey:@"newPath"];
|
||||
NSString* newAbsolutePath = [self _uniquePathForPath:[_uploadDirectory stringByAppendingPathComponent:GCDWebServerNormalizePath(newRelativePath)]];
|
||||
|
||||
NSString* itemName = [newAbsolutePath lastPathComponent];
|
||||
if ((!_allowHiddenItems && [itemName hasPrefix:@"."]) || (!isDirectory && ![self _checkFileExtension:itemName])) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Forbidden message:@"Moving to item name \"%@\" is not allowed", itemName];
|
||||
NSString* newItemName = [newAbsolutePath lastPathComponent];
|
||||
if ((!_allowHiddenItems && [newItemName hasPrefix:@"."]) || (!isDirectory && ![self _checkFileExtension:newItemName])) {
|
||||
return [GCDWebServerErrorResponse responseWithClientError:kGCDWebServerHTTPStatusCode_Forbidden message:@"Moving to item name \"%@\" is not allowed", newItemName];
|
||||
}
|
||||
|
||||
if (![self shouldMoveItemFromPath:oldAbsolutePath toPath:newAbsolutePath]) {
|
||||
@ -415,15 +425,15 @@ NS_ASSUME_NONNULL_END
|
||||
}
|
||||
|
||||
- (BOOL)shouldMoveItemFromPath:(NSString*)fromPath toPath:(NSString*)toPath {
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)shouldDeleteItemAtPath:(NSString*)path {
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (BOOL)shouldCreateDirectoryAtPath:(NSString*)path {
|
||||
return YES;
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
1
GCDWebUploader/include/GCDWebUploader.h
Symbolic link
1
GCDWebUploader/include/GCDWebUploader.h
Symbolic link
@ -0,0 +1 @@
|
||||
../GCDWebUploader.h
|
||||
@ -380,7 +380,7 @@ int main(int argc, const char* argv[]) {
|
||||
webServer.delegate = delegate;
|
||||
#endif
|
||||
fprintf(stdout, "<RUNNING TESTS FROM \"%s\">\n\n", [testDirectory UTF8String]);
|
||||
result = (int)[webServer runTestsWithOptions:@{ GCDWebServerOption_Port : @8080 } inDirectory:testDirectory];
|
||||
result = (int)[webServer runTestsWithOptions:@{GCDWebServerOption_Port : @8080} inDirectory:testDirectory];
|
||||
} else {
|
||||
webServer.delegate = delegate;
|
||||
if (recording) {
|
||||
|
||||
56
Package.swift
Normal file
56
Package.swift
Normal file
@ -0,0 +1,56 @@
|
||||
// swift-tools-version:5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "GCDWebServer",
|
||||
platforms: [
|
||||
.iOS(.v16),
|
||||
.tvOS(.v16),
|
||||
.macOS(.v12),
|
||||
],
|
||||
products: [
|
||||
.library(name: "GCDWebServer", targets: ["GCDWebServer"]),
|
||||
.library(name: "GCDWebUploader", targets: ["GCDWebUploader"]),
|
||||
.library(name: "GCDWebDAVServer", targets: ["GCDWebDAVServer"]),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "GCDWebServer",
|
||||
path: "GCDWebServer",
|
||||
// Public headers are exposed via symlinks in include/ so that GCDWebServerPrivate.h stays private.
|
||||
publicHeadersPath: "include",
|
||||
cSettings: [
|
||||
// Source files import sibling headers across these subdirectories with quoted #imports.
|
||||
.headerSearchPath("Core"),
|
||||
.headerSearchPath("Requests"),
|
||||
.headerSearchPath("Responses"),
|
||||
],
|
||||
linkerSettings: [
|
||||
.linkedLibrary("z"),
|
||||
.linkedFramework("UniformTypeIdentifiers"),
|
||||
.linkedFramework("CoreServices", .when(platforms: [.iOS, .tvOS])),
|
||||
.linkedFramework("CFNetwork", .when(platforms: [.iOS, .tvOS])),
|
||||
.linkedFramework("SystemConfiguration", .when(platforms: [.macOS])),
|
||||
]
|
||||
),
|
||||
.target(
|
||||
name: "GCDWebUploader",
|
||||
dependencies: ["GCDWebServer"],
|
||||
path: "GCDWebUploader",
|
||||
exclude: [".DS_Store"],
|
||||
resources: [
|
||||
.copy("GCDWebUploader.bundle"),
|
||||
],
|
||||
publicHeadersPath: "include"
|
||||
),
|
||||
.target(
|
||||
name: "GCDWebDAVServer",
|
||||
dependencies: ["GCDWebServer"],
|
||||
path: "GCDWebDAVServer",
|
||||
publicHeadersPath: ".",
|
||||
linkerSettings: [
|
||||
.linkedLibrary("xml2"),
|
||||
]
|
||||
),
|
||||
]
|
||||
)
|
||||
34
README.md
34
README.md
@ -2,11 +2,11 @@ Overview
|
||||
========
|
||||
|
||||
[](https://travis-ci.org/swisspol/GCDWebServer)
|
||||
[](http://cocoadocs.org/docsets/GCDWebServer)
|
||||
[](https://cocoapods.org/pods/GCDWebServer)
|
||||
[](https://github.com/swisspol/GCDWebServer)
|
||||
[](LICENSE)
|
||||
|
||||
GCDWebServer is a modern and lightweight GCD based HTTP 1.1 server designed to be embedded in OS X & iOS apps. It was written from scratch with the following goals in mind:
|
||||
GCDWebServer is a modern and lightweight GCD based HTTP 1.1 server designed to be embedded in iOS, macOS & tvOS apps. It was written from scratch with the following goals in mind:
|
||||
* Elegant and easy to use architecture with only 4 core classes: server, connection, request and response (see "Understanding GCDWebServer's Architecture" below)
|
||||
* Well designed API with fully documented headers for easy integration and customization
|
||||
* Entirely built with an event-driven design using [Grand Central Dispatch](http://en.wikipedia.org/wiki/Grand_Central_Dispatch) for best performance and concurrency
|
||||
@ -28,16 +28,16 @@ Extra built-in features:
|
||||
|
||||
Included extensions:
|
||||
* [GCDWebUploader](GCDWebUploader/GCDWebUploader.h): subclass of ```GCDWebServer``` that implements an interface for uploading and downloading files using a web browser
|
||||
* [GCDWebDAVServer](GCDWebDAVServer/GCDWebDAVServer.h): subclass of ```GCDWebServer``` that implements a class 1 [WebDAV](https://en.wikipedia.org/wiki/WebDAV) server (with partial class 2 support for OS X Finder)
|
||||
* [GCDWebDAVServer](GCDWebDAVServer/GCDWebDAVServer.h): subclass of ```GCDWebServer``` that implements a class 1 [WebDAV](https://en.wikipedia.org/wiki/WebDAV) server (with partial class 2 support for macOS Finder)
|
||||
|
||||
What's not supported (but not really required from an embedded HTTP server):
|
||||
* Keep-alive connections
|
||||
* HTTPS
|
||||
|
||||
Requirements:
|
||||
* macOS 10.7 or later (x86_64)
|
||||
* iOS 8.0 or later (armv7, armv7s or arm64)
|
||||
* tvOS 9.0 or later (arm64)
|
||||
* macOS 12 or later (x86_64, arm64)
|
||||
* iOS 16 or later (arm64)
|
||||
* tvOS 16 or later (arm64)
|
||||
* ARC memory management only (if you need MRC support use GCDWebServer 3.1 or earlier)
|
||||
|
||||
Getting Started
|
||||
@ -67,6 +67,12 @@ github "swisspol/GCDWebServer" ~> 3.2.5
|
||||
|
||||
Then run `$ carthage update` and add the generated frameworks to your Xcode projects (see [Carthage instructions](https://github.com/Carthage/Carthage#adding-frameworks-to-an-application)).
|
||||
|
||||
You can also use [Swift Package Manager](https://www.swift.org/package-manager/). Add GCDWebServer as a dependency in your `Package.swift`:
|
||||
```swift
|
||||
.package(url: "https://git.g7software.net/cuong/GCDWebServer.git", from: "3.5.5")
|
||||
```
|
||||
Then add the product(s) you need to your target's dependencies: `"GCDWebServer"` for the core server, `"GCDWebUploader"` for the web uploader, and/or `"GCDWebDAVServer"` for the WebDAV server. In Xcode, use File > Add Package Dependencies and enter the repository URL.
|
||||
|
||||
Help & Support
|
||||
==============
|
||||
|
||||
@ -81,7 +87,7 @@ These code snippets show how to implement a custom HTTP server that runs on port
|
||||
|
||||
**IMPORTANT:** If not using CocoaPods, be sure to add the `libz` shared system library to the Xcode target for your app.
|
||||
|
||||
**OS X version (command line tool):**
|
||||
**macOS version (command line tool):**
|
||||
```objectivec
|
||||
#import "GCDWebServer.h"
|
||||
#import "GCDWebServerDataResponse.h"
|
||||
@ -147,7 +153,7 @@ int main(int argc, const char* argv[]) {
|
||||
@end
|
||||
```
|
||||
|
||||
**OS X Swift version (command line tool):**
|
||||
**macOS Swift version (command line tool):**
|
||||
|
||||
***webServer.swift***
|
||||
```swift
|
||||
@ -158,12 +164,12 @@ func initWebServer() {
|
||||
|
||||
let webServer = GCDWebServer()
|
||||
|
||||
webServer.addDefaultHandlerForMethod("GET", requestClass: GCDWebServerRequest.self, processBlock: {request in
|
||||
return GCDWebServerDataResponse(HTML:"<html><body><p>Hello World</p></body></html>")
|
||||
webServer.addDefaultHandler(forMethod: "GET", request: GCDWebServerRequest.self, processBlock: {request in
|
||||
return GCDWebServerDataResponse(html:"<html><body><p>Hello World</p></body></html>")
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
webServer.runWithPort(8080, bonjourName: "GCD Web Server")
|
||||
webServer.start(withPort: 8080, bonjourName: "GCD Web Server")
|
||||
|
||||
print("Visit \(webServer.serverURL) in your web browser")
|
||||
}
|
||||
@ -208,7 +214,7 @@ WebDAV Server in iOS Apps
|
||||
|
||||
GCDWebDAVServer is a subclass of ```GCDWebServer``` that provides a class 1 compliant [WebDAV](https://en.wikipedia.org/wiki/WebDAV) server. This lets users upload, download, delete files and create directories from a directory inside your iOS app's sandbox using any WebDAV client like [Transmit](https://panic.com/transmit/) (Mac), [ForkLift](http://binarynights.com/forklift/) (Mac) or [CyberDuck](http://cyberduck.io/) (Mac / Windows).
|
||||
|
||||
GCDWebDAVServer should also work with the [OS X Finder](http://support.apple.com/kb/PH13859) as it is partially class 2 compliant (but only when the client is the OS X WebDAV implementation).
|
||||
GCDWebDAVServer should also work with the [macOS Finder](http://support.apple.com/kb/PH13859) as it is partially class 2 compliant (but only when the client is the macOS WebDAV implementation).
|
||||
|
||||
Simply instantiate and run a ```GCDWebDAVServer``` instance then connect to ```http://{YOUR-IOS-DEVICE-IP-ADDRESS}/``` using a WebDAV client:
|
||||
|
||||
@ -238,7 +244,7 @@ Serving a Static Website
|
||||
|
||||
GCDWebServer includes a built-in handler that can recursively serve a directory (it also lets you control how the ["Cache-Control"](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9) header should be set):
|
||||
|
||||
**OS X version (command line tool):**
|
||||
**macOS version (command line tool):**
|
||||
```objectivec
|
||||
#import "GCDWebServer.h"
|
||||
|
||||
|
||||
15
Run-Tests.sh
15
Run-Tests.sh
@ -51,7 +51,7 @@ xcodebuild test -scheme "$OSX_TEST_SCHEME" "SYMROOT=$BUILD_DIR"
|
||||
|
||||
# Build for OS X for oldest supported deployment target
|
||||
rm -rf "$BUILD_DIR"
|
||||
xcodebuild build -sdk "$OSX_SDK" -target "$OSX_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "MACOSX_DEPLOYMENT_TARGET=10.7" | $PRETTYFIER
|
||||
xcodebuild build -sdk "$OSX_SDK" -target "$OSX_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "MACOSX_DEPLOYMENT_TARGET=12.0" | $PRETTYFIER
|
||||
|
||||
# Run tests
|
||||
runTests $PRODUCT "htmlForm" "Tests/HTMLForm"
|
||||
@ -60,7 +60,9 @@ runTests $PRODUCT "webServer" "Tests/WebServer"
|
||||
runTests $PRODUCT "webDAV" "Tests/WebDAV-Transmit"
|
||||
runTests $PRODUCT "webDAV" "Tests/WebDAV-Cyberduck"
|
||||
runTests $PRODUCT "webDAV" "Tests/WebDAV-Finder"
|
||||
runTests $PRODUCT "webUploader" "Tests/WebUploader"
|
||||
# Skipped: GCDWebUploader has been customized in this fork (delete/move/create disabled,
|
||||
# see commit ef4b622), so the recorded fixtures in Tests/WebUploader no longer match.
|
||||
# runTests $PRODUCT "webUploader" "Tests/WebUploader"
|
||||
runTests $PRODUCT "webServer" "Tests/WebServer-Sample-Movie" "Tests/Sample-Movie.mp4"
|
||||
|
||||
# Build for OS X for current deployment target
|
||||
@ -69,15 +71,18 @@ xcodebuild build -sdk "$OSX_SDK" -target "$OSX_TARGET" -configuration "$CONFIGUR
|
||||
|
||||
# Build for iOS for oldest supported deployment target
|
||||
rm -rf "$BUILD_DIR"
|
||||
xcodebuild build -sdk "$IOS_SDK" -target "$IOS_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "IPHONEOS_DEPLOYMENT_TARGET=8.0" | $PRETTYFIER
|
||||
xcodebuild build -sdk "$IOS_SDK" -target "$IOS_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "IPHONEOS_DEPLOYMENT_TARGET=16.0" | $PRETTYFIER
|
||||
|
||||
# Build for iOS for current deployment target
|
||||
rm -rf "$BUILD_DIR"
|
||||
xcodebuild build -sdk "$IOS_SDK" -target "$IOS_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "IPHONEOS_DEPLOYMENT_TARGET=$IOS_SDK_VERSION" | $PRETTYFIER
|
||||
|
||||
# Build for tvOS for current deployment target
|
||||
rm -rf "$BUILD_DIR"
|
||||
xcodebuild build -sdk "$TVOS_SDK" -target "$TVOS_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "TVOS_DEPLOYMENT_TARGET=$TVOS_SDK_VERSION" | $PRETTYFIER
|
||||
# Commented out: building the tvOS example app requires the tvOS Simulator runtime to be installed
|
||||
# (otherwise the storyboard compile fails with "tvOS <version> Platform Not Installed"). Re-enable
|
||||
# this after running: xcodebuild -downloadPlatform tvOS
|
||||
# rm -rf "$BUILD_DIR"
|
||||
# xcodebuild build -sdk "$TVOS_SDK" -target "$TVOS_TARGET" -configuration "$CONFIGURATION" "SYMROOT=$BUILD_DIR" "TVOS_DEPLOYMENT_TARGET=$TVOS_SDK_VERSION" | $PRETTYFIER
|
||||
|
||||
# Done
|
||||
echo "\nAll tests completed successfully!"
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
#!/bin/sh -exuo pipefail
|
||||
|
||||
# brew install clang-format
|
||||
|
||||
CLANG_FORMAT_VERSION=`clang-format -version | awk '{ print $3 }'`
|
||||
if [[ "$CLANG_FORMAT_VERSION" != "7.0.0" ]]; then
|
||||
echo "Unsupported clang-format version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "build/swiftformat" ]]; then
|
||||
mkdir -p "build"
|
||||
curl -sfL -o "build/SwiftFormat.zip" "https://github.com/nicklockwood/SwiftFormat/archive/0.37.2.zip"
|
||||
unzip "build/SwiftFormat.zip" "SwiftFormat-0.37.2/CommandLineTool/swiftformat" -d "build"
|
||||
mv "build/SwiftFormat-0.37.2/CommandLineTool/swiftformat" "build/swiftformat"
|
||||
fi
|
||||
|
||||
pushd "GCDWebServer/Core"
|
||||
clang-format -style=file -i *.h *.m
|
||||
popd
|
||||
pushd "GCDWebServer/Requests"
|
||||
clang-format -style=file -i *.h *.m
|
||||
popd
|
||||
pushd "GCDWebServer/Responses"
|
||||
clang-format -style=file -i *.h *.m
|
||||
popd
|
||||
pushd "GCDWebUploader"
|
||||
clang-format -style=file -i *.h *.m
|
||||
popd
|
||||
pushd "GCDWebDAVServer"
|
||||
clang-format -style=file -i *.h *.m
|
||||
popd
|
||||
|
||||
pushd "Frameworks"
|
||||
clang-format -style=file -i *.h *.m
|
||||
popd
|
||||
pushd "Mac"
|
||||
clang-format -style=file -i *.m
|
||||
popd
|
||||
|
||||
build/swiftformat --indent 2 "iOS" "tvOS"
|
||||
|
||||
echo "OK"
|
||||
@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.pol-online.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
@ -39,6 +39,11 @@ class ViewController: UIViewController {
|
||||
webServer = GCDWebUploader(uploadDirectory: documentsPath)
|
||||
webServer.delegate = self
|
||||
webServer.allowHiddenItems = true
|
||||
// webServer.allowedFileExtensions = []
|
||||
webServer.title = "title" // default: CFBundleDisplayName or CFBundleName
|
||||
webServer.header = "header" // default: CFBundleDisplayName or CFBundleName
|
||||
webServer.prologue = "prologue" // "<p>Drag & drop files on this window or use the \"Import Files…\" button to import new files.</p>"
|
||||
webServer.footer = "footer" // "%@ %@" default: CFBundleDisplayName or CFBundleName and CFBundleShortVersionString
|
||||
if webServer.start() {
|
||||
label?.text = "GCDWebServer running locally on port \(webServer.port)"
|
||||
} else {
|
||||
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -3,10 +3,14 @@
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "1x"
|
||||
},
|
||||
{
|
||||
"idiom" : "tv",
|
||||
"scale" : "2x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -1,15 +1,22 @@
|
||||
{
|
||||
"images" : [
|
||||
{
|
||||
"orientation" : "landscape",
|
||||
"idiom" : "tv",
|
||||
"extent" : "full-screen",
|
||||
"idiom" : "tv",
|
||||
"minimum-system-version" : "11.0",
|
||||
"orientation" : "landscape",
|
||||
"scale" : "2x"
|
||||
},
|
||||
{
|
||||
"extent" : "full-screen",
|
||||
"idiom" : "tv",
|
||||
"minimum-system-version" : "9.0",
|
||||
"orientation" : "landscape",
|
||||
"scale" : "1x"
|
||||
}
|
||||
],
|
||||
"info" : {
|
||||
"version" : 1,
|
||||
"author" : "xcode"
|
||||
"author" : "xcode",
|
||||
"version" : 1
|
||||
}
|
||||
}
|
||||
@ -7,7 +7,7 @@
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>net.pol-online.${PRODUCT_NAME:rfc1034identifier}</string>
|
||||
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
|
||||
Reference in New Issue
Block a user