<aside> 💡
Below are a few more explanations on the function requirements
</aside>
A vector<char> is handy for receiving data in your web proxy. It has a .data() which gives you access to the underlying array. You can just pass &v.data()[index] as the pointer for receive() to start writing into, and write straight in the vector (of course tell it how much space there is). If you need more space... you can just grow the vector. Then call receive again at the end index that hasn't been filled up yet. (And remember that receive tells you how many bytes it read, so you'll know how much has been filled up.
Here is a tip I think is worth passing along on reading the RFCs. Parsing and interpreting HTTP requests and responses appropriately is one of the major tasks in this project, which means you need to read RFC a lot to understand different formats of request and response messages and all those delimiters that tell you when a section should end. For example, the payload of an HTTP response may be returned via different formats.
You may see fields like these in your HTTP header:
Transfer-Encoding: chunked
In contrast to the common header field you see:
Content-Length: <length>
You may want to handle these two formats differently, and you may find it confusing in the RFCs on understanding the format of message:
chunked-body = *chunk
last-chunk
trailer-part
CRLF
chunk = chunk-size [ chunk-ext ] CRLF
chunk-data CRLF
chunk-size = 1*HEXDIG
last-chunk = 1*("0") [ chunk-ext ] CRLF
chunk-data = 1*OCTET ; a sequence of chunk-size octets
To understand the meaning of symbols, go take a look at RFC5234