mike-jumper commented on code in PR #853:
URL: https://github.com/apache/guacamole-client/pull/853#discussion_r1186367743
##########
guacamole-common-js/src/main/webapp/modules/Parser.js:
##########
@@ -63,80 +92,135 @@ Guacamole.Parser = function() {
*
* @param {!string} packet
* The instruction data to receive.
+ *
+ * @param {!boolean} [isBuffer=false]
+ * Whether the provided data should be treated as an instruction buffer
+ * that grows continuously. If true, the data provided to receive()
+ * MUST always start with the data provided to the previous call. If
+ * false (the default), only the new data should be provided to
+ * receive(), and previously-received data will automatically be
+ * buffered by the parser as needed.
*/
- this.receive = function(packet) {
+ this.receive = function receive(packet, isBuffer) {
- // Truncate buffer as necessary
- if (start_index > 4096 && element_end >= start_index) {
+ if (isBuffer)
+ buffer = packet;
- buffer = buffer.substring(start_index);
+ else {
- // Reset parse relative to truncation
- element_end -= start_index;
- start_index = 0;
+ // Truncate buffer as necessary
+ if (startIndex > 4096 && elementEnd >= startIndex) {
Review Comment:
Sure, I'll add that.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]