ObjFW  Check-in [5109a3e7e4]

Overview
Comment:OFHTTPRequest: Add -[setEntityFromString:]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 5109a3e7e4ee6280dbd146f8bffa991843188d989e6d6f02223c219ce86599a3
User & Date: js on 2014-07-05 09:14:46
Other Links: manifest | tags
Context
2014-07-06
11:04
OFString+URLEncoding.m: Better RFC 1738 compliance check-in: 2ca121fd19 user: js tags: trunk
2014-07-05
09:14
OFHTTPRequest: Add -[setEntityFromString:] check-in: 5109a3e7e4 user: js tags: trunk
09:11
OFHTTPClient: Defaults for Content-{Type,Length} check-in: 75c12eaf7b user: js tags: trunk
Changes

Modified src/OFHTTPRequest.h from [1d003cc829] to [333d96b64f].

11
12
13
14
15
16
17

18
19
20
21
22
23
24
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"


#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

@class OFURL;
@class OFDictionary;







>







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#import "OFObject.h"
#import "OFString.h"

#ifndef OF_HAVE_SOCKETS
# error No sockets available!
#endif

@class OFURL;
@class OFDictionary;
183
184
185
186
187
188
189


















190
191
192
193
194
195
196
/*!
 * @brief Sets the entity body of the HTTP request.
 *
 * @param entity The entity body of the HTTP request
 */
- (void)setEntity: (OFDataArray*)entity;



















/*!
 * @brief Returns the entity body of the HTTP request.
 *
 * @return The entity body of the HTTP request
 */
- (OFDataArray*)entity;








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/*!
 * @brief Sets the entity body of the HTTP request.
 *
 * @param entity The entity body of the HTTP request
 */
- (void)setEntity: (OFDataArray*)entity;

/*!
 * @brief Sets the entity body of the HTTP request to the specified string
 *	  encoded in UTF-8.
 *
 * @param string The string to use for the entity body
 */
- (void)setEntityFromString: (OFString*)string;

/*!
 * @brief Sets the entity body of the HTTP request to the specified string
 *	  encoded in the specified encoding.
 *
 * @param string The string to use for the entity body
 * @param encoding The encoding to encode the string with
 */
- (void)setEntityFromString: (OFString*)string
		   encoding: (of_string_encoding_t)encoding;

/*!
 * @brief Returns the entity body of the HTTP request.
 *
 * @return The entity body of the HTTP request
 */
- (OFDataArray*)entity;

Modified src/OFHTTPRequest.m from [fa66100730] to [1713156fde].

258
259
260
261
262
263
264



















265
266
267
268
269
270
271
	OF_GETTER(_headers, true)
}

- (void)setEntity: (OFDataArray*)entity
{
	OF_SETTER(_entity, entity, true, 0)
}




















- (OFDataArray*)entity
{
	OF_GETTER(_entity, true)
}

- (void)setRemoteAddress: (OFString*)remoteAddress







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
	OF_GETTER(_headers, true)
}

- (void)setEntity: (OFDataArray*)entity
{
	OF_SETTER(_entity, entity, true, 0)
}

- (void)setEntityFromString: (OFString*)string
{
	[self setEntityFromString: string
			 encoding: OF_STRING_ENCODING_UTF_8];
}

- (void)setEntityFromString: (OFString*)string
		   encoding: (of_string_encoding_t)encoding
{
	void *pool = objc_autoreleasePoolPush();
	OFDataArray *entity = [OFDataArray dataArray];

	[entity addItems: [string cStringWithEncoding: encoding]
		   count: [string cStringLengthWithEncoding: encoding]];
	[self setEntity: entity];

	objc_autoreleasePoolPop(pool);
}

- (OFDataArray*)entity
{
	OF_GETTER(_entity, true)
}

- (void)setRemoteAddress: (OFString*)remoteAddress