| @@ -7,11 +7,11 @@ | ||
| 7 | 7 | // We need direct socket/file operations for this functionality |
| 8 | 8 | // WordPress filesystem alternatives wouldn't work for this use case |
| 9 | 9 | // It's better to disable these specific rules at file level than adding individual ignore comments |
| 10 | 10 | if (!defined('ABSPATH')) exit; |
| 11 | -if (!class_exists('WPRRespStream')) : | |
| 11 | +if (!class_exists('BVRespStream')) : | |
| 12 | 12 | |
| 13 | - class WPRStream extends WPRCallbackBase { | |
| 13 | + class BVStream extends BVCallbackBase { | |
| 14 | 14 | public $bvb64stream; |
| 15 | 15 | public $bvb64cksize; |
| 16 | 16 | public $checksum; |
| 17 | 17 | |
| @@ -26,11 +26,11 @@ | ||
| 26 | 26 | |
| 27 | 27 | public static function startStream($account, $request) { |
| 28 | 28 | $result = array(); |
| 29 | 29 | $params = $request->params; |
| 30 | - $stream = new WPRRespStream($request); | |
| 30 | + $stream = new BVRespStream($request); | |
| 31 | 31 | if ($request->isAPICall()) { |
| 32 | - $stream = new WPRHttpStream($request); | |
| 32 | + $stream = new BVHttpStream($request); | |
| 33 | 33 | if (!$stream->connect()) { |
| 34 | 34 | $apicallstatus = array( |
| 35 | 35 | "httperror" => "Cannot Open Connection to Host", |
| 36 | 36 | "streamerrno" => $stream->errno, |
| @@ -74,25 +74,22 @@ | ||
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | -class WPRRespStream extends WPRStream { | |
| 78 | +class BVRespStream extends BVStream { | |
| 79 | 79 | public $bvboundry; |
| 80 | 80 | |
| 81 | 81 | function __construct($request) { |
| 82 | 82 | parent::__construct($request); |
| 83 | - // Restrict boundary to safe chars so raw echo cannot inject into response (XSS). | |
| 84 | - $raw = isset($request->bvboundry) ? (string) $request->bvboundry : ''; | |
| 85 | - $sanitized = preg_replace('/[^a-zA-Z0-9_-]/', '', $raw); | |
| 86 | - $this->bvboundry = $sanitized !== '' ? $sanitized : 'bvstream'; | |
| 83 | + $this->bvboundry = $request->bvboundry; | |
| 87 | 84 | } |
| 88 | 85 | |
| 89 | 86 | public function writeChunk($chunk) { |
| 90 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- bvboundry sanitized in constructor; raw stream protocol (not HTML), chunk must not be escaped or stream is corrupted | |
| 87 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- chunk should not be escaped | |
| 91 | 88 | echo $this->bvboundry . "ckckckckck" . $chunk . $this->bvboundry . "ckckckckck"; |
| 92 | 89 | } |
| 93 | 90 | public function endStream() { |
| 94 | - // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- bvboundry sanitized in constructor; raw stream protocol (not HTML) | |
| 91 | + // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 95 | 92 | echo $this->bvboundry . "rerererere"; |
| 96 | 93 | |
| 97 | 94 | return array(); |
| 98 | 95 | } |
| @@ -97,10 +94,10 @@ | ||
| 97 | 94 | return array(); |
| 98 | 95 | } |
| 99 | 96 | } |
| 100 | 97 | |
| 101 | -class WPRHttpStream extends WPRStream { | |
| 102 | - var $user_agent = 'WPRHttpStream'; | |
| 98 | +class BVHttpStream extends BVStream { | |
| 99 | + var $user_agent = 'BVHttpStream'; | |
| 103 | 100 | var $host; |
| 104 | 101 | var $port; |
| 105 | 102 | var $timeout = 20; |
| 106 | 103 | var $conn; |