Salvage fallback buffer from burning house
This commit is contained in:
@@ -192,6 +192,9 @@ public:
|
||||
/* Move any backpressure */
|
||||
std::string backpressure(std::move(((AsyncSocketData<SSL> *) res->getHttpResponseData())->buffer));
|
||||
|
||||
/* Keep any fallback buffer alive until we returned from open event, keeping req valid */
|
||||
std::string fallback(std::move(res->getHttpResponseData()->salvageFallbackBuffer()));
|
||||
|
||||
/* Destroy HttpResponseData */
|
||||
res->getHttpResponseData()->~HttpResponseData();
|
||||
|
||||
|
||||
@@ -221,6 +221,11 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
/* We do this to prolong the validity of parsed headers by keeping only the fallback buffer alive */
|
||||
std::string &&salvageFallbackBuffer() {
|
||||
return std::move(fallback);
|
||||
}
|
||||
|
||||
void *consumePostPadded(char *data, int length, void *user, fu2::unique_function<void *(void *, HttpRequest *)> &&requestHandler, fu2::unique_function<void *(void *, std::string_view, bool)> &&dataHandler, fu2::unique_function<void *(void *)> &&errorHandler) {
|
||||
|
||||
HttpRequest req;
|
||||
|
||||
Reference in New Issue
Block a user