Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello. I noticed a long time ago that the HTTP Client buffers the loaded documents into RAM because curl returns the response body as a string when the
curl_exec()
method is called.This behavior sometimes leads to memory overflow and script crash.
Personally, it affected me when using the WebDAV protocol (downloading large files). At that time, i found a workaround for myself. Today i want to share it with the community, as i see users encountering out of memory errors.
I wrote the test to load a document that exceeds the application's
memory_limit
.In the current version of the code this test naturally fails with an error:
After the merger of this PR test case will be passed.
Also i have run tests in the
saber/dav
package. After a clean installation, they did not work for me. With this PR, the test resuts is no different. It seems to me that backward compatibility forsaber/dav
has been preserved, but we should move towards getting rid of the use of deprecated methods.From my position, the best solution would be to remove the obsolete code altogether and release a major version, but here you know better.
Breaks legacy capability
: No headers are written to the response body. It is difficult to support both modes (with and without headers), although you can. But I would rather not spend energy on this support.