forked from vapor/vapor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add multipart + url-encoded content; cleanup old files (vapor#1947)
* add multipart + url-encoded content; cleanup old files * update some tests * remove Vapor.Context, use Vapor.Request * Request / Response refactor * cleanup XCTTest cases * shutdown cleanup / non-throwing * update some tests; fix test manifest * add validation * finish Validation updates * fix some warnings * build -v * console updates * don't use invalidateAndCancel on linux
- Loading branch information
1 parent
b6c21bc
commit af2b50e
Showing
170 changed files
with
11,156 additions
and
3,027 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,12 @@ | ||
import Vapor | ||
|
||
public func boot(_ app: Application) throws { | ||
let test = try app.makeContainer().wait() | ||
let routes = try test.make(Routes.self) | ||
for route in routes.routes { | ||
let path = route.path.map { $0.description }.joined(separator: "/") | ||
print("[\(route.method)] /\(path) \(route.requestType) -> \(route.responseType)") | ||
for (key, val) in route.userInfo { | ||
print(" - \(key) = \(val)") | ||
} | ||
} | ||
try test.shutdown().wait() | ||
let c = try app.makeContainer().wait() | ||
defer { c.shutdown() } | ||
|
||
// bootstrap logging system | ||
let console = try c.make(Console.self) | ||
LoggingSystem.bootstrap(console: console, level: .info) | ||
|
||
// use container | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,4 @@ | ||
import Boilerplate | ||
import Dispatch | ||
|
||
do { | ||
let app = try Boilerplate.app(.detect()) | ||
|
||
// DispatchQueue.global().async { | ||
// sleep(2) | ||
// app.running!.stop() | ||
// } | ||
|
||
try app.execute().wait() | ||
} | ||
try app(.detect()).run() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
// MIT License | ||
|
||
// Copyright (c) 2019 François Colas | ||
|
||
// Permission is hereby granted, free of charge, to any person obtaining a copy | ||
// of this software and associated documentation files (the "Software"), to deal | ||
// in the Software without restriction, including without limitation the rights | ||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
// copies of the Software, and to permit persons to whom the Software is | ||
// furnished to do so, subject to the following conditions: | ||
|
||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
|
||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
// SOFTWARE. | ||
#ifndef MULTIPARTPARSER_H | ||
#define MULTIPARTPARSER_H | ||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
#include <stddef.h> | ||
#include <stdint.h> | ||
#include <sys/types.h> | ||
|
||
typedef struct multipartparser multipartparser; | ||
typedef struct multipartparser_callbacks multipartparser_callbacks; | ||
|
||
typedef int (*multipart_cb) (multipartparser*); | ||
typedef int (*multipart_data_cb) (multipartparser*, const char* data, size_t size); | ||
|
||
struct multipartparser { | ||
/** PRIVATE **/ | ||
char boundary[70]; | ||
int boundary_length; | ||
int index; | ||
uint16_t state; | ||
|
||
/** PUBLIC **/ | ||
void* data; | ||
}; | ||
|
||
struct multipartparser_callbacks { | ||
multipart_cb on_body_begin; | ||
multipart_cb on_part_begin; | ||
multipart_data_cb on_header_field; | ||
multipart_data_cb on_header_value; | ||
multipart_cb on_headers_complete; | ||
multipart_data_cb on_data; | ||
multipart_cb on_part_end; | ||
multipart_cb on_body_end; | ||
}; | ||
|
||
void multipartparser_init(multipartparser* parser, const char* boundary); | ||
|
||
void multipartparser_callbacks_init(multipartparser_callbacks* callbacks); | ||
|
||
size_t multipartparser_execute(multipartparser* parser, | ||
multipartparser_callbacks* callbacks, | ||
const char* data, | ||
size_t size); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
#endif // MULTIPARTPARSER_H |
Oops, something went wrong.