-
-
Notifications
You must be signed in to change notification settings - Fork 382
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update http_parser #25
Comments
ok so a bit of history:
The clear change is adding PATCH and PURGE methods, simple enough, what's not simple is that 2 things are required to get http_parser upgraded:
|
Update: looking at the changes in the h file, the biggest change seems to be that HTTP codes have been added, on the c files however, there are many changes, 99% semantic, but 1% could be useful Suggestion: instead of upgrading, only update the relevant parts. |
I think second suggestion is the best. |
@rijojosephc Yes I disregarded it when I saw that 72% was TypeScript. Let me know if i'm wrong and the 72% is just interface, with a C library similar to http-parser still being there. In any case, migrating to any parser, be it Nginx or llhttp (without @ipkn's help) requires quite a large effort due to the fact that |
Going through the README, it seems that the parser is written in TypeScript then compiled into C. Something about that rubs me the wrong way. I don't mind generating code that is tedious to write (see |
Looking at Nginx's Http parser, I can see a few ways of migrating crow to it. The first is to take The second is to take A third option where the nginx extras are taken out of I personally prefer option 2, but am still open to discussion. |
Alright first update, The new parser is in a state of messiness, but I think I have the basics down. I'm assuming I'll need only 2 of the 10 functions included (parse request line and parse header) the rest are for 3 kinds of URIs (already neing done in router), Cookies (being done in middleware), arguments (being done in qs_parse), responses (not needed because crow's not a client), chunked requests (should investigate) and multi line headers (should also investigate). The plan for now is to just get the thing working (primarily by replication nginx's data structures and later converting them to crow structures) and then move on to phasing out everything nginx and using crow's data structures. |
Testing for Moving on to test UPDATE: |
Day 3 of working on this: I was able to successfully create a UPDATE: Hello world example works, unit tests hang. next step is to get them working, and start trimming unnecessary parts |
I finally managed to get through the brick wall that is the unit tests (only the first problematic unit test actually), I had to revamp the way the parser works to support messages being sent in pieces, only thing left is parsing the body in a way where |
The new parser is proving extremely difficult to set up, sure it works most of the time.. but there are multiple random issues that in all honesty make no sense to me. I might have to change my approach, cutting unnecessary parts from the existing parser while making sure everything works until the transition from old to new is as smooth as can be |
I went through the old parser and found a few pieces of code that could be taken out, most of them relating to response parsing. Taking these parts out will do 2 things:
I'm torn on this subject, @mrozigor, @luca-schlecker What do you guys think? Are we ever going to add something like running Crow as a client? Or should I go ahead and modify the parser? |
On the one side, it would be somewhat convenient to have a kind of all-in-one package, but Crow's main purpose is to provide a server and I'm not quite sure how often one need's to get another resource on the server-side. If one really needed that, he could still use cpr. |
Update: So far I managed to go through about 40%-50% of the commits since the parser was integrated into Crow. I've reached version Another Update: |
Crow currently uses version
2.3.0
, latest version is2.9.4
, might be best to upgrade since a skim of the changelog shows memory leak plugs.The text was updated successfully, but these errors were encountered: