Bugfix for setting return codes in accept handler

The HTTP return code must be set before any actual output is written,
otherwise it has no effect.
Merge pull request #60 from guidow/error_code_bugfix

Bugfix for setting return codes in accept handler