Skip to content

[TlsInterception] How to parse JSON (chunked, brotli compressed) and modify it ? #955

Locked Answered by abhinavsingh
ghostlexly asked this question in Q&A
Discussion options

You must be logged in to vote

As handle_upstream_chunk suggests, incoming data is a chunk. You must assemble all the chunks before you can make sense of them together. Incoming chunks can be assembled and parsed using ChunkParser class. See https://github.com/abhinavsingh/proxy.py/blob/develop/proxy/http/parser/chunk.py#L27-L35

Once you have all chunks assembled, you should be able to parse that data as json (if it is a valid json). You can ensure it's json by checking Content-Type for responses

Replies: 1 comment 10 replies

Comment options

You must be logged in to vote
10 replies
@abhinavsingh
Comment options

@ghostlexly
Comment options

@abhinavsingh
Comment options

@ghostlexly
Comment options

@abhinavsingh
Comment options

Answer selected by abhinavsingh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
Question Questions related to proxy server
2 participants