473,406 Members | 2,352 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

checking invalid urls with ssl + python 2.1.3 on linux/windows

Hi,

I'm trying to do a simple link checking for python 2.1.3 (compiled from
source on linux), but it fails when I use an invalid ssl url. For
example: I have zope without ssl running on port 8080, if I do this on
the browser's address bar:

https://my_ip:8080 --> The https is intentional

mozilla on linux and IE on windows, take a long time till a timeout
occurs. I tried to check this timeout with the timeoutsocket.py (version
1.23, the latest I could find) on linux, but it hangs:

import timeoutsocket
import smtplib
import urllib2

timeoutsocket.setDefaultSocketTimeout(5)
urllib2.urlopen('https://my_ip:8080')

Same happens with:

import httplib
import timeoutsocket
import smtplib

timeoutsocket.setDefaultSocketTimeout(5)
connection=httplib.HTTPSConnection('my_ip:8080')
connection.request('GET','/')

I searched on the newsgrous and found that timeoutsocket doesn't work
with ssl sockets. So, I tried with signal alarms and the httplib and it
succeeded on linux, but it doesn't work on windows because this os lacks
of "signal.SIGALRM" :-(. I now about "socket.setdefaulttimeout", but
this is a new feature and it doesn't exist on python 2.1.3 and I have to
provide compatibility to this version (zope 2.6.x uses it).

Finally I found a message from Geoffrey Talvola, where he said that he
has a patch which corrects this, but unfortunatelly I tried to contact
him without any success. Does any body has such patch or perhaps a
better idea of how to solve this problem?

Regards,
Josef
Jul 18 '05 #1
1 2092
Josef Meile wrote:

[snip]

I searched on the newsgrous and found that timeoutsocket doesn't work
with ssl sockets. So, I tried with signal alarms and the httplib and it
succeeded on linux, but it doesn't work on windows because this os lacks
of "signal.SIGALRM" :-(. I now about "socket.setdefaulttimeout", but
this is a new feature and it doesn't exist on python 2.1.3 and I have to
provide compatibility to this version (zope 2.6.x uses it).


I gave up, I tried everything from timeoutsocket till threads, but it
always hangs. Even with threads, it doesn't matter if they are set as
daemons, the main thread will wait till the child threads are finished,
thing that doesn't happen, so it just hangs. I search several
alternatives and found that it is not a timeoutsocket problem. It seems
to be a bug on the ssl sockets of 2.1.3. So, I guess I will have to
avoid https url checking with this old python.

Regards,
Josef
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Mickel Grönroos | last post by:
Hi all, I have a silly question. Is there are simple way to check if the computer is connected to the Internet? It seems this should be a pretty straight-forward thing to do, but as I am totally...
2
by: Tim Williams | last post by:
I'm trying to write a simple python program to access a MySQL database. I'm having a problem with using MySQLdb to get the results of a SQL command in a cursor. Sometimes the cursor.execute works,...
2
by: George Sakkis | last post by:
I downloaded the latest Komodo (3.1) and configured it for python 2.4 so that it doesn't show decorators and genexps as syntax errors, but background syntax checking doesn't seem to work at all for...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
6
by: sviau | last post by:
since rewriting our site from asp to asp.net, weve receveid many complaints from users stating that they get invalid urls, and cant access certain pages of our site nothing has changed in our...
1
by: crybaby | last post by:
I wrote a python code in linux text pad and copied to thumb drive and try to ran the file by changing the path to windows: sys.path = sys.path + I get the following error: ValueError:...
1
by: M.-A. Lemburg | last post by:
On 2008-07-25 08:13, python@bdurham.com wrote: Yes. But then Intel Itanium is being phased out anyway and the AMD64 build works on both Intel and AMD processors. True.
1
by: rpupkin77 | last post by:
Hi, I have written this script to run as a cron that will loop through a text file with a list of urls. It works fine for most of the links, however there are a number of urls which are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.