Subscribe via
Welcome, Guest. Please login or register.
Did you miss your activation email?
 OMNINOGGIN ForumPlugin SupportWP MinifyFixes for HTTP 400 error, extra & in URL and XHTML Compatibility
Pages: [1]
Print
Author Topic: Fixes for HTTP 400 error, extra & in URL and XHTML Compatibility  (Read 771 times)
keremerkan
Newbie
*
Posts: 5


View Profile WWW Email
« on: March 11, 2010, 02:13:44 AM »

When building the css and js URL, if there are no extra options for wp-minify, the URL has an extra & in it, and when the newly added "m" parameter is added to this url, the URL is broken like this:

http://....../f=js_to_minify.js&&m=123456

To avoid this, in check_and_split_url function, the following part:

else {
  return array($base_url . '?f=' . urlencode(implode(',', $files)) . $debug_url);
      }

should be changed like this:

else {
  if ( !empty($wpm_options['extra_minify_options']) )
    return array($base_url . '?f=' . implode(',', $files) . $debug_url . '&' . $wpm_options['extra_minify_options']);
  else
    return array($base_url . '?f=' . implode(',', $files)) . $debug_url;
      }
« Last Edit: March 12, 2010, 02:47:58 AM by keremerkan » Logged

keremerkan
Newbie
*
Posts: 5


View Profile WWW Email
« Reply #1 on: March 11, 2010, 02:22:35 AM »

Also for w3C standard compatibility, the query string should be encoded. So it is better to change the code mentioned above to this one:

else {
  if ( !empty($wpm_options['extra_minify_options']) )
    return array($base_url . '?f=' . urlencode(implode(',', $files) . $debug_url . '&' . $wpm_options['extra_minify_options']));
  else
    return array($base_url . '?f=' . urlencode(implode(',', $files)) . $debug_url);
      }

Also the "&m=" in css and js url building code should be changed to "&m="

After these two changes, the page can pass W3C XHTML compatibility test.

Cheers!
Logged

keremerkan
Newbie
*
Posts: 5


View Profile WWW Email
« Reply #2 on: March 11, 2010, 02:33:47 AM »

Also, to remove duplicate css or js entries and avoid HTTP 400 errors, the code should be changed to this (this effectively solves the problem in wp-login.php I mentioned earlier):

else {
  if ( !empty($wpm_options['extra_minify_options']) )
    return array($base_url . '?f=' . urlencode(implode(',', array_unique($files)) . $debug_url . '&' . $wpm_options['extra_minify_options']));
  else
    return array($base_url . '?f=' . urlencode(implode(',', array_unique($files))) . $debug_url);
}

This is the final one.  ;D
Logged

Thaya
Administrator
Sr. Member
*****
Posts: 420



View Profile WWW Email
« Reply #3 on: March 18, 2010, 11:25:33 AM »

Looks good. I'll try to work it into the next version this weekend or so.
Logged

Thaya
Administrator
Sr. Member
*****
Posts: 420



View Profile WWW Email
« Reply #4 on: April 26, 2010, 11:52:17 PM »

This was released in 0.8.0.
Logged

Pages: [1]
Print
Jump to: