00cpxxx / proxylite

Simple, single-thread, non-caching, lightweight HTTP proxy server
GNU Lesser General Public License v2.1
16 stars 7 forks source link

Questions about packet transmission #2

Open hackpwnpwn opened 2 years ago

hackpwnpwn commented 2 years ago

I wish to do an experiment to insert some characters at the end of a packet. But I found that when inserting the last packet, it was good and bad. It doesn't do every successful insertion, and I've corrected the Content-Length again. But browser rendering is still missing a piece.

00cpxxx commented 2 years ago

Hi, that is only possible if you are using http only, not https. Since https is encrypted you won't be able to change/add data.

If you are using http there are other caveats, for example the Content-Length header will not exist if the Transfer-Encoding is chunked. And in this case you will have to append your data inside a new chunk at the end of server transmission. The other caveat here is that in chunked mode you may never know when the transmission from the server ended until the server closes the connection, so you need to use the "Connection: close" header to ensure the connection is not reused.

An easy way to test this is using the curl software since it dumps the output to the console so you can easily check if what you added is there or not.