I should have never used anyproxy and the other random libraries it imports. They are...real bad. I would've been better off writing them all myself.
Fixed a bug with a certificate generation lib that was creating certificates with colliding serial numbers when multiprocessing was in place.
Fixed another bug where if a lot of requests were coming through the max number of allowed event emitters were being hit. Raising the ceiling and this fixed the random request failures.
Sadly, I am sunk cost with the libs and don't have the energy to just rewrite them right now.
I can't into the HTTP proxy protocol. I was responding at the wrong layer (e.g. inside of a CONNECT tunnel instead of to the CONNECT HTTP request itself) with the 407. This was causing proxying tools to rightly get confused af. This now responds to the actual CONNECT requests with 407 if they don't come correct. Implementation here is still pretty hacky...and the library code itself is worse.
…l and also hopefully fixes the proxy auth errors
TL;DR: