• You have a leading blank line at the top of the .info file.
  • The uninstall hook should delete all variables used, missing
    • httprl_background_callback
    • httprl_dns_timeout
    • httprl_connect_timeout
    • httprl_ttfb_timeout
    • httprl_timeout
    • httprl_global_timeout
    • httprl_url_inbound_alter
  • There's many places that check to make sure the Drupal version is >= 7, that could be refactored in both the d6 and d7 versions.
  • In httprl_build_url_self() you have an empty if (empty($path_parts)) { // Bail out here. } - should that do something, or can it be removed?
  • This is repeated a few times, consider refactoring or using a ternary operator instead $t = function_exists('t') ? 't' : 'httprl_pr';
      if (function_exists('t')) {
        $t = 't';
      }
      else {
        $t = 'httprl_pr';
      }
    
  • In httprl_set_connection_flag(), start with $flags = STREAM_CLIENT_CONNECT; and the if blocks can be much simpler.
  • In httprl_handle_data(), instead of $temp = $info; unset($info); $info[] = $temp;, $info = array($info); should be sufficient. Similarly in httprl_request().
  • httprl_send_request() is almost 500 LoC. Consider refactoring into smaller functions.
  • Instead of httprl_strlen(), how about using drupal_strlen()?
  • I don't see where the "Reset to defaults" button is defined for httprl_admin_settings_form_validate()?

What do you think?

----
Top Shelf Modules - Crafted, Curated, Contributed.

CommentFileSizeAuthor
#1 httprl-2110695-1-tsm-review.patch5.07 KBmikeytown2
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mikeytown2’s picture

Following patch has been committed. Things not changed:

Refactoring Drupal version is >= 7 - Open to suggestions.
drupal_strlen - "Do not count UTF-8 continuation bytes". I need to count every bit that goes over the wire, thus I can't use this. Also would make httprl require Drupal which it currently doesn't (would need logic similar to the t() function).
Reset to defaults button - in D6 by default, but not in D7.
httprl_send_request 500 LoC - It contains a event driven loop; breaking up could be done but would require a lot of effort.

Thanks again for reviewing all the code :)

kscheirer’s picture

Thanks mikeytown2!

re: Drupal 7 specific code, can't you use the D7 code in 7.x-1.x and D6 code in 6.x-1.x? Seems odd to handle both cases when you already know which version you're writing for. Unless this is also about keeping the module Drupal agnostic.

mikeytown2’s picture

Unless this is also about keeping the module Drupal agnostic.

That is the case. I want the minimal amount of work needed to maintain the 6.x & 7.x branch and for me making the code the same was the way to do it.

kscheirer’s picture

Status: Active » Fixed

Sounds good, thanks mikeytown2!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

added bullet list