I’m trying to parse a HTTP response. The response can have chunked encoding, so I’m trying to read the response and check the chunk sizes to split it off the actual response body. Apparently I can read the proper chunk size and then try to index the Vec appropriately. but when I use the index on the slice it sometimes doesnt read/“index” everything and even worse the missing data differs, even though the underlying response always is the same (like the chunksize). The response body is already completed as the chunk is properly terminated. Hence it shouldnt be related to Http directly. How can I explain and fix this?
I tried so much different things, but I really didnt find a way…
I asked on the IRC and they mentioned something about some special characters taking more byte space, but I can’t really comprehend why this matters and afaik the chunk size should account for this.
This is my source
The relevant functions are I think: join_chunks and get_chunk_size
when you run it, you should see that it prints the complete response and then left Chunk (which is the part which is not read for some reason and differs).
the get_body_start_index function could also be wrong, but I’m always getting the right chunk size, hence I assumed that if there’s an error there, it could not amount to such a great difference of the grabbed chunk.