473,788 Members | 2,744 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.p y (version
1.23, the latest I could find) on linux, but it hangs:

import timeoutsocket
import smtplib
import urllib2

timeoutsocket.s etDefaultSocket Timeout(5)
urllib2.urlopen ('https://my_ip:8080')

Same happens with:

import httplib
import timeoutsocket
import smtplib

timeoutsocket.s etDefaultSocket Timeout(5)
connection=http lib.HTTPSConnec tion('my_ip:808 0')
connection.requ est('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.setdefa ulttimeout", 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 2116
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.setdefa ulttimeout", 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
4979
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 unfamiliar with sockets and such, I ask for your help before getting my hands dirty. Cheers, Mickel G.
2
5055
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, sometimes not. From mysql: mysql> show databases; +-----------+ | Database |
2
2058
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 python 2.4. Even for correct files, it shows a "Syntax checking error: Error checking syntax: retval = 128, stderr=" alert. For python 2.3 it works fine (modulo the new 2.4 syntax of course). Both 2.3 and 2.4 are built from source on Cygwin, not...
99
5199
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
6
6522
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 configuration except site being written in asp.net (from classic asp). the site is behind a Linux box with Squid 2.5 is there known issues between proxies and asp.net output..maybe with viewstate? underscores in url?
1
19338
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: invalid \x escape I am pretty sure this problem is due some kind of linux end of line
1
1817
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
1056
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 subdomains (they are government sites) such as http://basename.airforce.mil, these links are always throwing 400 errors even though the site exists. Is there a way to get around this?
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9498
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10177
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9969
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7519
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5538
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4074
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3677
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2897
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.