-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
x.vweb: add configuration options and handle incomplete requests #20868
base: master
Are you sure you want to change the base?
Conversation
// done frees the current incomplete request header buffer and reset the HTTP request. | ||
// use this function when the connection is kept open, but the request is handled | ||
@[manualfree] | ||
pub fn (mut ir IncomingRequest) done() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this public? The structure itself is not, and it is used only for the incoming_requests
field of RequestParams, which itself is not public.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then I think I forgot to use it, I'll check
|
It shouldn't be a problem to cache the header until it's completely read. |
No, but the problem is that I can't access the data to cache it. And can't read the data first, because the net library only takes a buffered reader has argument when parsing only the request headers. So I'll probably need to add another function as well |
Now that |
This pr adds a
Config
struct tox.vweb
to change the default behaviour of vweb.When vweb encounters an incomplete request it will now wait until a timeout occurs for new data instead of immediately closing the connection. The
Config
struct contains an option to limit the number of incomplete requests per connetion that are allowed before the connection is closed.The
Config
struct also adds the option to limit the maximum HTTP header size and the maximum body length for a request.