Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add *MAX-LINE-LENGTH* and *MAX-HEADER-LINE-LENGTH* #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

r13l
Copy link

@r13l r13l commented Apr 21, 2021

Addresses #8.

This adds two special variables and an error condition.

Copy link

@gefjon gefjon left a comment

Choose a reason for hiding this comment

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

In addition to what I've noted in specific comment, *max-line-length* and *max-header-line-length* should be added to the :export list in [packages.lisp], and some text should be added to [docs/index.html].

@@ -100,8 +100,11 @@ Additionally logs this string to LOG-STREAM if it is not NIL."
(let ((result
(with-output-to-string (line)
(loop for char-seen-p = nil then t
for count from 0
Copy link

Choose a reason for hiding this comment

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

wacky indentation

for char = (read-char* stream nil)
for is-cr-p = (and char (char= char #\Return))
when (and *max-line-length* (> count *max-line-length*))
do (error 'input-exceeded-limit :maximum *max-line-length*)
Copy link

Choose a reason for hiding this comment

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

again, wacky indentation

@@ -78,6 +78,13 @@ variable has a true value, though.")
"A `buffer' for one character. Used by PEEK-CHAR* and
UNREAD-CHAR*.")

(defvar *max-line-length* nil
"Maximum length of a line. If NIL, lines may be any length.")
Copy link

Choose a reason for hiding this comment

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

I'd appreciate more documentation. The docstring should address:

  • what happens when attempting to read an overlong line.
  • appropriate types and values this variable may take

@@ -78,6 +78,13 @@ variable has a true value, though.")
"A `buffer' for one character. Used by PEEK-CHAR* and
UNREAD-CHAR*.")

(defvar *max-line-length* nil
Copy link

Choose a reason for hiding this comment

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

Please add declaim of type for this and the other special var. I assume the correct type is (or null unsigned-byte), but it may be (or null (and fixnum unsigned-byte)) or something.

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.

2 participants