Correct HTTP status output

An ancient issue - if e.g. gaze outputs an error due to a missing file, it should not be sending a 200 HTTP header.
Also took the opportunity to put the two separate dispatch functions into one, given they're basically doing the same thing.