HTTP_CONTENT_TRANSFER_ENCODING

Started by dexter, January 27, 2012, 06:29:50 AM

Previous topic - Next topic

dexter

Is this var/symbol exstied in newlisp?



I found this code in dragonfly framework,but I googled this, found nothing match it.



http://code.google.com/p/dragonfly-newlisp/source/browse/example-site/dragonfly-framework/lib/request.lsp?r=26dd4d9a55a69ad235653ab0e1da3e59d95e46d6">//http://code.google.com/p/dragonfly-newlisp/source/browse/example-site/dragonfly-framework/lib/request.lsp?r=26dd4d9a55a69ad235653ab0e1da3e59d95e46d6



   (if (and (setf temp HTTP_CONTENT_TRANSFER_ENCODING) (= temp "binary"))
        (handle-binary-data)
        (and (setf temp CONTENT_TYPE) (starts-with temp "multipart/form-data"))
        (handle-multipart-data)
        (and (read (device) temp MAX_POST_LENGTH) temp)
        (dolist (pair (parse-query temp))
            (add-keyvalue-to-ctx (first pair) (last pair) $POST)
        )  
    )  


What is this  HTTP_CONTENT_TRANSFER_ENCODING  for?

Kirill

#1
HTT_CONTENT_TRANSFER_ENCODING is environment variable, created from the http://en.wikipedia.org/wiki/MIME#Content-Transfer-Encoding">Content-Transfer-Encoding request header.



You can continue searching for Content-Transfer-Encoding, but in short, it tells how incoming data are encoded.

dexter

#2
thanks



I just want to know , it this created by newlisp or else?



I can not find this  HTTP_CONTENT_TRANSFER_ENCODING in newlisp codes

But dragonfly used it



So I wonder where it come from?

Kirill

#3
Ah, it's set by the web server. Here's what CGI 1.1 specification says about HTTP_* environment variables:



HTTP_*

      These variables are specific to requests made with HTTP.
      Interpretation of these variables may depend on the value of
      SERVER_PROTOCOL.

      Environment variables with names beginning with "HTTP_" contain
      header data read from the client, if the protocol used was HTTP.
      The HTTP header name is converted to upper case, has all
      occurrences of "-" replaced with "_" and has "HTTP_" prepended to
      give the environment variable name. The header data may be
      presented as sent by the client, or may be rewritten in ways which
      do not change its semantics. If multiple headers with the same
      field-name are received then they must be rewritten as a single
      header having the same semantics. Similarly, a header that is
      received on more than one line must be merged onto a single line.
      The server must, if necessary, change the representation of the
      data (for example, the character set) to be appropriate for a CGI
      environment variable.

      The server is not required to create environment variables for all
      the headers that it receives. In particular, it may remove any
      headers carrying authentication information, such as
      "Authorization"; it may remove headers whose value is available to
      the script via other variables, such as "Content-Length" and
      "Content-Type".