Motivation

The goal is to permit to make request to antispam servers through the proxy, if Drupal is configure in this way.

Proposed resolution

Drupal give us the marvellous function drupal_http_request() which check if the proxy configuration is set for the current site. So, for implement this request we just have to modify _antispam_api_http_post() function for used this drupal_http_request() function.
(My patch coming soon...)

Remaining tasks

Your comments, about the patch will be posting in the next comment, are welcome ;)

User interface changes

No change.

API changes

- The variable name return by the function _antispam_api_http_post() have changed from $response to $return.
- The $return[0] isn't the same as former $response[0]. $response[0] just returned a string with the response headers. $return[0] return the whole object returned itself by drupal_http_request(). Better or worse ? I feel that better, but i'm open to your comments.
- The $return[1] is the same as former $response[1].

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Merkator’s picture

Issue tags: +configuration, +drupal_http_request, +settings, +proxy, +_antispam_api_http_post
FileSize
26.17 KB

My patch... Your comments ? :)

Merkator’s picture

My former patch is really bad. This one is better... Sorry.

NStorm’s picture

Status: Active » Needs review

Will change it to "needs review" for patch test. But this package is unfortunately are unmaintained by now.

marcoscano’s picture

Version: 7.x-1.5 » 7.x-1.x-dev
Issue summary: View changes
Status: Needs review » Needs work
Issue tags: -configuration, -drupal_http_request, -settings, -proxy, -_antispam_api_http_post +Needs reroll

Patch does not apply to -dev anymore. Also, some minor improvements to the patch:

  1. +++ b/antispam.module
    @@ -2446,27 +2446,30 @@ function _antispam_api_build_query_string($array) {
    + * @return array Object returned by drupal_http_request in $return[0] and entity in $return[1].
    

    I know this was not created in this patch, but once we are modifying it, we could take the opportunity to apply the current coding standards to this docblock :)

    https://www.drupal.org/docs/develop/coding-standards/api-documentation-a...

  2. +++ b/antispam.module
    @@ -2446,27 +2446,30 @@ function _antispam_api_build_query_string($array) {
    +  ¶
    

    There are some trailing spaces here.

  3. +++ b/antispam.module
    @@ -2446,27 +2446,30 @@ function _antispam_api_build_query_string($array) {
    +  ¶
    

    There are some trailing spaces here.

  4. +++ b/antispam.module
    @@ -2446,27 +2446,30 @@ function _antispam_api_build_query_string($array) {
    +  $response = drupal_http_request($url,$options);
    

    There should be a space between the comma and the next argument in the function call.

  5. +++ b/antispam.module
    @@ -2446,27 +2446,30 @@ function _antispam_api_build_query_string($array) {
    +    $return = array();
    

    This assignment is redundant because $return was already assigned some lines before.

arunkumark’s picture

Status: Needs work » Needs review
FileSize
2.1 KB

Hi,

I have rerolled patch for the 7.x-1.x-dev version with comment #4.

chrisguindon’s picture

I have rerolled patch for the 7.x-1.x-dev version with comment #5

This patch is a bit larger since it's also removing some unwanted whitespaces in the file.

chrisguindon’s picture

Issue tags: -Needs reroll