Skip to content

Commit

Permalink
Fixed non-ASCII characters in Server Timing headers
Browse files Browse the repository at this point in the history
Fixes #48
  • Loading branch information
Rarst committed Nov 16, 2020
1 parent ccf3ff3 commit 8875774
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## Unreleased

## 3.3.4 - 2020-11-16

### Fixed
- non-ASCII characters in Server Timing headers

## 3.3.3 - 2020-03-11

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion laps.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Plugin URI: https://github.com/Rarst/laps
Description: Light WordPress profiler.
Author: Andrey “Rarst” Savchenko
Version: 3.3.3
Version: 3.3.4
Author URI: https://www.rarst.net/
Text Domain: laps
Domain Path: /lang
Expand Down
3 changes: 2 additions & 1 deletion src/Manager/Server_Timing_Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ public function send_timing_header( $input ) {
}
}

header( 'Server-Timing: ' . preg_replace( '/\R/', '', $header ) );
// Sanitize to visible US ASCII character range (32-126).
header( 'Server-Timing: ' . preg_replace( '/[^\x20-\x7E]/', '', $header ) );

return $input;
}
Expand Down

1 comment on commit 8875774

@joseantonnio
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix and sorry for the lack of feedback in the issue topic :D

Please sign in to comment.