-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Import HTTP resumable upload sample code #203
Conversation
9c1489c
to
8abdebb
Compare
@FranzBusch want to take another quick look at this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some smaller comments inline but this is not going to be usable from our new async APIs since we lose type information in the pipeline. Furthermore, I think with our new async APIs we would implement all of this in Swift Concurrency in an HTTP Server and not inside the NIO channel pipeline. I am wondering if it makes sense to add this here or just defer it functionality that our general purpose HTTP server should handle. @Lukasa WDYT?
I think we should add this here: it's in support of sample code that was released with WWDC, and we should be willing to support that code. |
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Foundation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately had to import Foundation to use FileHandle
for cross-platform file IO
switch request.method { | ||
case .post, .put: | ||
if let requestPath = request.path { | ||
let path = self.directory.appending(requestPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be a bad idea since people can send ../
in the request path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm now using standardized
URL and comparing the prefix which hopefully addresses the issue
Support HTTP resumable upload.
Motivation:
Supporting HTTP resumable upload protocol defined in https://datatracker.ietf.org/doc/html/draft-ietf-httpbis-resumable-upload-05
Modifications:
2 new public classes,
HTTPResumableUploadHandler
andHTTPResumableUploadContext
, and a few other supporting objects to manage resumable uploads and translate them into regular uploads.