[Mongrel] mongrel parser for server response

snacktime snacktime at gmail.com
Tue Oct 31 16:41:26 EST 2006

I'm taking a stab at creating a parser to parse the server response
using the mongrel parser as a base.  Never having used a parser like
Ragel before in my life, I'd like some input on the following for
parsing an http server response.  This is part of my modified version
of http11_parser.rl.  In particular what would be better than using
'any' to match the status text?

  http_number = (digit+ "." digit+) ;
  HTTP_Version = ("HTTP/" http_number) >mark %http_version ;
  Http_status_code = (digit){3} >mark %http_status_code ;
  Http_status_text = any* >mark %http_status_text ;
  Request_Line = (HTTP_Version " " Http_status_code " " Http_status_text CRLF) ;

  field_name = (token -- ":")+ >start_field %write_field;

  field_value = any* >start_value %write_value;

  message_header = field_name ":" " "* field_value :> CRLF;

  Request = Request_Line (message_header)* ( CRLF @done);


More information about the Mongrel-users mailing list