Overview
Comment: | OFHTTPClient: Only throw away if we actually can |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
a456f4d39d3caaa5f10c7157b4102fd7 |
User & Date: | js on 2018-03-11 20:04:19 |
Other Links: | manifest | tags |
Context
2018-03-11
| ||
20:38 | ofhttp: Print headers as we receive them check-in: 892fbf97ac user: js tags: trunk | |
20:04 | OFHTTPClient: Only throw away if we actually can check-in: a456f4d39d user: js tags: trunk | |
15:41 | Make sure .travis.yml does not end up in a release check-in: 1ff10544a5 user: js tags: trunk | |
Changes
Modified src/OFHTTPClient.m from [325ef4384d] to [b38762c50f].
︙ | ︙ | |||
677 678 679 680 681 682 683 | - (void)start { OFURL *URL = [_request URL]; OFTCPSocket *sock; /* Can we reuse the last socket? */ | | | > | 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | - (void)start { OFURL *URL = [_request URL]; OFTCPSocket *sock; /* Can we reuse the last socket? */ if (_client->_socket != nil && ![_client->_socket isAtEndOfStream] && [[_client->_lastURL scheme] isEqual: [URL scheme]] && [[_client->_lastURL host] isEqual: [URL host]] && [_client->_lastURL port] == [URL port]) { /* * Set _socket to nil, so that in case of an error it won't be * reused. If everything is successful, we set _socket again * at the end. */ sock = [_client->_socket autorelease]; _client->_socket = nil; [_client->_lastURL release]; _client->_lastURL = nil; if (!_client->_lastWasHEAD && ![_client->_lastResponse isAtEndOfStream]) { /* Throw away content that has not been read yet */ char *buffer = [self allocMemoryWithSize: 512]; [_client->_lastResponse asyncReadIntoBuffer: buffer length: 512 target: self |
︙ | ︙ | |||
931 932 933 934 935 936 937 | return [_socket readIntoBuffer: buffer length: length]; /* Content-Length */ if (!_chunked) { size_t ret; | < < < < < < < < < < < > > > > > > > > > | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 | return [_socket readIntoBuffer: buffer length: length]; /* Content-Length */ if (!_chunked) { size_t ret; if (length > _toRead) length = (size_t)_toRead; ret = [_socket readIntoBuffer: buffer length: length]; if (ret > length) @throw [OFOutOfRangeException exception]; _toRead -= ret; if (_toRead == 0) { _atEndOfStream = true; if (!_keepAlive) { [_socket release]; _socket = nil; } } return ret; } /* Chunked */ if (_toRead > 0) { if (length > _toRead) |
︙ | ︙ |