This would let minification happen more automatically without worrying about being a bad API citizen to Google. We've forgotten to re-minify files, and QA has mistakenly called it a regression.

Comments

kolier’s picture

And there are at least 1/3 human beings on the earth can't access Google directly. :(

kolier’s picture

If not, it's better this way:

function _minify_send_request($post_data) {
  $options = array(
    'method' => 'POST',
    'data' => $post_data,
    'headers' => array('Content-Type' => 'application/x-www-form-urlencoded'),
  );
  $result = drupal_http_request('http://closure-compiler.appspot.com/compile', $options);
  if (!isset($result->error)) {
    $response = json_decode($result->data);
    $httpcode = $result->code;
    return array('response' => $response, 'http_code' => $httpcode);
  }
  /*
  if (function_exists('curl_init')) {
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, "closure-compiler.appspot.com/compile");
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
    curl_setopt($curl, CURLOPT_POST, true);
    $response = json_decode(curl_exec($curl));
    $httpcode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
    curl_close($curl);
    return array('response' => $response, 'http_code' => $httpcode);
  }
  */
}

to allow drupal utilize proxy service, like using HTTP proxy

lolandese’s picture

Maybe some code can be borrowed from the Google Closure Compiler that seems to provide support for a local Java based compiler.

lolandese’s picture

The #2 suggestion was helpful in our case (thanks for that) but somehow unrelated to the OP original request. Thus we opened a new issue at #2622146: Use drupal_http_request as connection method instead of cURL.

lolandese’s picture

.