[wp-trac] [WordPress Trac] #14348: If it's a HEAD request, stop after the head!

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 10 18:01:55 UTC 2012


#14348: If it's a HEAD request, stop after the head!
---------------------------------------------+------------------
 Reporter:  mitchoyoshitaka                  |       Owner:
     Type:  enhancement                      |      Status:  new
 Priority:  normal                           |   Milestone:  3.5
Component:  Performance                      |     Version:  3.0
 Severity:  normal                           |  Resolution:
 Keywords:  has-patch 3.5-early 2nd-opinion  |
---------------------------------------------+------------------
Changes (by kurtpayne):

 * cc: kpayne@… (added)


Comment:

 Replying to [comment:29 nacin]:
 > What if we did this:
 >
 > {{{
 > add_action( 'template_redirect', 'wp_exit_on_http_head', 1000 );
 > function wp_exit_on_http_head() {
 >     if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] )
 >         exit;
 > }
 > }}}

 Can we make this testable?  'exit' is not catchable.  Something like this?

 {{{
 add_action( 'template_redirect', 'wp_exit_on_http_head', 1000 );
 function wp_exit_on_http_head() {
         if ( 'HEAD' === $_SERVER['REQUEST_METHOD'] ) {
                 add_filter( 'wp_die_ajax_handler',
 '_scalar_wp_die_handler' );
                 wp_die();
         }
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/14348#comment:33>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list