[erlang-questions] Handling non http in mochiweb

ori brost <>
Tue Aug 16 23:40:45 CEST 2011

I am using mochiweb for a server that may also get a TCP connction to
which the client sends a simple string (without a newline, the string
is not http). Mochiweb uses HTTP sockets and therefore fails to detect
this (i dont even get http_error that i can easily get in mochiweb).
How can I solve this? Ideally I wish to change mochiweb code to do
setopt({packet, http_or_raw}) but this kind of thing does not exist.
How would you recommend handling this? my current idea was to modify
mochiweb and use erlang:decode_packet, is there a better approach?

More information about the erlang-questions mailing list