Z
Z
Zuoya2020-11-12 08:36:44
Web servers
Zuoya, 2020-11-12 08:36:44

How to properly process HTTP requests?

I am trying to make a simple http server.
At the moment parsing the http request looks like this.
- I read the first line and parse it.
- I read the following lines until "\r\n" is followed by "\r\n"
- if content length != 0 I write to the buffer.
The question is, if I want to limit the size of the body or not read the request body at all, what should I do?
One thought comes to mind - as soon as I read the headers, send the Request further, and then if the application requires to save the body or not.
In short, I want to make a simple library for building http servers.
If it matters then I use C.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jcmvbkbc, 2020-11-12
@jcmvbkbc

How to properly process HTTP requests?

You can read the core RFC , which is useful in and of itself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question