Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delayed content processing #272

Open
btiplitz opened this issue Jun 3, 2022 · 3 comments
Open

Delayed content processing #272

btiplitz opened this issue Jun 3, 2022 · 3 comments
Assignees
Labels
feature-request Feature requests or enhancements

Comments

@btiplitz
Copy link

btiplitz commented Jun 3, 2022

Is your feature request related to a problem? Please describe.
When the content request comes in and the processing will be delayed, duplicating the memory creates memory pressure. I would like to be able to swap the content string into my own string so I don't have to make a copy, but I plan to return the response to the sender before completion (which in my case is a re-direct)

Describe why the feature or enhancement you are proposing fits the library.
The content is not necessary to be used by the library once I have received it

Describe the solution you'd like
Either I'd like to be able to get a non-constant pointer to the content, or a way to pass my std::string for the swap within the lirbary

Describe alternatives you've considered
I make a copy now. I've considered just modifying the code I have myself and still might. I could easily submit a PR for this but have not contributed to this project before

Additional context
Add any other context or screenshots about the feature request here.

@btiplitz btiplitz added the feature-request Feature requests or enhancements label Jun 3, 2022
@etr
Copy link
Owner

etr commented Jun 5, 2022

Hey @btiplitz, thanks for the request. Can you attach a piece of code showing what you are trying to do? I am not sure why you are having to make a copy of the value unless you are modifying it before returning it. I am also not sure of what you mean by "I plan to return the response to the sender before completion" so I think an example might help to understand your use-case.

The main reason the content string is currently immutable is to keep the immutability of the overall http_request object which has its advantages both in internal management of the library and to avoid unintended behaviors. Said that, I am not necessarily locked onto anything.

@btiplitz
Copy link
Author

btiplitz commented Jun 6, 2022

I'll get you a snipped later this week. The reason I have to make a copy of the data as it could take minutes to process the data. The only response that is sent back is the data has been accepted for processing, thus I need to make a copy of the data

The logic is

  1. Receive data. Send back redirect
  2. Receive delete. Send back ok once the data has been staged for processing, which includes journal operations.
  3. Process data, but the sender is no longer involved, so there are no more http requests on this transaction

I understand the need to keep the objects internal and was only suggest this behavior for the content portion of the request

I've also had issues with receiving large requests that exceed ram. I know some other implementations must be allowing a disk cache for the actual content as it arrives. Just a guess

@btiplitz
Copy link
Author

btiplitz commented Aug 29, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Feature requests or enhancements
Projects
None yet
Development

No branches or pull requests

2 participants