# HG changeset patch # User Franck Deroche # Date 1238593784 -7200 # Node ID b9cd179a30a8f31246846db769922fd5c80311c1 # Parent e6378dbabe456c62b36535b16ea7df8300cdf0de Use user session for the drupal_http_request requesting the library. By default, drupal_http_request runs in a sandbox environment, thus the request doesn't have any idea about the current user. This in turn means that the request on the library is performed as an anonymous user, who may not have appropriate credentials to access the library. diff -r e6378dbabe45 -r b9cd179a30a8 dnd.module --- a/dnd.module Thu Feb 19 14:10:13 2009 -0500 +++ b/dnd.module Wed Apr 01 15:49:44 2009 +0200 @@ -116,12 +116,14 @@ return t('This library is not available'); } + $headers = array(); // Handle both relative and absolute urls if (!isset($url['scheme'])) { $settings['url'] = $base_url .'/'. $settings['url']; + $headers['Cookie'] = session_name() .'='. session_id(); } - $request = drupal_http_request($settings['url']); + $request = drupal_http_request($settings['url'], $headers); // We must remove some Drupal escaping $json = json_decode(str_replace(array('\x3c', '\x3e', '\x26'), array("<", ">", "&"), $request->data), TRUE);