Changeset 13273 in project


Ignore:
Timestamp:
02/12/09 19:26:59 (11 years ago)
Author:
Jim Ursetto
Message:

gopher: add max-line-length

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/gopher/trunk/gopher.scm

    r13268 r13273  
    33(module gopher
    44  (accept send-line send-lastline send-text-file send-binary-file
    5    make-entry send-entry entry? eol entry->string)
     5   make-entry send-entry entry? eol entry->string max-line-length)
    66 
    77  (import scheme chicken)
     
    2222    (string-translate str "\r\n\t\x00" #\space))
    2323 
    24   ;; FIXME Selector limit is 255 characters.
    2524  ;; Read a line from the client, split it into tabs and
    2625  ;; pass it into handle-request.  Meaning of fields after
    27   ;; the selector is context-dependent (ugh), so we pass
     26  ;; the selector is context-sensitive (ugh), so we pass
    2827  ;; those as a list.
     28  ;; NB Official selector limit is 255 characters; we just
     29  ;; limit the total input line length.
     30  (define max-line-length (make-parameter 2048))
    2931  (define (accept handle-request)
    30     (let ((line (read-line)))
     32    (let ((line (read-line (current-input-port) (max-line-length))))
    3133      (and (not (eof-object? line))
    3234           (let ((fields (map sanitize-selector (string-split line "\t" #t))))
Note: See TracChangeset for help on using the changeset viewer.