Changeset 3759 in project


Ignore:
Timestamp:
04/05/07 10:29:33 (13 years ago)
Author:
felix winkelmann
Message:

fastcgi update

Location:
fastcgi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fastcgi/fastcgi.html

    r2485 r3759  
    154154<h3>Version</h3>
    155155<ul>
     156<li>1.1.1 Bug fix (thanks to Joachim Schipper)</li>
    156157<li>1.1 Support for dynamic servers and some bug fixes (both thanks to Nikolay Zavaritsky)</li>
    157158<li>1.0.1 Bug fix (thanks to Maria Rekouts)</li>
     
    189190<p>If called with no arguments, this procedure reads in as much data
    190191             as possible from the input stream, returning <tt>#f</tt> if the stream is empty, and a string
    191              otherwise.
    192              If called with a single integer argument, it reads exactly
     192             otherwise.</p>
     193<p>If called with a single integer argument &gt;= 0, it reads exactly
    193194             the specified number of characters from the stream
    194195             (and will block indefinitely if the stream is empty or contains too few characters and no EOF is encountered).
    195196             In either case, an exception is raised if there is an error reading
    196197             from the stream.</p>
     198<p>If called with #f, the entire input stream is read in and
     199             discarded, and an empty string is returned. For backwards
     200             compatibility, you can also use any negative integer in place
     201             of #f.</p>
    197202<p>Don't use <tt>(in)</tt> to read in post data, since there
    198             is no guarantee that it will read all of it.
    199             Instead, call <tt>in</tt> with the value of the HTTP_CONTENT_LENGTH
    200             environment variable, or use the <tt>fcgi-get-post-data</tt> procedure</p>
     203             is no guarantee that it will read all of it.
     204             Instead, call <tt>in</tt> with the value of the HTTP_CONTENT_LENGTH
     205             or CONTENT_LENGTH
     206             environment variable, or use the <tt>fcgi-get-post-data</tt> procedure.</p>
    201207<p>The variable <tt>*fcgi-slurp-chunk-size*</tt> determines the size of the input
    202             buffer which will be allocated by a zero-argument call to <tt>in</tt>.
    203             The value of this variable does not affect the maximum amount of input which can be read
    204             in, since additional buffers are automatically allocated as necessary
    205             (with increasing buffer size to increase efficiency).</p></dd>
     208             buffer which will be allocated by a zero-argument call to <tt>in</tt>.
     209             The value of this variable does not affect the maximum amount of input which can be read
     210             in, since additional buffers are automatically allocated as necessary
     211             (with increasing buffer size to increase efficiency).</p></dd>
    206212<dt class="definition"><strong>procedure:</strong> (out STRING)</dt>
    207213<dd>
     
    232238<p>Given an 'in' procedure and an 'env' procedure,
    233239            this procedure returns a string containing the post data for the last request,
    234             or <tt>#f</tt> if the last request was not a post request.</p></dd></div>
     240            or <tt>#f</tt> if the last request was not a post request.
     241            This procedure uses HTTP_CONTENT_LENGTH, or CONTENT_LENGTH if the former
     242            is not defined.</p></dd></div>
    235243<div class="section">
    236244<h3>Examples</h3>
  • fastcgi/fastcgi.meta

    r1254 r3759  
    44 (category web)
    55 (license "BSD")
    6  (author "Alex Drummond <a.drummond@ucl.ac.uk>")
     6 (author "Alex Drummond <a.d.drummond@gmail.com>")
    77 (files "fastcgi.setup" "fastcgi.scm" "fastcgi.html"))
    88
  • fastcgi/fastcgi.scm

    r2485 r3759  
    11;;;
    22;;; Copyright (c) 2006, Alex Drummond <a.d.drummond@googlemail.com>,
    3 ;;; with contributions from Maria Rekouts and Nikolay Zavaritsky.
    4 ;;; All rights reserved.
     3;;; with contributions from Maria Rekouts, Nikolay Zavaritsky and
     4;;; Joachim Schipper. All rights reserved.
    55;;;
    66;;; Redistribution and use in source and binary forms, with or without
     
    122122    fcgx-stream))
    123123
    124 ;;;
    125124(define fcgi-discard-input
    126125  (foreign-lambda*
     
    181180  (match-lambda*
    182181    ;; If an integer argument is given, read that
    183     ;; number of characters...
    184     ((n) (if (< size 0)
    185              (begin (fcgi-discard-input s) "")
     182    ;; number of characters.
     183    ;; If #f or a negative integer is given, discard the entire POST input.
     184    ;; (Negative integer is allowed as well as #f, since earlier versions only
     185    ;; allowed negative integers.)
     186    ((n) (if (or (and (boolean? n) (not n)) (< n 0))
     187             (begin (fcgi-discard-input s) "") ; Discard the entire input.
    186188             (fcgi-get-scheme-str n s)))
    187189    ;; ...otherwise, read the entire stream.
     
    307309  (fcgi-accept-loop-proto (lambda () 0) callback))
    308310
    309 ;;; Compatibility
     311;;; For compatibility with earlier versions of this library.
    310312(define fcgi-accept-loop fcgi-external-server-accept-loop)
    311313 
    312314(define (fcgi-get-post-data in env)
    313   (let ((cl (env "HTTP_CONTENT_LENGTH")))
     315  ;; Some servers set HTTP_CONTENT_LENGTH, others CONTENT_LENGTH.
     316  (let ((cl (env "HTTP_CONTENT_LENGTH" (env "CONTENT_LENGTH"))))
    314317    (if cl
    315318      (let ((icl (string->number cl)))
     
    318321          (make-property-condition
    319322            'exn
    320             'message "Value of HTTP_CONTENT_LENGTH is not an integer!")))
     323            'message "Value of HTTP_CONTENT_LENGTH or CONTENT_LENGTH is not an integer!")))
    321324      #f)))
    322325
Note: See TracChangeset for help on using the changeset viewer.