beetlex-io / FastHttpApi

a lightweight and high-performance http/websocket service component in the dotnet core platform that supports TLS.
Apache License 2.0
650 stars 175 forks source link

CROS an Cookie Problem #186

Open mbtolou opened 1 year ago

mbtolou commented 1 year ago

Hello.

You can see two other beetlex errors in the following repository:

CORS Origin does not work. The cookie parser does not work and you must call the parser before using it.

https://github.com/mbtolou/beetlex-error

beetlex-io commented 1 year ago

Custom OptionsAttribute

    class MyOptions : BeetleX.FastHttpApi.OptionsAttribute {
        public override void SetResponse(HttpRequest request, HttpResponse response)
        {
            base.SetResponse(request, response);
        }
    }
mbtolou commented 1 year ago

In This Line :

https://github.com/beetlex-io/FastHttpApi/blob/b695cdb3702a68dfde919e374f1f735abd4cf32b/src/Header.cs#L364

convert :

if (line[0] == 'C' && line[5] == 'e' && line[1] == 'o' && line[2] == 'o' && line[3] == 'k' && line[4] == 'i')
{
    HttpParse.AnalyzeCookie(line.Slice(8, line.Length - 8), cookies);
}

To

if ((line[0] == 'C' || line[0] == 'c' ) && line[5] == 'e' && line[1] == 'o' && line[2] == 'o' && line[3] == 'k' && line[4] == 'i')
{
    HttpParse.AnalyzeCookie(line.Slice(8, line.Length - 8), cookies);
}

Fix Cookie Problem.