Overview
Comment: | OFHTTP{Client,Server}: Handle all request methods. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
7be34d8c40e6c51066d05c641c41168f |
User & Date: | js on 2013-09-28 15:25:18 |
Other Links: | manifest | tags |
Context
2013-09-29
| ||
16:25 | Add missing includes. check-in: c6a65ca7a6 user: js tags: trunk | |
2013-09-28
| ||
15:25 | OFHTTP{Client,Server}: Handle all request methods. check-in: 7be34d8c40 user: js tags: trunk | |
01:50 | Improve HTTP request method handling. check-in: c76896d937 user: js tags: trunk | |
Changes
Modified src/OFHTTPClient.m from [97ab76e832] to [95811098ef].
︙ | |||
324 325 326 327 328 329 330 | 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 | - + - - - - - - | { void *pool = objc_autoreleasePoolPush(); OFURL *URL = [request URL]; OFString *scheme = [URL scheme]; of_http_request_method_t method = [request method]; OFMutableString *requestString; OFDictionary *headers = [request headers]; |
︙ | |||
407 408 409 410 411 412 413 | 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 | - - - - - - - - - - - - - - - - + + + - - - - + + + + | keyEnumerator = [headers keyEnumerator]; objectEnumerator = [headers objectEnumerator]; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) [requestString appendFormat: @"%@: %@\r\n", key, object]; |
︙ | |||
576 577 578 579 580 581 582 | 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 | - + - + + + + + + + + + + + + + + + - - + + | if (follow) { OFHTTPRequest *newRequest; newRequest = [OFHTTPRequest requestWithURL: newURL]; [newRequest setMethod: method]; [newRequest setHeaders: headers]; |
︙ |
Modified src/OFHTTPRequest.h from [3c79d758cd] to [f347146186].
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | - + - - + - | */ @interface OFHTTPRequest: OFObject <OFCopying> { OFURL *_URL; of_http_request_method_t _method; of_http_request_protocol_version_t _protocolVersion; OFDictionary *_headers; |
︙ | |||
174 175 176 177 178 179 180 | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | - + - + - + - + - + - + - - - - - - - - - - - - - - | * @brief Retrusn a dictionary with headers for the HTTP request. * * @return A dictionary with headers for the HTTP request. */ - (OFDictionary*)headers; /*! |
︙ |
Modified src/OFHTTPRequest.m from [e321453562] to [703332cbc9].
︙ | |||
116 117 118 119 120 121 122 | 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | - + - - + - | return self; } - (void)dealloc { [_URL release]; [_headers release]; |
︙ | |||
157 158 159 160 161 162 163 | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | - + - - + - | request = object; if (request->_method != _method || request->_protocolVersion.major != _protocolVersion.major || request->_protocolVersion.minor != _protocolVersion.minor || ![request->_URL isEqual: _URL] || ![request->_headers isEqual: _headers] || |
︙ | |||
261 262 263 264 265 266 267 | 257 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 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 | - + - + - + - + - - - - - - - - - - - + - + - + - - - + + | } - (OFDictionary*)headers { OF_GETTER(_headers, true) } |
Modified src/OFHTTPServer.m from [86738768aa] to [9bf4d2786d].
︙ | |||
292 293 294 295 296 297 298 | 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | - + | } _state; uint8_t _HTTPMinorVersion; of_http_request_method_t _method; OFString *_host, *_path; uint16_t _port; OFMutableDictionary *_headers; size_t _contentLength; |
︙ | |||
345 346 347 348 349 350 351 | 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 | - + | [_timer invalidate]; [_timer release]; [_host release]; [_path release]; [_headers release]; |
︙ | |||
414 415 416 417 418 419 420 | 414 415 416 417 418 419 420 421 422 423 424 425 426 427 | - - - - | method = [line substringWithRange: of_range(0, pos)]; @try { _method = of_http_request_method_from_string( [method UTF8String]); } @catch (OFInvalidFormatException *e) { return [self sendErrorAndClose: 405]; } |
︙ | |||
442 443 444 445 446 447 448 | 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | - - - - - + - - - - - - - - + + + + + + + + + - + - - - + | - (bool)parseHeaders: (OFString*)line { OFString *key, *value; size_t pos; if ([line length] == 0) { |
︙ | |||
533 534 535 536 537 538 539 | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | - - + + - + | didReadIntoBuffer: (const char*)buffer length: (size_t)length exception: (OFException*)exception { if ([socket isAtEndOfStream] || exception != nil) return false; |
︙ | |||
611 612 613 614 615 616 617 | 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 | - + | [URL setPath: _path]; request = [OFHTTPRequest requestWithURL: URL]; [request setMethod: _method]; [request setProtocolVersion: (of_http_request_protocol_version_t){ 1, _HTTPMinorVersion }]; [request setHeaders: _headers]; |
︙ |