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)
("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))
;; ("AUTH_TYPE" . xx) ; Random authentication

View File

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

View File

@ -281,6 +281,7 @@
uri
url
formats
sunet-utilities
scheme)
(files httpd-core))
@ -328,6 +329,7 @@
scsh ; syscalls
formats ; format
format-net ; FORMAT-INTERNET-HOST-ADDRESS
sunet-utilities ; host-name-or-empty
scheme)
(files cgi-server))
@ -682,3 +684,14 @@
(define (eval-safely exp)
(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))))))