Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

2001-10-18 Jon Howard <jhoward@cobweb>

  • Loading branch information...
commit fc30faaf1ed0693c64af9127f3fd0b6a7c53729f 1 parent 3a3507b
jhoward authored
Showing with 43 additions and 22 deletions.
  1. +7 −0 ChangeLog
  2. +16 −10 log.cl
  3. +20 −12 main.cl
View
7 ChangeLog
@@ -1,3 +1,10 @@
+2001-10-18 Jon Howard <jhoward@cobweb>
+
+ * log.cl: added facility for dynamically binding vhost log stream;
+ changed logging to emulate apache logging.
+ * main.cl: ignoring socket reset by peer errorno 104; more apache
+ log emulation.
+
2001-10-16 Kevin Layer <layer@crikey>
* cgi.cl: use :format :binary in with-http-response in
View
26 log.cl
@@ -23,7 +23,7 @@
;; Suite 330, Boston, MA 02111-1307 USA
;;
;;
-;; $Id: log.cl,v 1.20 2001/10/10 16:32:57 jkf Exp $
+;; $Id: log.cl,v 1.20.2.1 2001/10/18 17:36:39 jhoward Exp $
;; Description:
;; iserve's logging
@@ -44,8 +44,11 @@
(mp:process-name sys:*current-process*)
cmonth cday (mod cyear 100)
chour cmin csec
- message)))
- (write-sequence str (or *aserve-debug-stream* *initial-terminal-io*)))))
+ message))
+ (stream (vhost-log-stream
+ (wserver-default-vhost user::*server*))))
+ (write-sequence str stream)
+ (finish-output stream))))
(defmethod brief-logmess (message)
;; omit process name and month, day, year
@@ -54,11 +57,12 @@
(let ((str (format nil
"~2,'0d:~2,'0d:~2,'0d - ~a~%"
chour cmin csec
- message)))
- (write-sequence str (or *aserve-debug-stream* *initial-terminal-io*)))))
-
-
-
+ message))
+ (stream (or *aserve-debug-stream*
+ (vhost-log-stream
+ (wserver-default-vhost user::*server*)))))
+ (write-sequence str stream)
+ (finish-output stream))))
(defun log-timed-out-request-read (socket)
@@ -85,12 +89,14 @@
(request-vhost req))))
(format stream
- "~a - - [~a] ~s ~s ~s~%"
+ "~a - - [~a] ~s ~s ~s ~s ~s~%"
(socket:ipaddr-to-dotted ipaddr)
(maybe-universal-time-to-date time)
(request-raw-request req)
code
- (or length -1)))))
+ (or length -1)
+ (or (header-slot-value req :referer) "-")
+ (or (header-slot-value req :user-agent) "-")))))
View
32 main.cl
@@ -23,7 +23,7 @@
;; Suite 330, Boston, MA 02111-1307 USA
;;
;;
-;; $Id: main.cl,v 1.116.2.1 2001/10/16 20:09:44 layer Exp $
+;; $Id: main.cl,v 1.116.2.2 2001/10/18 17:36:39 jhoward Exp $
;; Description:
;; aserve's main loop
@@ -1252,7 +1252,13 @@ by keyword symbols and not by strings"
else "")
cond
)))))
- else (process-connection sock))
+ else ;; this is probably not a good solution for anyone,
+ ;; but maybe us. Ignoring socket disconnect errors.
+ (handler-case (process-connection sock)
+ (socket-error (cond)
+ (if* (= (slot-value cond 'excl::code) 104)
+ thenret ;; do nothing
+ else (error cond)))))
(abandon ()
:report "Abandon this request and wait for the next one"
nil))
@@ -2412,9 +2418,8 @@ in get-multipart-sequence"))
(#\S 9) ; sept
))
-
-
-(defun maybe-universal-time-to-date (ut-or-string &optional (time-zone 0))
+(defun maybe-universal-time-to-date (ut-or-string &optional
+ (time-zone 0))
;; given a ut or a string, only do the conversion on the string
(if* (stringp ut-or-string)
then ut-or-string
@@ -2423,7 +2428,7 @@ in get-multipart-sequence"))
(defparameter *saved-ut-to-date* nil)
(defun universal-time-to-date (ut &optional (time-zone 0))
- ;; convert a lisp universal time to rfc 1123 date
+ ;; convert a lisp universal time to apache log style date
;;
(let ((cval *saved-ut-to-date*))
(if* (and (eql ut (caar cval))
@@ -2435,13 +2440,13 @@ in get-multipart-sequence"))
(multiple-value-bind
(sec min hour date month year day-of-week dsp tz)
(decode-universal-time ut time-zone)
- (declare (ignore tz dsp))
+ (declare (ignore tz day-of-week))
(let ((ans
(format
nil
- "~a, ~2,'0d ~a ~d ~2,'0d:~2,'0d:~2,'0d~@[ GMT~]"
- (svref '#("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")
- day-of-week)
+ "~2,'0d/~a/~d:~2,'0d:~2,'0d:~2,'0d ~A"
+ #+ignore(svref '#("Mon" "Tue" "Wed" "Thu" "Fri" "Sat" "Sun")
+ day-of-week)
date
(svref '#(nil "Jan" "Feb" "Mar" "Apr" "May" "Jun"
"Jul" "Aug" "Sep" "Oct" "Nov" "Dec")
@@ -2450,12 +2455,15 @@ in get-multipart-sequence"))
hour
min
sec
- (= 0 time-zone))))
+ ;;; This should be made automatic,
+ ;;; or at least configurable.
+ (if dsp
+ "-0800"
+ "-0700"))))
(setf *saved-ut-to-date* (cons (cons ut time-zone) ans))
ans))))))
-
;; ----- simple resource
(defstruct sresource
Please sign in to comment.
Something went wrong with that request. Please try again.