Comments (5)
I don't understand what non-octet-aligned data is.
Disregarding that, this is the crude algorithm I came up with
Take each number as hexadecimal from the string b'\xdb\x6d\x88\x3e\x68\xd1\xcb\x12\x25\xba\x7f'
and convert them to 8 bit binary string, and concatenate them. We get
1101101101101101100010000011111001101000110100011100101100010010001001011011101001111111
(110110)(110110)(110110)(00100)(0001)(11110011)(01000)(110100)(01110)(01011)(0001)(00100)(01001)(01101)(110100)1111111
Looking at the reverse mapping from HPACK specifation, we figure its www.example.com
This reverse mapping can be done using a prefix tree.
Any reason why this wont work?
from hyper.
That's exactly what I'd be wanting to do. =)
When I say "non-octet-aligned data", what I mean is that each prefix in the tree may not be a multiple of 8 bits. This is because, as you've spotted, the Huffman mapping in the HPACK spec uses between 3 and 27 bits per character, with no requirement that it be a multiple of 8.
Your proposed implementation above looks reasonable. It's probably easy enough to get that by building on top of your Gist, turning it into a suitable wrapping class. If you want to do that yourself, that's fine: you should make a Pull Request. =) If you don't want to, I'm happy to build on your Gist and credit you accordingly. Let me know.
from hyper.
I'll finish it in a couple of hours, and send you a pull request/gist.
Do you happen to have a file which contains the encoding for requests and response, so I could test it ?
from hyper.
The easiest examples are from the HPACK spec, in these sections: E.3 (Request examples with Huffman, which will use the Requests encoding table in Appendix C) and E.5 (Response examples with Huffman, which will use the Responses encoding table in Appendix D). The exact tests are like this:
E.3
db6d 883e 68d1 cb12 25ba 7f -> www.example.com
6365 4a13 98ff -> no-cache
4eb0 8b74 9790 fa7f -> custom-key
4eb0 8b74 979a 17a8 ff -> custom-value
E.5
409f -> 302
c31b 39bf 387f -> private
a2fb a203 20f2 ab30 3124 018b 490d 3209 e877 -> Mon, 21 Oct 2013 20:13:21 GMT
e39e 7864 dd7a fd3d 3d24 8747 db87 2849 55f6 ff -> https://www.example.com
df7d fb36 d3d9 e1fc fc3f afe7 abfc fefc bfaf 3edf 2f97 7fd3 6ff7 fd79 f6f9 77fd 3de1 6bfa 46fe 10d8 8944 7de1 ce18 e565 f76c 2f -> foo=ASDJKHQKBZXOQWEOPIUAXQWEOIU; max-age=3600; version=1
This should be a decent set of tests to begin with.
from hyper.
Fixed by #5.
from hyper.
Related Issues (20)
- Ping does not work correctly HOT 3
- Edit on github link on RTD broken.
- Transfer of maintenance HOT 3
- HTTP20Adapter sends extra headers ?? HOT 20
- How to control ssl context in a HTTP20Adapter HOT 1
- hyper.contrib.HTTP20Adapter with requests.session not working on python 2.7
- Upgrade from HTTP/1.1. to HTTP2 not working HOT 2
- Could you please make MAX_CHUNK configurable? HOT 1
- Upgrade to the latest h2 HOT 2
- How resolve DNS to a specific IP?
- HTTP11Connection does not use http/1.1 protocol HOT 1
- hyper hangs while POSTing to Apple APNS servers HOT 2
- Forcing Cleartext HTTP2 Without Upgrade Mechanism HOT 3
- How can I add query parameters when using class HTTP20Connection?
- Python deprecation warnings: collections, imp, logging.warn
- basestring erroneously ignores unicode in Python2.7
- Client certificates?
- Retain connection in HTTP/2 using hyper to avoid authentication for every request
- HTTP20Connection.request has no mechanism to send duplicate headers HOT 3
- The orders of sending packages in Debug mode and Run mode are different.
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 hyper.