[wp-trac] [WordPress Trac] #39695: Add preload headers in redirects

WordPress Trac noreply at wordpress.org
Mon Feb 27 09:19:47 UTC 2017


#39695: Add preload headers in redirects
----------------------------------------+------------------------------
 Reporter:  onnimonni                   |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  HTTP API                    |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:
----------------------------------------+------------------------------

Comment (by onnimonni):

 @johnbillion Super cool to hear that you are interested in this.

 This was just a proof of concept. I can change the logic to use 3
 functions like this instead:

 {{{#!php
 <?php
 /*
  * Checks if this url is internal url. This is be used to check if
 asset/document can be preloaded.
  *
  * @param $url string
  *
  * @return bool
  */
 function is_internal_wp_url($url) {}

 /**
  * Creates preload header as string so we can have unit tests
  *
  * @param $url string - asset or document to preload
  * @param $type string - preload type
  *
  * @return string - Header string which can be used with header() function
  */
 function wp_create_preload_header($url, $type = "document") {}

 /**
  * Convenience wrapper for wp_create_preload_header() which adds new
 preload header
  *
  * @param $url string - asset or document to preload
  * @param $type string - preload type
  *
  * @return void
  */
 function wp_add_preload_header($url, $type = "document") {}
 }}}

 Do you have preference in naming these?

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39695#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list