Code:
on *:SOCKREAD:sockname:{
  if $sockerr { return }
  ; Determine if you should be reading to &bvar (the file itself) or %var (the header)
  if whatever {
    var %read
    sockread %read
    if [color:green]Content-Length: [color:blue]*[/color] iswm %read[/color] { do stuff with the [color:blue]*[/color] }
    ..
  }
  else {
    sockread &var
    ..
  }
}