Skip to content

Commit

Permalink
Merge pull request #172 from modulec/master
Browse files Browse the repository at this point in the history
fixed timeout values for python 2.4
  • Loading branch information
jbuchbinder committed Jan 27, 2015
2 parents f897bf3 + f970f77 commit a53b568
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions apache_status/python_modules/apache_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
import traceback
import re
import copy
import sys
import socket

if sys.version_info < (2, 6):
socket.setdefaulttimeout(2)

# global to store state for "total accesses"
METRICS = {
Expand Down Expand Up @@ -68,7 +73,10 @@ def get_metrics():
req = urllib2.Request(SERVER_STATUS_URL + "?auto")

# Download the status file
res = urllib2.urlopen(req, None, 2)
if sys.version_info < (2, 6):
res = urllib2.urlopen(req)
else:
res = urllib2.urlopen(req, timeout=2)

for line in res:
split_line = line.rstrip().split(": ")
Expand All @@ -93,7 +101,10 @@ def get_metrics():
req2 = urllib2.Request(SERVER_STATUS_URL)

# Download the status file
res = urllib2.urlopen(req2, None, 2)
if sys.version_info < (2, 6):
res = urllib2.urlopen(req2)
else:
res = urllib2.urlopen(req2, timeout=2)

for line in res:
regMatch = SSL_REGEX.match(line)
Expand Down

0 comments on commit a53b568

Please sign in to comment.