Comments (7)
About public API, here is my 2 cents :
- It should not mention huffman in public methods (most people don't [want to] care about it)
- There should be no init method (if required it should be private / lazy, i don't want to care about it, and if many libraries use it i don't know if it's already initialized or not)
- IMO it should have only 2 methods (static or simple functions) :
[public static] function encodeHeaders(array $headers): string;
[public static] function decodeHeaders(string $binary): array;
But not sure on how works hpack precisely and if it's possible to have this api
from hpack.
@joelwurtz You don't have to call init()
, it's automatically called at the end of the file and lazy, because it's only executed when the file is required.
Two methods aren't possible, because the dictionary can grow (but I think currently does not).
from hpack.
I'm not entirely clear on why there are public `huffmanEncode` and `huffmanDecode` methods. Those likely should just be private. The public API only really needs to consist of `encode`, `decode`, and `tableResize`. `encode` should be an instance method, since it should be using a dynamic table for encoding (not implemented yet, but making it an instance method will allow that at any time).
from hpack.
Shouldn't it be resizeTable()
?
I guess the rest should be private and the initialization maybe done via (function () { static::init(); })->bindTo(null, HPack::class)();
from hpack.
The huffmanEncode/huffmanDecode functions are specific if you want to roll your own HPack (e.g. with a dynamic table). You do not need them for header encoding and decoding. That's what HPack::encode()
and HPack::decode()
are for.
They are more like helper functions, which I decided to make public - if one needs them. Ultimately they are specified by the RFC, have well-defined ins and outs.
from hpack.
I think the public API is fine now, but the encoding needs tests as it seems, decoding has tests.
from hpack.
The README can be added later. ;-P
from hpack.
Related Issues (8)
- Http2 protocol not handled correctly, and not recognize libnghttp2.so by ffi. HOT 12
- Object of class FFI\CData could not be converted to bool
- Add CI pipeline
- Memory leak when using HPackNghttp2 HOT 2
- Memory leaks HOT 6
- nghttp2 implementation using FFI HOT 4
- Uninitialized string offset access on invalid HPack data
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 hpack.