Differences From Artifact [0e781dce42]:
- File
src/OFHTTPRequest.m
— part of check-in
[1cc6f3659f]
at
2011-04-22 14:35:13
on branch trunk
— OFHTTPRequest: Make it possible to not store the data in an OFDataArray.
This way, it's possible to do downloads without keeping the whole file
in memory. (user: js, size: 9433) [annotate] [blame] [check-ins using]
To Artifact [b21eb615c3]:
- File src/OFHTTPRequest.m — part of check-in [7f52d7f931] at 2011-04-22 14:56:53 on branch trunk — OFHTTPRequest: Normalize server header keys. (user: js, size: 9788) [annotate] [blame] [check-ins using]
︙ | |||
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 | 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 | + + + + + + + + + + + + + + + + + + + + + | */ #include "config.h" #define OF_HTTP_REQUEST_M #include <string.h> #include <ctype.h> #import "OFHTTPRequest.h" #import "OFString.h" #import "OFURL.h" #import "OFTCPSocket.h" #import "OFDictionary.h" #import "OFDataArray.h" #import "OFAutoreleasePool.h" #import "OFHTTPRequestFailedException.h" #import "OFInvalidServerReplyException.h" #import "OFOutOfRangeException.h" #import "OFTruncatedDataException.h" #import "OFUnsupportedProtocolException.h" #import "macros.h" Class of_http_request_tls_socket_class = Nil; static OF_INLINE void normalize_key(OFString *key) { char *str = (char*)[key cString]; BOOL firstLetter = YES; while (*str != '\0') { if (!isalnum(*str)) { firstLetter = YES; str++; continue; } *str = (firstLetter ? toupper(*str) : tolower(*str)); firstLetter = NO; str++; } } @implementation OFHTTPRequest + request { return [[[self alloc] init] autorelease]; } |
︙ | |||
182 183 184 185 186 187 188 | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | - + + | sock = [[[of_http_request_tls_socket_class alloc] init] autorelease]; } @try { OFString *line, *path; |
︙ | |||
267 268 269 270 271 272 273 | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | - + + - + - - - + + - - + + - + | if (status != 200 && status != 301 && status != 302 && status != 303) @throw [OFHTTPRequestFailedException newWithClass: isa HTTPRequest: self statusCode: status]; |
︙ | |||
359 360 361 362 363 364 365 | 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 | - - - - - + + + - + - + | [data addNItems: len fromCArray: buf]; } } @finally { [self freeMemory: buf]; } |
︙ |