-
-
Notifications
You must be signed in to change notification settings - Fork 618
Add request fingerprint as cached filename #441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
1) Fix some tests due to change in default cache directory 2) Fix event propogation using multiprocessing manager I/O error on closed resource is still an issue. Doesn't result in test error but a warning is thrown (tested on Python 3.8).
Codecov Report
@@ Coverage Diff @@
## cache-server #441 +/- ##
================================================
+ Coverage 81.51% 82.04% +0.53%
================================================
Files 80 82 +2
Lines 3083 3046 -37
================================================
- Hits 2513 2499 -14
+ Misses 570 547 -23
Continue to review full report at Codecov.
|
This comment has been minimized.
This comment has been minimized.
Hello, I think these warnings come from the fact that we output the message in the cache proxy.py/proxy/plugin/cache/store/disk.py Lines 72 to 74 in 4d4a2b1
When running isolated tests (using python -m unitest ), it is not a problem, but it seems pytest does not like this.I did not bother to fix this because it gives useful information when using python -m unitest .
|
Thank you for the context. Yes, I wasn't sure why these warnings are being thrown. IIRC, these warning come from http proxy plugin testing with TLS interception on. Don't see these warnings otherwise. Will dig further into it this week. |
Need a cleaner way to dynamically enable / disable a plugin. Current approach used by cache response plugin doesn't work universally. Problems being:
Because being a global variable, |
@pasccom Some notable changes:
|
1) Temporarily disable cache response plugin with tls interception. These are broken due to fingerprint mismatch. For a https request, fingerprint must capture both CONNECT and then the sub-request state.
Hello @abhinavsingh, I introduced |
Agree about various server response codes. We'll definitely disable caching for certain http codes. For replay testing, caching can be enabled for all response codes.
Yes, log file can work very well here. We'll have to add fingerprint as one of the logging format parameters. Currently we are only caching responses. But we can also cache requests (most like add this feature behind a flag). Example, |
@pasccom Created #443 to track it separately. I don't think we can cleanly proceed forward for Overall, it's unclear how to approach this for now. Ideally caching should work w/o upstream connection. Kind of defeats the purpose of cache if we have to re-connect with upstream even for serving out of cache. At the same time, we have some edge cases to handle if upstream connection is not made (see issue description). Merging this one for now. |
Introduce a mechanism within
HttpParser
class that maintains a running hash of request being processed. Fingerprinting feature is currently being used by cache plugin and might be an overkill to introduce withinHttpParser
class. As request hashes will be calculated even without cache plugin enabled.Fingerprinting removes the need of maintaining an index structure. Here is how it will work:
fingerprint
of the request to store cached data.Note that, serving out of cache only works for:
http
requestshttps
requests withTLS Interception
For the 2nd case i.e. with
TLS Interception
,https
request fingerprint is a calculated based upon both theCONNECT
request and the actual cached request.Additionally:
ReplayTestCase
which decouples replay functionality from normal test case. This also removes the need of dynamically enabling cache plugin.TODO: