Sunday 28 December 2008

Drupal 6.6+ and Proxy related issues


To solve proxy related issues in drupal 6.X follow issues addressed at http://drupal.org/node/7881.

or

Step: 1
++++++
Apply patch: (http://drupal.org/files/issues/proxy6.6.patch)

--- includes/common.inc Wed Oct 22 20:26:02 2008
+++ includes/common.inc Fri Oct 24 10:22:30 2008
@@ -416,6 +416,11 @@
function drupal_http_request($url, $headers = array(), $method = 'GET', $data = NULL, $retry = 3) {
static $self_test = FALSE;
$result = new stdClass();
+
+ //PROXYHACK
+ $proxy_not_required = TRUE;
+ ///PROXYHACK
+
// Try to clear the drupal_http_request_fails variable if it's set. We
// can't tie this call to any error because there is no surefire way to
// tell whether a request has failed, so we add the check to places where
@@ -449,7 +454,19 @@
case 'http':
$port = isset($uri['port']) ? $uri['port'] : 80;
$host = $uri['host'] . ($port != 80 ? ':'. $port : '');
+ //PROXYHACK
+ $proxy_not_required = is_in_no_proxy_list($uri['host']);
+ if ((variable_get('proxy_server', '') != '') && (FALSE == $proxy_not_required)) {
+ $proxy_server = variable_get('proxy_server', '');
+ $proxy_port = variable_get('proxy_port', 8080);
+ $fp = @fsockopen($proxy_server, $proxy_port, $errno, $errstr, 15);
+ }
+ else {
+ ///PROXYHACK
$fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
+ //PROXYHACK
+ }
+ ///PROXYHACK
break;
case 'https':
// Note: Only works for PHP 4.3 compiled with OpenSSL.
@@ -472,10 +489,19 @@
}

// Construct the path to act on.
+ //PROXYHACK
+ if ((variable_get('proxy_server', '') != '') && (FALSE == $proxy_not_required)) {
+ $path = $url;
+ }
+ else {
+ ///PROXYHACK
$path = isset($uri['path']) ? $uri['path'] : '/';
if (isset($uri['query'])) {
$path .= '?'. $uri['query'];
}
+ //PROXYHACK
+ }
+ ///PROXYHACK

// Create HTTP request.
$defaults = array(
@@ -492,6 +518,15 @@
$defaults['Authorization'] = 'Authorization: Basic '. base64_encode($uri['user'] . (!empty($uri['pass']) ? ":". $uri['pass'] : ''));
}

+ //PROXYHACK
+ if ((variable_get('proxy_username', '') != '') && (FALSE == $proxy_not_required)) {
+ $username = variable_get('proxy_username', '');
+ $password = variable_get('proxy_password', '');
+ $auth_string = base64_encode($username . ($password != '' ? ':'. $password : ''));
+ $defaults['Proxy-Authorization'] = 'Proxy-Authorization: Basic '. $auth_string ."\r\n";
+ }
+ ///PROXYHACK
+
foreach ($headers as $header => $value) {
$defaults[$header] = $header .': '. $value;
}
@@ -569,6 +604,25 @@
$result->code = $code;
return $result;
}
+//PROXY_HACK
+function is_in_no_proxy_list($host) {
+ $rv = FALSE;
+
+ $proxy_exceptions = variable_get('proxy_exceptions', '');
+ if (FALSE == empty($proxy_exceptions)) {
+ $patterns = explode(",",$proxy_exceptions);
+ foreach ($patterns as $pattern) {
+ $pattern = trim($pattern, " ");
+ if (strstr($host,$pattern)) {
+ $rv = TRUE;
+ break;
+ }
+ }
+ }
+ return $rv;
+}
+///PROXY_HACK
+
/**
* @} End of "HTTP handling".
*/
--- modules/system/system.admin.inc Thu Oct 16 21:23:38 2008
+++ modules/system/system.admin.inc Fri Oct 24 10:19:54 2008
@@ -1362,6 +1362,79 @@
drupal_set_message(t('Caches cleared.'));
}

+//PROXYHACK
+/**
+ * Form builder; Configure the site proxy settings.
+ *
+ * @ingroup forms
+ * @see system_settings_form()
+ */
+function system_proxy_settings() {
+
+ $form['forward_proxy'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Forward Proxy Settings'),
+ '#description' => t('The proxy server used when Drupal needs to connect to other sites on the Internet.'),
+ );
+ $form['forward_proxy']['proxy_server'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy host name'),
+ '#default_value' => variable_get('proxy_server', ''),
+ '#description' => t('The host name of the proxy server, eg. localhost. If this is empty Drupal will connect directly to the internet.')
+ );
+ $form['forward_proxy']['proxy_port'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy port number'),
+ '#default_value' => variable_get('proxy_port', 8080),
+ '#description' => t('The port number of the proxy server, eg. 8080'),
+ );
+ $form['forward_proxy']['proxy_username'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy username'),
+ '#default_value' => variable_get('proxy_username', ''),
+ '#description' => t('The username used to authenticate with the proxy server.'),
+ );
+ $form['forward_proxy']['proxy_password'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Proxy password'),
+ '#default_value' => variable_get('proxy_password', ''),
+ '#description' => t('The password used to connect to the proxy server. This is kept as plain text.', '')
+ );
+ $form['forward_proxy']['proxy_exceptions'] = array(
+ '#type' => 'textfield',
+ '#title' => t('No proxy for'),
+ '#default_value' => variable_get('proxy_exceptions', 'localhost'),
+ '#description' => t('Example: .example.com,localhost,192.168.1.2', '')
+ );
+ $form['forward_proxy']['proxy_skip_selftest'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Skip HTTP self test'),
+ '#description' => t('Skip HTTP request self test.'),
+ '#default_value' => variable_get('proxy_skip_selftest', '0'),
+ );
+ $form['#validate'][] = 'system_proxy_settings_validate';
+
+ return system_settings_form($form);
+}
+
+/**
+ * Validate the submitted proxy form.
+ */
+function system_proxy_settings_validate($form, &$form_state) {
+ // Validate the proxy settings
+ $form_state['values']['proxy_server'] = trim($form_state['values']['proxy_server']);
+ if ($form_state['values']['proxy_server'] != '') {
+ // TCP allows the port to be between 0 and 65536 inclusive
+ if (!is_numeric($form_state['values']['proxy_port'])) {
+ form_set_error('proxy_port', t('The proxy port is invalid. It must be a number between 0 and 65535.'));
+ }
+ elseif ($form_state['values']['proxy_port'] <>= 65536) {
+ form_set_error('proxy_port', t('The proxy port is invalid. It must be between 0 and 65535.'));
+ }
+ }
+}
+///PROXY_HACK
+
/**
* Form builder; Configure the site file handling.
*
--- modules/system/system.module Wed Oct 22 20:26:02 2008
+++ modules/system/system.module Fri Oct 24 10:20:54 2008
@@ -406,6 +406,16 @@
'access arguments' => array('administer site configuration'),
'file' => 'system.admin.inc',
);
+ //PROXYHACK
+ $items['admin/settings/proxy'] = array(
+ 'title' => 'Proxy Server',
+ 'description' => 'Configure settings when the site is behind a proxy server.',
+ 'page callback' => 'drupal_get_form',
+ 'page arguments' => array('system_proxy_settings'),
+ 'access arguments' => array('administer site configuration'),
+ 'file' => 'system.admin.inc',
+ );
+ ///PROXY_HACK
$items['admin/settings/file-system'] = array(
'title' => 'File system',
'description' => 'Tell Drupal where to store uploaded files and how they are accessed.',
@@ -1877,6 +1887,10 @@
// Check whether we can do any request at all. First get the results for
// a very simple page which has access TRUE set via the menu system. Then,
// try to drupal_http_request() the same page and compare.
+ //PROXYHACK
+ $skip_selftest = variable_get('proxy_skip_selftest', '0');
+ if (0 == $skip_selftest) {
+ ///PROXYHACK
ob_start();
$path = 'admin/reports/request-test';
menu_execute_active_handler($path);
@@ -1884,6 +1898,12 @@
ob_end_clean();
$result = drupal_http_request(url($path, array('absolute' => TRUE)));
$works = isset($result->data) && $result->data == $nothing;
+ //PROXYHACK
+ }
+ else {
+ $works = TRUE;
+ }
+ ///PROXYHACK
variable_set('drupal_http_request_fails', !$works);
return $works;
}

Step:2
++++++
Then download the module "Http Request Fail Reset" from 'http://drupal.org/project/http_request_fail_reset' and enable it.


Step:3
+++++
You will find a 'Proxy Server' link under Home / Administer / Site configuration


Enter proxy details and save your configurations !!!!!!!

51 comments:

Anonymous said...

axotomarvex nike Reggie Wayne jersey
Reggie Wayne authentic jersey
T.Y. Hilton Womens Jersey
UnmannaSmurce

Anonymous said...

Ben Roethlisberger Jersey
Larry Foote Youth Jersey
Jason Pierre-Paul Blue Jersey
drydayoutraro

Anonymous said...

Earl Thomas White Jersey
Antrel Rolle White Jersey
Troy Polamalu Womens Jersey
drydayoutraro

Anonymous said...

ZesNiclesex Logan Paulsen Women's Jersey
Leonard Hankerson Women's Jersey
www.officialnikeredskinsshop.com/redskins_robert_griffin_iii_womens_jersey-c-9_35.html
nutWhororog

Anonymous said...

Eli Manning Pink Jersey
Ben Roethlisberger Jersey
12th Fan Jersey
drydayoutraro

Anonymous said...

Biansioni Jason Pierre-Paul Youth Jersey Antonio Brown Womens Jersey Tramon Williams Womens Jersey

Anonymous said...

efinitely another type of year, Chicago Jonathan Toews claimedShare your answer It has a student population of over 32,000 students, of which over 9,000 are graduate studentsEvery football fan loves to have their hands on some cheap nfl jerseysThe only private clinic in the area is the Medical Specialist Centre in the new Khoury Building near Sheikh Zayed Road (340 9495)

Peyton Manning Jersey
Broncos Champ Bailey Jersey
julius peppers nike jersey

He is not only a few in MLB and in NFL players, but play only one in the two league all-star I can only put my focus on what I can control things Donning an reliable NFL jersey is in a way status and also displays a deeper amount of help for your team understanding that a part of the proceeds from the sale of the jersey goes to the group and to the NFL on their own so that they are able to pay out for excellent coaches, hunt for new expertise, and utilize good wanting cheerleaders between other things, which will make sure you the crowd Site visitors can find many types of vintage snapback hats, including NFL, NBA, MLB, NHL, and NCAA snapback hats and beanies In 1999 Taylor grabbed the first of his eight NFL interceptions

Anonymous said...

Only those that have made a drastic impact on the world of rock and roll are inducted into the Rock and Roll Hall of Fame. [url=http://www.mulberryhandbagssale.co.uk]Mulberry Bags[/url] This is a fun way to meet the players and get their autographs. [url=http://www.goosecoatsale.ca]canada goose online[/url] Nhmourxkx
[url=http://www.pandorajewelryvip.co.uk]pandora store[/url] Emlwebpgh [url=http://www.officialcanadagooseparkae.com]canada goose coats[/url] fapytfzdk

Anonymous said...

2hQsm ghd hair straighteners
wPzr cheap ugg boots uk
sVwl michael kors outlet
5eHfa GHD Australia
1iFmf burberry handbags
9yWsn ugg australia
3eBka ghd
0cAlm louis vuitton outlet
9lMrm michael kors handbags
4qJja ghd straightener
2bIjb ugg boots uk
8jWke discount nfl jerseys
5aLlx michael kors outlet
1oNbk Lisseur GHD
1fGxp discount ugg boots

Anonymous said...

kXfy coach outlet online
pAkw zXib michael kors
1bHcv cheap ugg boots
5dBrs chi flat iron
2aUmo michael kors handbags
3uVzh wholesale nfl jerseys
4yEwx coach outlet store
0iWau 2mOab ugg australia
1iKib 8xAcr michael kors purses
5vLtn nfl shop
6kNpu ghd planchas
7aTvz ugg store

Anonymous said...

buy tramadol cod tramadol online pharmacy - buy tramadol overnight cod

Anonymous said...

buy tramadol online tramadol purchase usa - buy tramadol 100

Anonymous said...

buy tramadol online buy tramadol online usa cheap - tramadol hcl 50 mg shelf life

Anonymous said...

buy tramadol online tramadol buying online legal - long does tramadol high last

Anonymous said...

tramadol online pharmacy get rid tramadol withdrawal - tramadol purchase online usa

Anonymous said...

xanax without prescription xanax 8mg - side effects of xanax 2mg

Anonymous said...

buy tramadol online tramadol hcl generic ultram - tramadol hcl mylan 50 mg

Anonymous said...

hello buy lunesta - buy lunesta online http://www.lunestaonlinesales.net/#buy-lunesta-online , [url=http://www.lunestaonlinesales.net/#buy-eszopiclone ]buy eszopiclone [/url]

Anonymous said...

generic xanax can xanax withdrawal kill you - drug interactions xanax hydrocodone

Anonymous said...

order xanax cheap 2mg xanax bars - alprazolam 0 5 mg bula

Anonymous said...

buy tramadol 100mg buy tramadol from usa - tramadol withdrawal rash

Anonymous said...

cialis tadalafil cialis price 5mg - cialis 5 mg best price

Anonymous said...

buy tramadol online buy tramadol australia online - tramadol high yahoo answers

Anonymous said...

order cialis online canada cheap cialis once a day - safe place buy cialis online

Anonymous said...

xanax online xanax online ireland - xanax dosage not working

Anonymous said...

HamVdd [url=http://www.cheap2airjordansshoes.com/]Air Jordans[/url] XqtKdb http://www.cheap2airjordansshoes.com/
TxsTgt [url=http://www.cheap4airjordansshoes.com/]Air Jordan[/url] KvmZbz http://www.cheap4airjordansshoes.com/
YwpHtz [url=http://www.cheap4nikeairjordans.com/]Air Jordan Shoes[/url] OtoZaf http://www.cheap4nikeairjordans.com/
WmnOgy [url=http://www.cheapnikeairjordans2.com/]Cheap Jordans[/url] FjfWwg http://www.cheapnikeairjordans2.com/
InpEhn [url=http://www.headphone2beatsbydre.com/]Solo Beats By Dre[/url] LmtYkw http://www.headphone2beatsbydre.com/
OeoAik [url=http://www.monsterbeats7beatsbydre.com/]Beats By Dre Pro[/url] FdcQsd http://www.monsterbeats7beatsbydre.com/
FusIuz [url=http://www.monsterbeats8beatsbydre.com/]Beats By Dre Earbuds[/url] BicHyl http://www.monsterbeats8beatsbydre.com/
EvoImq [url=http://www.headphones4beatsbydre.com/]Beats By Dre Earbuds[/url] LthYfa http://www.headphones4beatsbydre.com/

Anonymous said...

buy xanax buy xanax online no prescription mastercard - xanax and alcohol mixed together

Anonymous said...

xanax online does 1mg xanax feel like - generic equivalent of xanax

Anonymous said...

buy cialis super active cialis 5mg online usa - купить cialis риге

Anonymous said...

buy tramadol usa safe place order tramadol online - chewing 100mg tramadol

Anonymous said...

buy tramadol tramadol withdrawal leg cramps - buy tramadol online florida

Anonymous said...

ativan 2mg can overdose ativan fatal - buy lorazepam europe

Anonymous said...

http://reidmoody.com/#37982 ativan dosage back pain - ativan effexor withdrawal

Anonymous said...

order tramadol online without prescription tramadol hcl 50 mg can you get high - buy tramadol online 100mg

Anonymous said...

http://ranchodelastortugas.com/#61301 xanax pills effects - xanax bars illegal

Anonymous said...

Hi, [url=http://www.topamaxdirectonline.com/]generic topamax [/url] - topamax without prescription - topiramate without prescription http://www.topamaxdirectonline.com/.

Anonymous said...

1, Eszopiclone Price - lunesta no prescription http://www.lunestasleepaid.net/, [url=http://www.lunestasleepaid.net/] Lunesta Sale [/url]

Anonymous said...

4, [url=http://www.elainelok.com/]Isotretinoin Pills[/url] - Generic Accutane - cheap accutane online http://www.elainelok.com/ .

Anonymous said...

12, [url=http://piluladodiaseguinte.net/]Sumatriptan Online[/url] - Buy Sumatriptan - buy sumatriptan online no prescription http://piluladodiaseguinte.net/ .

Anonymous said...

Hi exceptional blog! Dοes running а blog such as thіѕ tаke a lot
οf worκ? I haνe absοlutеly no unԁeгstanԁіng оf
coԁіng but ӏ ωaѕ hοpіng to stаrt my
own blog in the neaг futuге.
Anуwaу, shοulԁ you havе any геcommendаtіons or tiρs for new blοg ownегs please shaгe.

I unԁerstand thiѕ іs off topіc neѵеrtheleѕs I just neeԁeԁ
to aѕk. Thanκs!

Ηеre is my blοg; raspberry ketone uk

Anonymous said...

Yοuг current poѕt has confirmed benefiсіal to us.
It’ѕ extrеmely educational аnԁ
you really aгe clearly extremely well-informed in thiѕ area.

You havе opened up mу own eуe to be able to
varying views on this partiсulaг tоpic аlong
ωith іntriguing, nοtable and гeliable wrіtten
сontent.

Here is my blog www.prarticles.com
My web site ... codeine

Anonymous said...

Incrediblе pointѕ. Outѕtаnding arguments.
Keep up the great effort.

Also vіsit my weblog freeze your credit card debt

Anonymous said...

buy generic tramadol no prescription order tramadol cash on delivery - tramadol red pill

Anonymous said...

Mind you, this wasn't like having a few too many drinks and having a hang over the next day. I, who stirred even with a distant snore few rooms away, actually wheeze like a pig. does effexor xr work. Beta blockers have been found to be an effective anxiety medication because it minimizes the physical symptoms brought about by panic disord effexor smelly urine. Purchase Cheap Venlafaxine Online Without Rx - Read More Here: [url=http://buyeffexoronlinepills.com#buy-cheap-effexor-without-rx]order effexor online[/url] 2003 effexor order, Order Cheap Venlafaxine Without a Prescription - buy effexor without prescription. effexor nausea help. 4- A fear of public speaking is quite common to people social anxiety disorder. effexor zomig interaction

Anonymous said...

The good news is there are many reliable choices to treat your anxiety. purchase Klonopin 2mg online without a prescription buy Clonazepam online without a prescription. Understand your anxiety: Just finding out more about your symptoms, and knowing that they are not harmful, can greatly reduce the severity o [url=http://www.buyklonopinonlinepills.com/#892107-purchase-cheap-clonazepam-no-prescription]buy Klonopin 0.5mg online[/url] She showed up to get tickets early and is fifth in line.

Anonymous said...

п»їAlternative Medicine For Depression - Is it the Right Choice For You? buy cheap ambien online without a prescription buy Zolpidem online no prescription. Rehabilitation is possible with therapy medications, relaxation techniques, behavioral therapy and breathing techniques. [url=http://www.ambienbuyonlinepills.com/#924531-buy-ambien-online-cheap]buy ambien online[/url] However, what they do not understand is that most anxiety attacks do not originate from a chemical imbalance in their brains.

Anonymous said...

Acknowledging they have this disorder is a step towards recovery. Something--if identified--will motivate you to be in action finding ways to have this experience in your life. taking ambien gabapentin. Try to read more and get more knowledge on anxiety related disorders and you would find it real easy to cope up with this illness. ambien cr available canada. Buy Ambien Without Prescription - Related Site: [url=http://www.ambienbuyonlinepills.com#purchase-ambien-no-rx]ambien cheap[/url] 1997 ambien- Ambien Insomnia Treatment, ambien buy. taking ambien for sleep. Hence hypnotherapy has the power to change your core and emotional beliefs. can take vicodin ambien together

Anonymous said...

Great Health Products. buy Tramadol online purchase generic Tramadol Ultram online 59 Per Pill, Bonus 12 FREE PILLS with all Orders, Fast Secure & Anonymous Worldwide Delivery. [url=http://www.onlinetramadolbuy.net/#256910-purchase-ultram-online-without-rx-cheap]order cheap Tramadol online without a prescription[/url] Remember Me

Anonymous said...

I all the time emaileԁ thіs webpage poѕt page to
all my сontаcts, because іf like to гeаԁ it next my fгiends ωill tοo.


my web blog; Cheap Auto Insurance Quote

Anonymous said...

Undeniably consideг that that you saіd. Your favorite
reason aрρeared to be at the nеt the simplest thing to keep in mіnd of.

I sаy to you, I definitely get annoуed whilst folks think about іssuеs that theу plаinly do not κnow about.
You controlled to hit the naіl uρon the toρ and outlіned out thе wholе thing ωithout havіng side-effеcts , people can
tаke a signal. Will likely be back to get more.
Thanks

Here is my blog ρost :: betfair

Anonymous said...

Order Generic Diazepam Buy Cheap Valium Online No Rx - Order Valium Without Prescription Cheap