webmetrics / browsermob-proxy

NOTICE: this project has been forked and is being maintained at https://github.com/lightbody/browsermob-proxy
https://github.com/lightbody/browsermob-proxy
Apache License 2.0
233 stars 780 forks source link

Don't null out the SSL relay nuke directory, otherwise we'll never cleanup the SSL support files. #109

Closed nirvdrum closed 11 years ago

nirvdrum commented 11 years ago

Fixes #108: SSL support directories not being cleaned up.

@lightbody if you could take a look at this, it'd be much appreciated. It looks like you explicitly nulled out this directory in a commit about a year ago. I couldn't garner from context why though.

lightbody commented 11 years ago

This was done to make sure that we could re-establish a connection to that that SSL host very quickly for long-running proxies. So we need to leave the files around until at least when the JVM (or BMP service) is terminated. So your change is not right either, since it'll lose the fast caching.

Can you work on a change that won't delete the files when the SocketListener is closed, but will when the proxy itself is terminate or the JVM dies? I had hoped that because we use File.createTempFile this would happen automatically but it doesn't :(

nirvdrum commented 11 years ago

I thought that might be why it was done, but when I close the proxy and re-open it, a new set of SSL support files is created anyway. Any idea why that might be the case?

nirvdrum commented 11 years ago

My analysis may be wrong here, but when a proxy is created, a new BrowserMobProxyHandler is created. This new instance always has a blank SSL map and SSL support directory is created as a temp directory, meaning it has random characters in the directory name. As a result of the blank map, a new set of support files is created. As a result of them being temp directories with random chars, they're always written to different locations. So, I don't see how these files can be used across proxies. Perhaps that's a separate bug?

lightbody commented 11 years ago

You're right: they aren't used across proxies, but they should be!