Comments (7)
@anatol found another uri parser which is like phr, it is based on the NGINX and Node parser. https://github.com/Zewo/uri_parser
from picohttpparser.
Let me know what do you think about this idea.
If you think url parser should be different project independent of H2O then I might start looking at implementing it. Most likely with Ragel state machine compiler and picohttpparser-like API.
from picohttpparser.
Interesting.
However I wonder if it would be a easy task to reach consensus upon how a query parsing API should be designed. Won't people want to use different structures for storing the key-value pairs of a query?
The concern makes me think that the best way for you to go forward is to create a separate repository for implementing a query parser that most fits your need, and then show it to others.
How does it sound?
from picohttpparser.
Won't people want to use different structures for storing the key-value pairs of a query?
This is going to be the the same key-value structure as used for headers in http parser. The name could be either keyvalue of queryparams (I like the keyvalue).
from picohttpparser.
This is going to be the the same key-value structure as used for headers in http parser. The name could be either keyvalue of queryparams (I like the keyvalue).
Well, that is the point I cannot agree / is the reason why I suggested you should better create a separate library for parsing queries.
I am not sure if it is practical to expect that the upper bound of the number of key-values pairs in a query is relatively small (as is the case for the HTTP headers). IMO it is hard to expect the upper bound in case of queries, and therefore the query parser should either dynamically allocate memory or call a callback to allocate memory. It might also be necessary to use a non-O(n)
structure for searching a key within the pairs (i.e. use hashtable for storing key-value pairs).
from picohttpparser.
I am not sure if it is practical to expect that the upper bound of the number of key-values pairs in a query is relatively small
Well, in practice URI length is limited. Most browsers think that URI should not be longer than 2048 symbols and it is good enough hard upper bound for query params. i.e. we can expect that there will no be more than 1000 params in the URI.
But my idea that I had in mind is parser returns an error if number of params is larger than provided structure (like in your http parser). In this case user can reparse the URI with bigger array.
Okay, here is real quick implementation for this idea https://github.com/anatol/uriparser
from picohttpparser.
Thank you for elaborating.
I still believe that it should be implemented as a separate library (or in other words there is no necessity that URL parsing should be implemented within picohttpparser).
from picohttpparser.
Related Issues (20)
- Possible typo
- Correctly detect obsolete header line folding
- version number
- Questions about how to use picohttpparser? HOT 2
- Official release and git tag?
- Not able to properly parse using ruby FFI HOT 1
- Is it possible to avoid reallocation during chunked data processing?
- Is it possible to construct responses HOT 1
- What last_len actually means? HOT 2
- now is support https ? HOT 2
- about http response "chunked" and "gzip".
- Can we use ranges2[16]="\000\040\177"? HOT 1
- Support for request body parsing HOT 1
- Dead / duplicated code in `is_complete()`
- Examples HOT 2
- Overly aggressive slowloris check? HOT 1
- `phr_parse_request()` partial parsing doesn't seem to work HOT 2
- Assert issue with parsing double quotes HOT 1
- Warnings in compilation for C89 (ANSI C) HOT 3
- phr_parse_headers is not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from picohttpparser.