gigix/stomperl

Frame header parsing error

GoogleCodeExporter opened this issue · 1 comments

What steps will reproduce the problem?
1. send header with any key and a value of a url http://

What is the expected output?
A pair of strings

What do you see instead?
An error.

What version of the product are you using? On what operating system?
Latest and ubuntu

Please provide any additional information below.
This is my fix for it but im sure there is quicker way todo it :)

stomp_frame.erl

parse_headers([]) -> [];
parse_headers([HeaderText | Others]) ->
    case re:run(HeaderText, "^(?<key>[a-z0-9])(\s)?\:(\s)?(?<val>.+)", [{capture, [key, val], list}]) of
        nomatch ->
            Tokens = string:tokens(HeaderText, ":"),
            Pair = to_pair(Tokens),
            [Pair | parse_headers(Others)];
        {match,[K,V]} ->
            Pair = to_pair([K,V]),
            [Pair | parse_headers(Others)]
    end.


Original issue reported on code.google.com by davem.2...@gmail.com on 24 Feb 2014 at 2:49

BTW i have been using this library for quite a while and have found it to be 
very fast and efficient i could not imagine myself using anything else :)

Original comment by davem.2...@gmail.com on 24 Feb 2014 at 2:53

  • Added labels: ****
  • Removed labels: ****