websocket_basic_stream.cc 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. // Copyright 2013 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "net/websockets/websocket_basic_stream.h"
  5. #include <stddef.h>
  6. #include <stdint.h>
  7. #include <algorithm>
  8. #include <limits>
  9. #include <utility>
  10. #include "base/bind.h"
  11. #include "base/logging.h"
  12. #include "base/numerics/safe_conversions.h"
  13. #include "build/build_config.h"
  14. #include "net/base/io_buffer.h"
  15. #include "net/base/net_errors.h"
  16. #include "net/socket/client_socket_handle.h"
  17. #include "net/websockets/websocket_basic_stream_adapters.h"
  18. #include "net/websockets/websocket_errors.h"
  19. #include "net/websockets/websocket_frame.h"
  20. namespace net {
  21. namespace {
  22. // Please refer to the comment in class header if the usage changes.
  23. constexpr net::NetworkTrafficAnnotationTag kTrafficAnnotation =
  24. net::DefineNetworkTrafficAnnotation("websocket_basic_stream", R"(
  25. semantics {
  26. sender: "WebSocket Basic Stream"
  27. description:
  28. "Implementation of WebSocket API from web content (a page the user "
  29. "visits)."
  30. trigger: "Website calls the WebSocket API."
  31. data:
  32. "Any data provided by web content, masked and framed in accordance "
  33. "with RFC6455."
  34. destination: OTHER
  35. destination_other:
  36. "The address that the website has chosen to communicate to."
  37. }
  38. policy {
  39. cookies_allowed: YES
  40. cookies_store: "user"
  41. setting: "These requests cannot be disabled."
  42. policy_exception_justification:
  43. "Not implemented. WebSocket is a core web platform API."
  44. }
  45. comments:
  46. "The browser will never add cookies to a WebSocket message. But the "
  47. "handshake that was performed when the WebSocket connection was "
  48. "established may have contained cookies."
  49. )");
  50. // This uses type uint64_t to match the definition of
  51. // WebSocketFrameHeader::payload_length in websocket_frame.h.
  52. constexpr uint64_t kMaxControlFramePayload = 125;
  53. // The number of bytes to attempt to read at a time. It's used only for high
  54. // throughput connections.
  55. // TODO(ricea): See if there is a better number or algorithm to fulfill our
  56. // requirements:
  57. // 1. We would like to use minimal memory on low-bandwidth or idle connections
  58. // 2. We would like to read as close to line speed as possible on
  59. // high-bandwidth connections
  60. // 3. We can't afford to cause jank on the IO thread by copying large buffers
  61. // around
  62. // 4. We would like to hit any sweet-spots that might exist in terms of network
  63. // packet sizes / encryption block sizes / IPC alignment issues, etc.
  64. #if BUILDFLAG(IS_ANDROID)
  65. constexpr size_t kLargeReadBufferSize = 32 * 1024;
  66. #else
  67. // |2^n - delta| is better than 2^n on Linux. See crrev.com/c/1792208.
  68. constexpr size_t kLargeReadBufferSize = 131000;
  69. #endif
  70. // The number of bytes to attempt to read at a time. It's set as an initial read
  71. // buffer size and used for low throughput connections.
  72. constexpr size_t kSmallReadBufferSize = 1000;
  73. // The threshold to decide whether to switch the read buffer size.
  74. constexpr double kThresholdInBytesPerSecond = 1200 * 1000;
  75. // Returns the total serialized size of |frames|. This function assumes that
  76. // |frames| will be serialized with mask field. This function forces the
  77. // masked bit of the frames on.
  78. int CalculateSerializedSizeAndTurnOnMaskBit(
  79. std::vector<std::unique_ptr<WebSocketFrame>>* frames) {
  80. const uint64_t kMaximumTotalSize = std::numeric_limits<int>::max();
  81. uint64_t total_size = 0;
  82. for (const auto& frame : *frames) {
  83. // Force the masked bit on.
  84. frame->header.masked = true;
  85. // We enforce flow control so the renderer should never be able to force us
  86. // to cache anywhere near 2GB of frames.
  87. uint64_t frame_size = frame->header.payload_length +
  88. GetWebSocketFrameHeaderSize(frame->header);
  89. CHECK_LE(frame_size, kMaximumTotalSize - total_size)
  90. << "Aborting to prevent overflow";
  91. total_size += frame_size;
  92. }
  93. return static_cast<int>(total_size);
  94. }
  95. base::Value NetLogBufferSizeParam(int buffer_size) {
  96. base::Value::Dict dict;
  97. dict.Set("read_buffer_size_in_bytes", buffer_size);
  98. return base::Value(std::move(dict));
  99. }
  100. base::Value NetLogFrameHeaderParam(const WebSocketFrameHeader* header) {
  101. base::Value::Dict dict;
  102. dict.Set("final", header->final);
  103. dict.Set("reserved1", header->reserved1);
  104. dict.Set("reserved2", header->reserved2);
  105. dict.Set("reserved3", header->reserved3);
  106. dict.Set("opcode", header->opcode);
  107. dict.Set("masked", header->masked);
  108. dict.Set("payload_length", static_cast<double>(header->payload_length));
  109. return base::Value(std::move(dict));
  110. }
  111. } // namespace
  112. WebSocketBasicStream::BufferSizeManager::BufferSizeManager() = default;
  113. WebSocketBasicStream::BufferSizeManager::~BufferSizeManager() = default;
  114. void WebSocketBasicStream::BufferSizeManager::OnRead(base::TimeTicks now) {
  115. read_start_timestamps_.push(now);
  116. }
  117. void WebSocketBasicStream::BufferSizeManager::OnReadComplete(
  118. base::TimeTicks now,
  119. int size) {
  120. DCHECK_GT(size, 0);
  121. // This cannot overflow because the result is at most
  122. // kLargeReadBufferSize*rolling_average_window_.
  123. rolling_byte_total_ += size;
  124. recent_read_sizes_.push(size);
  125. DCHECK_LE(read_start_timestamps_.size(), rolling_average_window_);
  126. if (read_start_timestamps_.size() == rolling_average_window_) {
  127. DCHECK_EQ(read_start_timestamps_.size(), recent_read_sizes_.size());
  128. base::TimeDelta duration = now - read_start_timestamps_.front();
  129. base::TimeDelta threshold_duration =
  130. base::Seconds(rolling_byte_total_ / kThresholdInBytesPerSecond);
  131. read_start_timestamps_.pop();
  132. rolling_byte_total_ -= recent_read_sizes_.front();
  133. recent_read_sizes_.pop();
  134. if (threshold_duration < duration) {
  135. buffer_size_ = BufferSize::kSmall;
  136. } else {
  137. buffer_size_ = BufferSize::kLarge;
  138. }
  139. }
  140. }
  141. WebSocketBasicStream::WebSocketBasicStream(
  142. std::unique_ptr<Adapter> connection,
  143. const scoped_refptr<GrowableIOBuffer>& http_read_buffer,
  144. const std::string& sub_protocol,
  145. const std::string& extensions,
  146. const NetLogWithSource& net_log)
  147. : read_buffer_(
  148. base::MakeRefCounted<IOBufferWithSize>(kSmallReadBufferSize)),
  149. target_read_buffer_size_(read_buffer_->size()),
  150. connection_(std::move(connection)),
  151. http_read_buffer_(http_read_buffer),
  152. sub_protocol_(sub_protocol),
  153. extensions_(extensions),
  154. net_log_(net_log),
  155. generate_websocket_masking_key_(&GenerateWebSocketMaskingKey) {
  156. // http_read_buffer_ should not be set if it contains no data.
  157. if (http_read_buffer_.get() && http_read_buffer_->offset() == 0)
  158. http_read_buffer_ = nullptr;
  159. DCHECK(connection_->is_initialized());
  160. }
  161. WebSocketBasicStream::~WebSocketBasicStream() { Close(); }
  162. int WebSocketBasicStream::ReadFrames(
  163. std::vector<std::unique_ptr<WebSocketFrame>>* frames,
  164. CompletionOnceCallback callback) {
  165. read_callback_ = std::move(callback);
  166. complete_control_frame_body_.clear();
  167. if (http_read_buffer_ && is_http_read_buffer_decoded_) {
  168. http_read_buffer_.reset();
  169. }
  170. return ReadEverything(frames);
  171. }
  172. int WebSocketBasicStream::WriteFrames(
  173. std::vector<std::unique_ptr<WebSocketFrame>>* frames,
  174. CompletionOnceCallback callback) {
  175. // This function always concatenates all frames into a single buffer.
  176. // TODO(ricea): Investigate whether it would be better in some cases to
  177. // perform multiple writes with smaller buffers.
  178. write_callback_ = std::move(callback);
  179. // First calculate the size of the buffer we need to allocate.
  180. int total_size = CalculateSerializedSizeAndTurnOnMaskBit(frames);
  181. auto combined_buffer = base::MakeRefCounted<IOBufferWithSize>(total_size);
  182. char* dest = combined_buffer->data();
  183. int remaining_size = total_size;
  184. for (const auto& frame : *frames) {
  185. net_log_.AddEvent(net::NetLogEventType::WEBSOCKET_SENT_FRAME_HEADER,
  186. [&] { return NetLogFrameHeaderParam(&frame->header); });
  187. WebSocketMaskingKey mask = generate_websocket_masking_key_();
  188. int result =
  189. WriteWebSocketFrameHeader(frame->header, &mask, dest, remaining_size);
  190. DCHECK_NE(ERR_INVALID_ARGUMENT, result)
  191. << "WriteWebSocketFrameHeader() says that " << remaining_size
  192. << " is not enough to write the header in. This should not happen.";
  193. CHECK_GE(result, 0) << "Potentially security-critical check failed";
  194. dest += result;
  195. remaining_size -= result;
  196. CHECK_LE(frame->header.payload_length,
  197. static_cast<uint64_t>(remaining_size));
  198. const int frame_size = static_cast<int>(frame->header.payload_length);
  199. if (frame_size > 0) {
  200. const char* const frame_data = frame->payload;
  201. std::copy(frame_data, frame_data + frame_size, dest);
  202. MaskWebSocketFramePayload(mask, 0, dest, frame_size);
  203. dest += frame_size;
  204. remaining_size -= frame_size;
  205. }
  206. }
  207. DCHECK_EQ(0, remaining_size) << "Buffer size calculation was wrong; "
  208. << remaining_size << " bytes left over.";
  209. auto drainable_buffer = base::MakeRefCounted<DrainableIOBuffer>(
  210. std::move(combined_buffer), total_size);
  211. return WriteEverything(drainable_buffer);
  212. }
  213. void WebSocketBasicStream::Close() {
  214. connection_->Disconnect();
  215. }
  216. std::string WebSocketBasicStream::GetSubProtocol() const {
  217. return sub_protocol_;
  218. }
  219. std::string WebSocketBasicStream::GetExtensions() const { return extensions_; }
  220. const NetLogWithSource& WebSocketBasicStream::GetNetLogWithSource() const {
  221. return net_log_;
  222. }
  223. /*static*/
  224. std::unique_ptr<WebSocketBasicStream>
  225. WebSocketBasicStream::CreateWebSocketBasicStreamForTesting(
  226. std::unique_ptr<ClientSocketHandle> connection,
  227. const scoped_refptr<GrowableIOBuffer>& http_read_buffer,
  228. const std::string& sub_protocol,
  229. const std::string& extensions,
  230. const NetLogWithSource& net_log,
  231. WebSocketMaskingKeyGeneratorFunction key_generator_function) {
  232. auto stream = std::make_unique<WebSocketBasicStream>(
  233. std::make_unique<WebSocketClientSocketHandleAdapter>(
  234. std::move(connection)),
  235. http_read_buffer, sub_protocol, extensions, net_log);
  236. stream->generate_websocket_masking_key_ = key_generator_function;
  237. return stream;
  238. }
  239. int WebSocketBasicStream::ReadEverything(
  240. std::vector<std::unique_ptr<WebSocketFrame>>* frames) {
  241. DCHECK(frames->empty());
  242. // If there is data left over after parsing the HTTP headers, attempt to parse
  243. // it as WebSocket frames.
  244. if (http_read_buffer_.get() && !is_http_read_buffer_decoded_) {
  245. DCHECK_GE(http_read_buffer_->offset(), 0);
  246. is_http_read_buffer_decoded_ = true;
  247. std::vector<std::unique_ptr<WebSocketFrameChunk>> frame_chunks;
  248. if (!parser_.Decode(http_read_buffer_->StartOfBuffer(),
  249. http_read_buffer_->offset(), &frame_chunks))
  250. return WebSocketErrorToNetError(parser_.websocket_error());
  251. if (!frame_chunks.empty()) {
  252. int result = ConvertChunksToFrames(&frame_chunks, frames);
  253. if (result != ERR_IO_PENDING)
  254. return result;
  255. }
  256. }
  257. // Run until socket stops giving us data or we get some frames.
  258. while (true) {
  259. if (buffer_size_manager_.buffer_size() != buffer_size_) {
  260. read_buffer_ = base::MakeRefCounted<IOBufferWithSize>(
  261. buffer_size_manager_.buffer_size() == BufferSize::kSmall
  262. ? kSmallReadBufferSize
  263. : kLargeReadBufferSize);
  264. buffer_size_ = buffer_size_manager_.buffer_size();
  265. net_log_.AddEvent(
  266. net::NetLogEventType::WEBSOCKET_READ_BUFFER_SIZE_CHANGED,
  267. [&] { return NetLogBufferSizeParam(read_buffer_->size()); });
  268. }
  269. buffer_size_manager_.OnRead(base::TimeTicks::Now());
  270. // base::Unretained(this) here is safe because net::Socket guarantees not to
  271. // call any callbacks after Disconnect(), which we call from the destructor.
  272. // The caller of ReadEverything() is required to keep |frames| valid.
  273. int result = connection_->Read(
  274. read_buffer_.get(), read_buffer_->size(),
  275. base::BindOnce(&WebSocketBasicStream::OnReadComplete,
  276. base::Unretained(this), base::Unretained(frames)));
  277. if (result == ERR_IO_PENDING)
  278. return result;
  279. result = HandleReadResult(result, frames);
  280. if (result != ERR_IO_PENDING)
  281. return result;
  282. DCHECK(frames->empty());
  283. }
  284. }
  285. void WebSocketBasicStream::OnReadComplete(
  286. std::vector<std::unique_ptr<WebSocketFrame>>* frames,
  287. int result) {
  288. result = HandleReadResult(result, frames);
  289. if (result == ERR_IO_PENDING)
  290. result = ReadEverything(frames);
  291. if (result != ERR_IO_PENDING)
  292. std::move(read_callback_).Run(result);
  293. }
  294. int WebSocketBasicStream::WriteEverything(
  295. const scoped_refptr<DrainableIOBuffer>& buffer) {
  296. while (buffer->BytesRemaining() > 0) {
  297. // The use of base::Unretained() here is safe because on destruction we
  298. // disconnect the socket, preventing any further callbacks.
  299. int result = connection_->Write(
  300. buffer.get(), buffer->BytesRemaining(),
  301. base::BindOnce(&WebSocketBasicStream::OnWriteComplete,
  302. base::Unretained(this), buffer),
  303. kTrafficAnnotation);
  304. if (result > 0) {
  305. buffer->DidConsume(result);
  306. } else {
  307. return result;
  308. }
  309. }
  310. return OK;
  311. }
  312. void WebSocketBasicStream::OnWriteComplete(
  313. const scoped_refptr<DrainableIOBuffer>& buffer,
  314. int result) {
  315. if (result < 0) {
  316. DCHECK_NE(ERR_IO_PENDING, result);
  317. std::move(write_callback_).Run(result);
  318. return;
  319. }
  320. DCHECK_NE(0, result);
  321. buffer->DidConsume(result);
  322. result = WriteEverything(buffer);
  323. if (result != ERR_IO_PENDING)
  324. std::move(write_callback_).Run(result);
  325. }
  326. int WebSocketBasicStream::HandleReadResult(
  327. int result,
  328. std::vector<std::unique_ptr<WebSocketFrame>>* frames) {
  329. DCHECK_NE(ERR_IO_PENDING, result);
  330. DCHECK(frames->empty());
  331. if (result < 0)
  332. return result;
  333. if (result == 0)
  334. return ERR_CONNECTION_CLOSED;
  335. buffer_size_manager_.OnReadComplete(base::TimeTicks::Now(), result);
  336. std::vector<std::unique_ptr<WebSocketFrameChunk>> frame_chunks;
  337. if (!parser_.Decode(read_buffer_->data(), result, &frame_chunks))
  338. return WebSocketErrorToNetError(parser_.websocket_error());
  339. if (frame_chunks.empty())
  340. return ERR_IO_PENDING;
  341. return ConvertChunksToFrames(&frame_chunks, frames);
  342. }
  343. int WebSocketBasicStream::ConvertChunksToFrames(
  344. std::vector<std::unique_ptr<WebSocketFrameChunk>>* frame_chunks,
  345. std::vector<std::unique_ptr<WebSocketFrame>>* frames) {
  346. for (size_t i = 0; i < frame_chunks->size(); ++i) {
  347. auto& chunk = (*frame_chunks)[i];
  348. DCHECK(chunk == frame_chunks->back() || chunk->final_chunk)
  349. << "Only last chunk can have |final_chunk| set to be false.";
  350. if (const auto& header = chunk->header) {
  351. net_log_.AddEvent(net::NetLogEventType::WEBSOCKET_RECV_FRAME_HEADER,
  352. [&] { return NetLogFrameHeaderParam(header.get()); });
  353. }
  354. std::unique_ptr<WebSocketFrame> frame;
  355. int result = ConvertChunkToFrame(std::move(chunk), &frame);
  356. if (result != OK)
  357. return result;
  358. if (frame)
  359. frames->push_back(std::move(frame));
  360. }
  361. frame_chunks->clear();
  362. if (frames->empty())
  363. return ERR_IO_PENDING;
  364. return OK;
  365. }
  366. int WebSocketBasicStream::ConvertChunkToFrame(
  367. std::unique_ptr<WebSocketFrameChunk> chunk,
  368. std::unique_ptr<WebSocketFrame>* frame) {
  369. DCHECK(frame->get() == nullptr);
  370. bool is_first_chunk = false;
  371. if (chunk->header) {
  372. DCHECK(current_frame_header_ == nullptr)
  373. << "Received the header for a new frame without notification that "
  374. << "the previous frame was complete (bug in WebSocketFrameParser?)";
  375. is_first_chunk = true;
  376. current_frame_header_.swap(chunk->header);
  377. }
  378. DCHECK(current_frame_header_) << "Unexpected header-less chunk received "
  379. << "(final_chunk = " << chunk->final_chunk
  380. << ", payload size = " << chunk->payload.size()
  381. << ") (bug in WebSocketFrameParser?)";
  382. const bool is_final_chunk = chunk->final_chunk;
  383. const WebSocketFrameHeader::OpCode opcode = current_frame_header_->opcode;
  384. if (WebSocketFrameHeader::IsKnownControlOpCode(opcode)) {
  385. bool protocol_error = false;
  386. if (!current_frame_header_->final) {
  387. DVLOG(1) << "WebSocket protocol error. Control frame, opcode=" << opcode
  388. << " received with FIN bit unset.";
  389. protocol_error = true;
  390. }
  391. if (current_frame_header_->payload_length > kMaxControlFramePayload) {
  392. DVLOG(1) << "WebSocket protocol error. Control frame, opcode=" << opcode
  393. << ", payload_length=" << current_frame_header_->payload_length
  394. << " exceeds maximum payload length for a control message.";
  395. protocol_error = true;
  396. }
  397. if (protocol_error) {
  398. current_frame_header_.reset();
  399. return ERR_WS_PROTOCOL_ERROR;
  400. }
  401. if (!is_final_chunk) {
  402. DVLOG(2) << "Encountered a split control frame, opcode " << opcode;
  403. AddToIncompleteControlFrameBody(chunk->payload);
  404. return OK;
  405. }
  406. if (!incomplete_control_frame_body_.empty()) {
  407. DVLOG(2) << "Rejoining a split control frame, opcode " << opcode;
  408. AddToIncompleteControlFrameBody(chunk->payload);
  409. DCHECK(is_final_chunk);
  410. DCHECK(complete_control_frame_body_.empty());
  411. complete_control_frame_body_ = std::move(incomplete_control_frame_body_);
  412. *frame = CreateFrame(is_final_chunk, complete_control_frame_body_);
  413. return OK;
  414. }
  415. }
  416. // Apply basic sanity checks to the |payload_length| field from the frame
  417. // header. A check for exact equality can only be used when the whole frame
  418. // arrives in one chunk.
  419. DCHECK_GE(current_frame_header_->payload_length,
  420. base::checked_cast<uint64_t>(chunk->payload.size()));
  421. DCHECK(!is_first_chunk || !is_final_chunk ||
  422. current_frame_header_->payload_length ==
  423. base::checked_cast<uint64_t>(chunk->payload.size()));
  424. // Convert the chunk to a complete frame.
  425. *frame = CreateFrame(is_final_chunk, chunk->payload);
  426. return OK;
  427. }
  428. std::unique_ptr<WebSocketFrame> WebSocketBasicStream::CreateFrame(
  429. bool is_final_chunk,
  430. base::span<const char> data) {
  431. std::unique_ptr<WebSocketFrame> result_frame;
  432. const bool is_final_chunk_in_message =
  433. is_final_chunk && current_frame_header_->final;
  434. const WebSocketFrameHeader::OpCode opcode = current_frame_header_->opcode;
  435. // Empty frames convey no useful information unless they are the first frame
  436. // (containing the type and flags) or have the "final" bit set.
  437. if (is_final_chunk_in_message || data.size() > 0 ||
  438. current_frame_header_->opcode !=
  439. WebSocketFrameHeader::kOpCodeContinuation) {
  440. result_frame = std::make_unique<WebSocketFrame>(opcode);
  441. result_frame->header.CopyFrom(*current_frame_header_);
  442. result_frame->header.final = is_final_chunk_in_message;
  443. result_frame->header.payload_length = data.size();
  444. result_frame->payload = data.data();
  445. // Ensure that opcodes Text and Binary are only used for the first frame in
  446. // the message. Also clear the reserved bits.
  447. // TODO(ricea): If a future extension requires the reserved bits to be
  448. // retained on continuation frames, make this behaviour conditional on a
  449. // flag set at construction time.
  450. if (!is_final_chunk && WebSocketFrameHeader::IsKnownDataOpCode(opcode)) {
  451. current_frame_header_->opcode = WebSocketFrameHeader::kOpCodeContinuation;
  452. current_frame_header_->reserved1 = false;
  453. current_frame_header_->reserved2 = false;
  454. current_frame_header_->reserved3 = false;
  455. }
  456. }
  457. // Make sure that a frame header is not applied to any chunks that do not
  458. // belong to it.
  459. if (is_final_chunk)
  460. current_frame_header_.reset();
  461. return result_frame;
  462. }
  463. void WebSocketBasicStream::AddToIncompleteControlFrameBody(
  464. base::span<const char> data) {
  465. if (data.empty()) {
  466. return;
  467. }
  468. incomplete_control_frame_body_.insert(incomplete_control_frame_body_.end(),
  469. data.begin(), data.end());
  470. // This method checks for oversize control frames above, so as long as
  471. // the frame parser is working correctly, this won't overflow. If a bug
  472. // does cause it to overflow, it will CHECK() in
  473. // AddToIncompleteControlFrameBody() without writing outside the buffer.
  474. CHECK_LE(incomplete_control_frame_body_.size(), kMaxControlFramePayload)
  475. << "Control frame body larger than frame header indicates; frame parser "
  476. "bug?";
  477. }
  478. } // namespace net