* export selector and transformer of resolve-ip? field in httpd-options
* import dns to httpd-logging * add dns-lookup facility to logging
This commit is contained in:
		
							parent
							
								
									e0af4da4d6
								
							
						
					
					
						commit
						64d4705ab3
					
				|  | @ -21,12 +21,16 @@ | |||
|   *http-log-port*) | ||||
| (define (set-http-log-port! port) | ||||
|   (set! *http-log-port* port)) | ||||
| (define dns-lookup? #f)			; perform DNS lookups (write names instead of ips)? | ||||
| 
 | ||||
| (define (init-http-log! options) | ||||
|   ;; syslog has to be initialized befor CLF-logging | ||||
|   ;; because it may generate syslog-messages | ||||
|   (init-http-syslog! (httpd-options-syslog? options)) | ||||
|   (init-http-port-log! (httpd-options-logfile options))) | ||||
|   (init-http-port-log! (httpd-options-logfile options)) | ||||
|   (if (httpd-options-resolve-ips? options) | ||||
|       (set! dns-lookup? #t) | ||||
|       (set! dns-lookup? #f))) | ||||
| 
 | ||||
| (define (init-http-port-log! logfile) | ||||
|   (let ((logport  | ||||
|  | @ -116,7 +120,7 @@ | |||
| ; note: till now, we do not log the user's time zone code | ||||
| (define (make-CLF remote-ip request-type requested-file protocol http-code filesize referer user-agent) | ||||
|   (format #f "~A - - ~A ~S ~A ~A ~S ~S~%" | ||||
| 		(or remote-ip "-") | ||||
| 		(or (maybe-dns-lookup remote-ip) "-") | ||||
| 		(format-date "[~d/~b/~Y:~H:~M:~S +0000]" (date))     ; +0000 as we don't know | ||||
| 		(string-join (list request-type  | ||||
| 				   (string-append "/" requested-file)  | ||||
|  | @ -132,3 +136,8 @@ | |||
| 		    ""))) | ||||
| 
 | ||||
| 
 | ||||
| (define (maybe-dns-lookup remote-ip) | ||||
|   (if dns-lookup? | ||||
|       (or (dns-lookup-ip remote-ip) | ||||
| 	  remote-ip) | ||||
|       remote-ip)) | ||||
|  | @ -259,7 +259,8 @@ | |||
| 	  with-server-admin | ||||
| 	  with-simultaneous-requests | ||||
| 	  with-logfile | ||||
| 	  with-syslog?)) | ||||
| 	  with-syslog? | ||||
| 	  with-resolve-ips?)) | ||||
| 
 | ||||
| (define-interface httpd-read-options-interface | ||||
|   (export httpd-options-port | ||||
|  | @ -270,7 +271,8 @@ | |||
| 	  httpd-options-server-admin | ||||
| 	  httpd-options-simultaneous-requests | ||||
| 	  httpd-options-logfile | ||||
| 	  httpd-options-syslog?)) | ||||
| 	  httpd-options-syslog? | ||||
| 	  httpd-options-resolve-ips?)) | ||||
| 
 | ||||
| (define-interface httpd-access-control-interface | ||||
|   (export access-denier | ||||
|  | @ -688,6 +690,7 @@ | |||
| 	rfc822				; get-header | ||||
| 	sunet-utilities			; on-interrupt | ||||
| 	threads				; spawn | ||||
| 	dns				; dns-lookup-ip | ||||
| 	scsh | ||||
| 	scheme) | ||||
|   (files (httpd logging))) | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 interp
						interp