… | |
… | |
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 | #ifdef ERR_DIR |
|
|
831 | char filename[1000]; |
|
|
832 | #endif |
|
|
833 | |
|
|
834 | hc->protocol = "HTTP/1.0"; |
|
|
835 | |
|
|
836 | #ifdef ERR_DIR |
|
|
837 | /* Try virtual host error page. */ |
|
|
838 | if ( hc->hs->vhost && hc->hostdir[0] != '\0' ) |
|
|
839 | { |
|
|
840 | (void) my_snprintf( filename, sizeof(filename), |
|
|
841 | "%s/%s/err403blocked.html", hc->hostdir, ERR_DIR ); |
|
|
842 | if ( send_err_file( hc, 403, err403title, "", filename ) ) |
|
|
843 | return; |
|
|
844 | } |
|
|
845 | |
|
|
846 | /* Try server-wide error page. */ |
|
|
847 | (void) my_snprintf( filename, sizeof(filename), |
|
|
848 | "%s/err403blocked.html", ERR_DIR ); |
|
|
849 | if ( send_err_file( hc, 403, err403title, "", filename ) ) |
|
|
850 | return; |
|
|
851 | |
|
|
852 | /* Fall back on built-in error page. */ |
|
|
853 | send_response( hc, 403, err403title, "", err403form, "" ); |
|
|
854 | |
|
|
855 | #else /* ERR_DIR */ |
|
|
856 | |
|
|
857 | send_response( hc, 403, err403title, "", err403form, "" ); |
|
|
858 | |
|
|
859 | #endif /* ERR_DIR */ |
|
|
860 | hc->protocol = protocol; |
|
|
861 | } |
|
|
862 | |
825 | |
863 | #ifdef ERR_DIR |
826 | #ifdef ERR_DIR |
864 | static int |
827 | static int |
865 | send_err_file( httpd_conn* hc, int status, char* title, char* extraheads, char* filename ) |
828 | send_err_file( httpd_conn* hc, int status, char* title, char* extraheads, char* filename ) |
866 | { |
829 | { |
… | |
… | |
1738 | hc->init_byte_loc = 0; |
1701 | hc->init_byte_loc = 0; |
1739 | hc->end_byte_loc = -1; |
1702 | hc->end_byte_loc = -1; |
1740 | hc->keep_alive = 0; |
1703 | hc->keep_alive = 0; |
1741 | hc->should_linger = 0; |
1704 | hc->should_linger = 0; |
1742 | hc->file_address = (char*) 0; |
1705 | hc->file_address = (char*) 0; |
|
|
1706 | hc->file_fd = -1; |
1743 | return GC_OK; |
1707 | return GC_OK; |
1744 | } |
1708 | } |
1745 | |
1709 | |
1746 | |
1710 | |
1747 | /* Checks hc->read_buf to see whether a complete request has been read so far; |
1711 | /* Checks hc->read_buf to see whether a complete request has been read so far; |
… | |
… | |
3684 | char bytes[40]; |
3648 | char bytes[40]; |
3685 | |
3649 | |
3686 | if ( hc->hs->no_log ) |
3650 | if ( hc->hs->no_log ) |
3687 | return; |
3651 | return; |
3688 | |
3652 | |
3689 | /* don't log UNKNOWN protocol requests (blocks etc..) */ |
|
|
3690 | if ( !strcmp (hc->protocol, "UNKNOWN") ) |
|
|
3691 | return; |
|
|
3692 | |
|
|
3693 | /* This is straight CERN Combined Log Format - the only tweak |
3653 | /* This is straight CERN Combined Log Format - the only tweak |
3694 | ** being that if we're using syslog() we leave out the date, because |
3654 | ** being that if we're using syslog() we leave out the date, because |
3695 | ** syslogd puts it in. The included syslogtocern script turns the |
3655 | ** syslogd puts it in. The included syslogtocern script turns the |
3696 | ** results into true CERN format. |
3656 | ** results into true CERN format. |
3697 | */ |
3657 | */ |