Search code examples
c++httpproxyhttp-proxyhtml-injections

http proxy javascript injection


I have a simple proxy source in C++. I'm trying to modify it to inject some html content into specific pages. I'v managed to get it working but whenever I inject something, part of the original html gets corrupted. I know for a fact that it's not my string handling functions because I have it printing out the result before sending and it's fine. The html is transmitted 1460 bytes at a time and there is a 3 character string followed newline at the top of each chunk and then at the very end there is a newline and a 0;

Example:

fef
some html

co7
some html 

81f
final html
0

Iv been searching and trying to figure out what those three characters represent. Remaining content length hexed? maybe some sort of hash? but I can't find anything. But I'm guessing they're the source of the problem. Any help/insight is appreciated.


Solution

  • Chunked Encoding? See RFC 2616, Section 3.6.1.