Revert "NSURLSession Reimplementation (#411)"

This reverts commit 07233534e6.
This commit is contained in:
rfm 2024-07-02 19:19:14 +01:00 committed by GitHub
parent 07233534e6
commit 3fedf31c2d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
50 changed files with 7197 additions and 5391 deletions

View file

@ -0,0 +1,52 @@
#ifndef INCLUDED_GSURLSESSIONTASKBODYSOURCE_H
#define INCLUDED_GSURLSESSIONTASKBODYSOURCE_H
#import "common.h"
#import "GSDispatch.h"
@class NSFileHandle;
@class NSInputStream;
typedef NS_ENUM(NSUInteger, GSBodySourceDataChunk) {
GSBodySourceDataChunkData,
// The source is depleted.
GSBodySourceDataChunkDone,
// Retry later to get more data.
GSBodySourceDataChunkRetryLater,
GSBodySourceDataChunkError
};
/*
* A (non-blocking) source for body data.
*/
@protocol GSURLSessionTaskBodySource <NSObject>
/*
* Get the next chunck of data.
*/
- (void) getNextChunkWithLength: (NSInteger)length
completionHandler: (void (^)(GSBodySourceDataChunk chunk, NSData *data))completionHandler;
@end
@interface GSBodyStreamSource : NSObject <GSURLSessionTaskBodySource>
- (instancetype) initWithInputStream: (NSInputStream*)inputStream;
@end
@interface GSBodyDataSource : NSObject <GSURLSessionTaskBodySource>
- (instancetype)initWithData:(NSData *)data;
@end
@interface GSBodyFileSource : NSObject <GSURLSessionTaskBodySource>
- (instancetype) initWithFileURL: (NSURL*)fileURL
workQueue: (dispatch_queue_t)workQueue
dataAvailableHandler: (void (^)(void))dataAvailableHandler;
@end
#endif