rawhat / mist

gleam HTTP server. because it glistens on a web
Apache License 2.0
268 stars 11 forks source link

Unknown header error #3

Closed lpil closed 2 years ago

lpil commented 2 years ago

Hello! I tried Mist as a replacement for Elli in my application and got this error:

{"Error in process ~p with exit value:~n~p~n",
 [<0.172.0>,
  {#{function => <<"handler">>,gleam_error => assert,line => 245,
     message => <<"Assertion pattern match failed">>,
     module => <<"mist/http">>,
     value => {error,unknown_header}},
   [{mist@http,'-handler/1-fun-0-',3,
               [{file,"build/dev/erlang/mist/build/mist@http.erl"},
                {line,333}]},
    {glisten@tcp,'-start_handler/3-fun-0-',4,
                 [{file,"build/dev/erlang/glisten/build/glisten@tcp.erl"},
                  {line,211}]},
    {gleam@otp@actor,loop,1,
                     [{file,"build/dev/erlang/gleam_otp/build/gleam@otp@actor.erl"},
                      {line,92}]}]}]}

Here's the request headers from firefox

GET / undefined
Host: localhost:3000
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:100.0) Gecko/20100101 Firefox/100.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate, br
DNT: 1
Connection: keep-alive
Cookie: csrftoken=redacted; firstVisit=redacted; sessionid=redacted; ph_GO532nkfIyRbVh8r-ts579S0ibtS4N7F8q1u7qy9FyY_posthog=%7B%22distinct_id%22%3A%22development-309%22%2C%22%24device_id%22%3A%2217f2233bb99e1f-0c5659974edb81-455a69-7e9000-17f2233bb9a8d6%22%2C%22%24user_id%22%3A%22development-309%22%2C%22%24initial_referrer%22%3A%22http%3A%2F%2Flocalhost%3A8000%2F%22%2C%22%24initial_referring_domain%22%3A%22localhost%3A8000%22%2C%22%24referrer%22%3A%22http%3A%2F%2Flocalhost%3A8000%2Fin-house-legal%2Fquery%2Fagreements%2F%22%2C%22%24referring_domain%22%3A%22localhost%3A8000%22%2C%22%24sesid%22%3A%5B1653655256592%2C%221810588be10b6a-070d87da3b86a88-402e2c34-4b9600-1810588be11e5a%22%5D%2C%22%24session_recording_enabled_server_side%22%3Afalse%2C%22%24active_feature_flags%22%3A%5B%5D%2C%22%24enabled_feature_flags%22%3A%7B%7D%7D; uid=SFMyNTY.MQ.3UIahins3fngCF2xLC2znGYe_xSbmG_bRdx0YSTwt_c; sessionid-3GDYO=redacted; CSRF-Token-3GDYO=tJoio2hbqKggK7fHZgFZyWVPnA7wySLf; CSRF-Token-CKIKR=Xc75SKFZS9qDDgLKD26rLYJtgtiH7Gja; sessionid-CKIKR=eikQox9V6M9sQwRnLHLj9HE5b2zRtopN; sessionid-NHOUY=wV9rHjEGqHzSpTfVrtMw3SkSUfV99YWq; CSRF-Token-NHOUY=ePu9N5NuRQSS6bwRfvrRTiSNdKjJV9Ro
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Pragma: no-cache
Cache-Control: no-cache

My first thought from the code was that it's due to the Cookie header being large?

rawhat commented 2 years ago

https://github.com/rawhat/mist/blob/master/test/http1_test.gleam#L51

I think this test case should cover this example! Thank you 😊