You are here >  
  Franšais     

The Apache -> Lisp protocol

The protocol is really simple:

  • mod_lisp opens a socket to a lisp process. The lisp process can be on another computer for load balancing purposes.
  • mod_lisp sends header and connection parameter values to the Lisp process. For each key/value pair: The key is sent as a newline terminated line, then the value is sent as another line. When all key/values have been sent, the string "end\n" is sent
  • If there are some posted data then mod_lisp sends it to the Lisp process

Here is an example of how to get the values from mod_lisp in Lisp and putting them in an a-list:
(loop for key (read-line *apache-socket* nil nil)
      while (and key (string-not-equal key "end"))
      for value = (read-line *apache-socket* nil nil)
      collect (cons key value))

The Lisp -> Apache protocol

The protocol has changed for mod_lisp 2.0.
The Lisp process reply to mod_lisp by sending the header key/values pairs in the same way:

  • The Lisp process sends header and status parameter values to mod_lisp. For each key/value pair: The key is sent as a newline terminated line, then the value is sent as another line.
  • (New for mod_lisp 2.0) If the lisp process wants to keep the socket connection with mod_lisp open it have to send a "Keep-Socket" "1" key/value pair. mod_lisp will then keep the connection open *if* you have indicated a "Content-Length" value. If you do not do this, mod lisp will close the connection after each request.
  • The lisp process indicates that he has finished sending header key/values by sending the string "end\n"
  • The Lisp process then writes the response content to the socket. If you have indicated a "Content-Length" value, you MUST write exactly "Content-Length" bytes.

  • You can see what you get as key / values here. The same over a secure connection is here. (the certificate is not a valid one but it works) Note that if you have mod_ssl you get the ssl-session-id, so you can have secure sessions.The Lisp source of this is here.