… | |
… | |
820 | send_response( hc, status, title, extraheads, form, arg ); |
820 | send_response( hc, status, title, extraheads, form, arg ); |
821 | |
821 | |
822 | #endif /* ERR_DIR */ |
822 | #endif /* ERR_DIR */ |
823 | } |
823 | } |
824 | |
824 | |
|
|
825 | void |
|
|
826 | httpd_send_err_blocked( httpd_conn* hc ) |
|
|
827 | { |
|
|
828 | char *protocol = hc->protocol; |
|
|
829 | |
|
|
830 | hc->protocol = "HTTP/1.0"; |
|
|
831 | #ifdef ERR_DIR |
|
|
832 | |
|
|
833 | char filename[1000]; |
|
|
834 | |
|
|
835 | /* Try virtual host error page. */ |
|
|
836 | if ( hc->hs->vhost && hc->hostdir[0] != '\0' ) |
|
|
837 | { |
|
|
838 | (void) my_snprintf( filename, sizeof(filename), |
|
|
839 | "%s/%s/err403blocked.html", hc->hostdir, ERR_DIR ); |
|
|
840 | if ( send_err_file( hc, 403, err403title, "", filename ) ) |
|
|
841 | return; |
|
|
842 | } |
|
|
843 | |
|
|
844 | /* Try server-wide error page. */ |
|
|
845 | (void) my_snprintf( filename, sizeof(filename), |
|
|
846 | "%s/err403blocked.html", ERR_DIR ); |
|
|
847 | if ( send_err_file( hc, 403, err403title, "", filename ) ) |
|
|
848 | return; |
|
|
849 | |
|
|
850 | /* Fall back on built-in error page. */ |
|
|
851 | send_response( hc, 403, err403title, "", err403form, "" ); |
|
|
852 | |
|
|
853 | #else /* ERR_DIR */ |
|
|
854 | |
|
|
855 | send_response( hc, 403, err403title, "", err403form, "" ); |
|
|
856 | |
|
|
857 | #endif /* ERR_DIR */ |
|
|
858 | hc->protocol = protocol; |
|
|
859 | } |
825 | |
860 | |
826 | #ifdef ERR_DIR |
861 | #ifdef ERR_DIR |
827 | static int |
862 | static int |
828 | send_err_file( httpd_conn* hc, int status, char* title, char* extraheads, char* filename ) |
863 | send_err_file( httpd_conn* hc, int status, char* title, char* extraheads, char* filename ) |
829 | { |
864 | { |
… | |
… | |
3647 | char bytes[40]; |
3682 | char bytes[40]; |
3648 | |
3683 | |
3649 | if ( hc->hs->no_log ) |
3684 | if ( hc->hs->no_log ) |
3650 | return; |
3685 | return; |
3651 | |
3686 | |
|
|
3687 | /* don't log UNKNOWN protocol requests (blocks etc..) */ |
|
|
3688 | if ( !strcmp (hc->protocol, "UNKNOWN") ) |
|
|
3689 | return; |
|
|
3690 | |
3652 | /* This is straight CERN Combined Log Format - the only tweak |
3691 | /* This is straight CERN Combined Log Format - the only tweak |
3653 | ** being that if we're using syslog() we leave out the date, because |
3692 | ** being that if we're using syslog() we leave out the date, because |
3654 | ** syslogd puts it in. The included syslogtocern script turns the |
3693 | ** syslogd puts it in. The included syslogtocern script turns the |
3655 | ** results into true CERN format. |
3694 | ** results into true CERN format. |
3656 | */ |
3695 | */ |