Don't loose if the remote host has no DNS entry.

This commit is contained in:
mainzelm 2001-10-29 08:39:15 +00:00
parent aa2f04195e
commit e90c8b14c3
3 changed files with 18 additions and 6 deletions

View File

@ -188,7 +188,7 @@
("PATH_TRANSLATED" . ,path-translated) ("PATH_TRANSLATED" . ,path-translated)
("SCRIPT_NAME" . ,script-name) ("SCRIPT_NAME" . ,script-name)
("REMOTE_HOST" . ,(host-info:name (host-info raddr))) ("REMOTE_HOST" . ,(host-name-or-empty raddr))
("REMOTE_ADDR" . ,(format-internet-host-address rhost)) ("REMOTE_ADDR" . ,(format-internet-host-address rhost))
;; ("AUTH_TYPE" . xx) ; Random authentication ;; ("AUTH_TYPE" . xx) ; Random authentication

View File

@ -180,10 +180,9 @@
(let ((line (read-crlf-line))) (let ((line (read-crlf-line)))
;; Blat out some logging info. ;; Blat out some logging info.
(if *http-log?* (if *http-log?*
(let* ((addr (socket-remote-address sock)) (let* ((addr (socket-remote-address sock))
(host (host-info:name (host-info addr)))) (host (host-name-or-empty addr)))
(http-log "~a: ~a~%" host line))) (http-log "~a: ~a~%" host line)))
(if (eof-object? line) (if (eof-object? line)

View File

@ -281,6 +281,7 @@
uri uri
url url
formats formats
sunet-utilities
scheme) scheme)
(files httpd-core)) (files httpd-core))
@ -328,6 +329,7 @@
scsh ; syscalls scsh ; syscalls
formats ; format formats ; format
format-net ; FORMAT-INTERNET-HOST-ADDRESS format-net ; FORMAT-INTERNET-HOST-ADDRESS
sunet-utilities ; host-name-or-empty
scheme) scheme)
(files cgi-server)) (files cgi-server))
@ -682,3 +684,14 @@
(define (eval-safely exp) (define (eval-safely exp)
(ignore-errors (lambda () (eval exp (new-safe-package))))))) (ignore-errors (lambda () (eval exp (new-safe-package)))))))
(define-structure sunet-utilities (export host-name-or-empty)
(open scsh
scheme
handle-fatal-error)
(begin
(define (host-name-or-empty addr)
(with-fatal-error-handler
(lambda (condition more)
"")
(host-info:name (host-info addr))))))