Skip to content

Accept a page directive buffer size of 0kb - #1271

Open
arturobernalg wants to merge 1 commit into
apache:mainfrom
arturobernalg:jsp-buffer-zero-kb
Open

arturobernalg wants to merge 1 commit into
apache:mainfrom
arturobernalg:jsp-buffer-zero-kb

Conversation

@arturobernalg

Copy link
Copy Markdown
Member

<%@ page buffer="0kb" %> is rejected with a translation error ("Page directive: invalid value for buffer"), so the page fails with a 500.

The Jakarta Pages specification (page directive, buffer="none|sizekb") says: "The size can only be specified in kilobytes. The suffix kb is mandatory or a translation error must occur. If a buffer size is specified then output is buffered with a buffer size not less than that specified." The buffer element of jsp-property-group takes "those of the buffer page directive". A size of 0kb is therefore valid, and it means no buffering.

This accepts 0kb again. Negative sizes and sizes that would overflow when converted to bytes are still rejected. testBufferZero now expects the page to work; it fails without the change.

Tested on a Tomcat built from this branch: 0kb gives 200 with a buffer size of 0, as none does; 16kb gives 16384; -1kb still fails translation. buffer="0kb" autoFlush="false" is still a translation error, as with none. The Jasper tests pass.

A buffer value of "0kb" was rejected as invalid, so a page using it
failed with a translation error. The JSP specification only requires
the size to be expressed in kilobytes, with a mandatory "kb" suffix,
and output to be buffered with a buffer size not less than that
specified. A size of 0kb is therefore valid, and it results in the page
not being buffered, as it did before.

Negative sizes and sizes that would overflow when converted to bytes
are still rejected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant