[wp-trac] [WordPress Trac] #19707: admin-ajax.php requests via http regardless of force_ssl_admin() state

WordPress Trac wp-trac at lists.automattic.com
Fri Apr 27 20:59:54 UTC 2012


#19707: admin-ajax.php requests via http regardless of force_ssl_admin() state
-------------------------------------------------+-------------------------
 Reporter:  robertaccettura                      |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  HTTP                                 |  Review
 Severity:  normal                               |     Version:
 Keywords:  reporter-feedback has-patch dev-     |  Resolution:
  feedback                                       |
-------------------------------------------------+-------------------------
Changes (by lightningspirit):

 * keywords:  reporter-feedback => reporter-feedback has-patch dev-feedback
 * component:  Security => HTTP


Comment:

 The [http://codex.wordpress.org/Function_Reference/admin_url admin_url()]
 and [http://codex.wordpress.org/Function_Reference/home_url home_url()]
 functions can override SSL  in the second parameter passing 'http' or
 'https' as parameters.

 I suggest to create a ajax_url() function to choose either it should use
 'https' or 'http' dynamically. Something like:


 {{{
 function ajax_url( $url, $scheme = null ) {
   // If $scheme is passed use it, otherwise test if the current request is
 HTTPS
   $scheme = $scheme ? $scheme : ( is_ssl ? 'https' : 'http' );
   return admin_url( "admin-ajax.php", $scheme );
 }
 }}}

 That could be easier for developers! :)

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


More information about the wp-trac mailing list