But how does standard say whether content not wrapped in header and also not wrapped in body belongs to header or body?
I quoted the HTML 4 spec. It says that for all of html, head and body, both the start and the end tags are optional. So the elements exist whether the tags are there or not, and all that's left is to correctly sort the subelements into head and body.
For the HTML 5 spec, look at 126.96.36.199 for when it's allowable to omit the start tags of html, head and body.
For parsing, look at 188.8.131.52 and 184.108.40.206 and following. Note that the note in 220.127.116.11 is incorrect.