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

WordPress Trac wp-trac at lists.automattic.com
Sun Aug 12 05:24:11 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  |
---------------------------------------------+------------------

Comment (by mitchoyoshitaka):

 Replying to [comment:38 kurtpayne]:
 > Take a look at the updated patch and associated unit test.
 >
 > This also has the side effect of creating an action (head_request) that
 can be reused in plugins.


 Two thoughts:

 1. I don't think the action `head_request` and triggering it in the tests
 is the best way to test this. Why not simply set
 `$_SERVER['REQUEST_METHOD'] = 'HEAD'` and check that it ends with no
 input? The semantics of `head_request` are also odd: it's triggered even
 if it's not a HEAD request?
 2. Using `wp_die`, again, means that unwanted output will be printed, in
 this case for AJAX and API requests. (`wp_die_handler` filter is only used
 if it's not AJAX or API request.) Again, simply using `exit()` (and
 catching right before it for tests) is the right approach, as I explained
 above.

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


More information about the wp-trac mailing list