Skip to content

Conversation

@matt-allan
Copy link

This branch creates an interface for the RequestParser and injects it.

Reasoning being, I am working on some alternative parsers using C extensions. It would be nice to implement something like the event loop's factory and inject the fastest parser possible.

I do not know of a way to enforce that the parser emits headers with a Request object and body buffer.

I made injection of the parser optional to prevent a BC break.

src/Server.php Outdated
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm all for (somehow) injecting the parser instance to use here 👍

However, unfortunately the parser is stateful, meaning a single instance can't really be reused for multiple connections.

@matt-allan
Copy link
Author

Hm, I didn't realize that. Maybe we could inject a factory instance?

The default factory can be extended in the future once react/http has multiple parsers to return the fastest one. I made an interface so that the user can still inject a custom factory and return a different parser.

@WyriHaximus
Copy link
Member

Hey @yuloh are there any updates on this? I'm closing this because we want to keep this internal, however if you're still working on this we rather select the fastest parser internally.

@WyriHaximus WyriHaximus closed this Jan 4, 2018
@WyriHaximus WyriHaximus removed this from the v0.8.1 milestone Jan 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants