File: NSURLSessionTaskPrivate.h

package info (click to toggle)
gnustep-base 1.31.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 26,580 kB
  • sloc: objc: 239,446; ansic: 36,519; cpp: 122; sh: 112; makefile: 100; xml: 32
file content (122 lines) | stat: -rw-r--r-- 3,822 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/**
 * NSURLSessionTaskPrivate.h
 *
 * Copyright (C) 2017-2024 Free Software Foundation, Inc.
 *
 * Written by: Hugo Melder <hugo@algoriddim.com>
 * Date: May 2024
 * Author: Hugo Melder <hugo@algoriddim.com>
 *
 * This file is part of GNUStep-base
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * If you are interested in a warranty or support for this source code,
 * contact Scott Christley <scottc@net-community.com> for more information.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free
 * Software Foundation, Inc., 31 Milk Street #960789 Boston, MA 02196 USA.
 */

#import "Foundation/NSDictionary.h"
#import "Foundation/NSFileHandle.h"
#import "Foundation/NSURLSession.h"
#import <curl/curl.h>

@interface
  NSURLSessionTask(Private)

- (instancetype)initWithSession: (NSURLSession *)session
 request: (NSURLRequest *)request
 taskIdentifier: (NSUInteger)identifier;

-(CURL *)_easyHandle;

/* Enable or disable libcurl verbose output. Disabled by default. */
-(void)_setVerbose: (BOOL)flag;

/* This method is called by -[NSURLSession _checkForCompletion]
 *
 * We release the session (previously retained in -[NSURLSessionTask resume])
 * here and inform the delegate about the transfer state.
 */
-(void)_transferFinishedWithCode: (CURLcode)code;

/* Explicitly enable data upload with an optional estimated size. Set to 0 if
 * not available.
 *
 * This may be used when a body stream is passed at a later stage
 * (see URLSession:task:needNewBodyStream:).
 */
-(void)_enableUploadWithSize: (NSInteger)size;
-(void)_setBodyStream: (NSInputStream *)stream;

-(void)_enableUploadWithData: (NSData *)data;
-(void)_enableAutomaticRedirects: (BOOL)flag;

/* Assign with copying */
-(void)_setOriginalRequest: (NSURLRequest *)request;
-(void)_setCurrentRequest: (NSURLRequest *)request;

-(void)_setResponse: (NSURLResponse *)response;
-(void)_setCookiesFromHeaders: (NSDictionary *)headers;

-(void)_setCountOfBytesSent: (int64_t)count;
-(void)_setCountOfBytesReceived: (int64_t)count;
-(void)_setCountOfBytesExpectedToSend: (int64_t)count;
-(void)_setCountOfBytesExpectedToReceive: (int64_t)count;

-(NSMutableDictionary *)_taskData;

-(NSURLSession *)_session;

/* Task specific properties.
 *
 * See GSURLSessionProperties in NSURLSessionPrivate.h.
 */
-(NSInteger)_properties;
-(void)_setProperties: (NSInteger)properties;

/* This value is periodically checked in progress_callback.
 * We then abort the transfer in the progress_callback if this flag is set.
 */
-(BOOL)_shouldStopTransfer;
-(void)_setShouldStopTransfer: (BOOL)flag;

-(NSInteger)_numberOfRedirects;
-(void)_setNumberOfRedirects: (NSInteger)redirects;

-(NSInteger)_headerCallbackCount;
-(void)_setHeaderCallbackCount: (NSInteger)count;

-(NSFileHandle *)_createTemporaryFileHandleWithError: (NSError **)error;

@end

@interface
  NSURLSessionDataTask(Private)

- (GSNSURLSessionDataCompletionHandler)_completionHandler;
-(void)_setCompletionHandler: (GSNSURLSessionDataCompletionHandler)handler;

@end

@interface
  NSURLSessionDownloadTask(Private)

- (GSNSURLSessionDownloadCompletionHandler)_completionHandler;

-(int64_t)_countOfBytesWritten;
-(void)_updateCountOfBytesWritten: (int64_t)count;
-(void)_setCompletionHandler: (GSNSURLSessionDownloadCompletionHandler)handler;

@end