Differences From Artifact [8dda35db24]:
- File src/OFHTTPClient.m — part of check-in [b6cb3addd0] at 2020-06-28 15:03:23 on branch trunk — Use OF_DIRECT(_MEMBERS) where appropriate (user: js, size: 30174) [annotate] [blame] [check-ins using] [more...]
To Artifact [d541eab337]:
- File
src/OFHTTPClient.m
— part of check-in
[b6ee372b98]
at
2020-08-11 19:45:36
on branch trunk
— OFString: Rework number parsing API
This solves the old signed vs. unsigned problem and allows for more
bases than just 8, 10 and 16, as well as auto-detection of the base (if
base is 0). (user: js, size: 30357) [annotate] [blame] [check-ins using]
︙ | |||
75 76 77 78 79 80 81 | 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 | - + - + | OF_DIRECT_MEMBERS @interface OFHTTPClientRequestBodyStream: OFStream <OFReadyForWritingObserving> { OFHTTPClientRequestHandler *_handler; OFTCPSocket *_socket; bool _chunked; |
︙ | |||
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 | 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 480 481 | + + - + + + + + + | } @catch (id e) { [self raiseException: e]; } } - (bool)handleFirstLine: (OFString *)line { long long status; /* * It's possible that the write succeeds on a connection that is * keep-alive, but the connection has already been closed by the remote * end due to a timeout. In this case, we need to reconnect. */ if (line == nil) { [self closeAndReconnect]; return false; } if (![line hasPrefix: @"HTTP/"] || line.length < 9 || [line characterAtIndex: 8] != ' ') @throw [OFInvalidServerReplyException exception]; _version = [[line substringWithRange: of_range(5, 3)] copy]; if (![_version isEqual: @"1.0"] && ![_version isEqual: @"1.1"]) @throw [OFUnsupportedVersionException exceptionWithVersion: _version]; |
︙ | |||
728 729 730 731 732 733 734 | 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 | - - - - - - + | - (instancetype)initWithHandler: (OFHTTPClientRequestHandler *)handler socket: (OFTCPSocket *)sock { self = [super init]; @try { OFDictionary OF_GENERIC(OFString *, OFString *) *headers; |
︙ | |||
891 892 893 894 895 896 897 | 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 | + - + - - - + + + + | if (contentLength != nil) { if (_chunked || contentLength.length == 0) @throw [OFInvalidServerReplyException exception]; _hasContentLength = true; @try { unsigned long long toRead = |
︙ | |||
922 923 924 925 926 927 928 | 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 | - + | if (_socket.atEndOfStream) @throw [OFTruncatedDataException exception]; /* Content-Length */ if (!_chunked) { size_t ret; |
︙ | |||
977 978 979 980 981 982 983 | 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 | - + | } if (_setAtEndOfStream && _toRead == 0) _atEndOfStream = true; return 0; } else if (_toRead > 0) { |
︙ | |||
1022 1023 1024 1025 1026 1027 1028 | 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | + + - + + + + | @throw [OFTruncatedDataException exception]; else @throw [OFInvalidServerReplyException exception]; } @try { unsigned long long toRead = [line unsignedLongLongValueWithBase: 16]; |
︙ |