A request's head is a run of lines that ends at the first blank line. Today you read that whole block, so you have the request line and all its headers in hand before parsing any of them.
Read lines until a blank line and return every non-empty line that came before it.
Every HTTP request begins with a head: the request line followed by zero or
more header lines. The head is terminated by a single empty line — the \r\n\r\n
sequence you have surely seen at the end of raw requests. Reading the head means
looping readLine until you hit that empty line.
Stopping exactly at the blank line matters: whatever comes after it is the message body, which is not line-based and must not be read as lines. Break the moment you see an empty line and leave the reader parked at the start of the body for a later lesson.
var lines []stringfor {line, _ := readLine(r) // from the previous lessonif line == "" { // the blank line ends the headbreak}lines = append(lines, line)}