-
Notifications
You must be signed in to change notification settings - Fork 103
Improve header cache handling and ETag checks #110
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
base: master
Are you sure you want to change the base?
Conversation
| // Respect ETags served with feeds. | ||
| $three04 = false; | ||
| if ( isset( $SERVER['HTTP_IF_NONE_MATCH'] ) && isset( $batcache->cache['headers']['ETag'][0] ) && $_SERVER['HTTP_IF_NONE_MATCH'] == $batcache->cache['headers']['ETag'][0] ) | ||
| if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && isset( $batcache->cache['headers']['ETag'][0] ) && $_SERVER['HTTP_IF_NONE_MATCH'] === $batcache->cache['headers']['ETag'][0] ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch
| if ( !empty( $this->cache['headers'] ) && !empty( $this->uncached_headers ) ) { | ||
| foreach ( $this->uncached_headers as $header ) | ||
| unset( $this->cache['headers'][$header] ); | ||
| foreach ( $this->uncached_headers as $h ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any particular reason we can't use the full descriptive variable name? $h may be quicker to type but it hides the purpose of the variable and makes the rest of the code less readable
| foreach ( $this->uncached_headers as $h ) { | ||
| foreach ( array_keys( $this->cache['headers'] ) as $k ) { | ||
| if ( strcasecmp( $k, $h ) === 0 ) { | ||
| unset( $this->cache['headers'][ $k ] ); | ||
| break; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any way we can reduce the nested for loops with array_map/filter/walk?
|
@craftogrammer nice changes but could we add a PR description? I've left some feedback |
No description provided.