473,322 Members | 1,846 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,322 software developers and data experts.

More Rewrite Request Within SocketServer?

OK, I'm guessing what I was after ( see below ) isn't possible. Does
anyone know of an easy way of having verify_request inform the request
handler of certain events, say client is unauthorised? I thought of
having it set a flag, and referring to it from the handler class (
self.server.hostAllowed for example ), but that wouldn't work quite
right in a threaded server.

Any ideas?

J

-------- Original Message --------
Subject: ReWrite Request Within SocketServer?
Date: Wed, 25 May 2005 17:04:53 +0100
From: John Abel <ja***@plus.net>
To: py*********@python.org

Hi!

I may be missing something simple, but is there a way to have
verify_request change the request before it gets processed by the
RequestHandlerClass?

Regards

J
--
http://mail.python.org/mailman/listinfo/python-list

Jul 19 '05 #1
4 1414
John Abel <ja***@plus.net> writes:
OK, I'm guessing what I was after ( see below ) isn't possible. Does
anyone know of an easy way of having verify_request inform the request
handler of certain events, say client is unauthorised? I thought of
having it set a flag, and referring to it from the handler class (
self.server.hostAllowed for example ), but that wouldn't work quite
right in a threaded server.


I'd think you could do that. Isn't the new thread already started
when the verify method runs?
Jul 19 '05 #2
Paul Rubin wrote:
John Abel <ja***@plus.net> writes:

OK, I'm guessing what I was after ( see below ) isn't possible. Does
anyone know of an easy way of having verify_request inform the request
handler of certain events, say client is unauthorised? I thought of
having it set a flag, and referring to it from the handler class (
self.server.hostAllowed for example ), but that wouldn't work quite
right in a threaded server.


I'd think you could do that. Isn't the new thread already started
when the verify method runs?

Unfortunately not. verify_request is called before process_request
which launches the thread ( in the ThreadingMixIn version ). Unless I
passed the flag as an argument to the thread, and then had it reset.
Hmmmmm, worth thinking about,

J
Jul 19 '05 #3
John Abel <ja***@plus.net> writes:
Unfortunately not. verify_request is called before process_request
which launches the thread ( in the ThreadingMixIn version ). Unless I
passed the flag as an argument to the thread, and then had it reset.
Hmmmmm, worth thinking about,


If verify_request is finished before the new thread starts, then I'd
think it could set a flag and the new thread could find it. You get a
race condition only if both threads are trying to mess with the flag
simultaneously.
Jul 19 '05 #4
Paul Rubin wrote:
If verify_request is finished before the new thread starts, then I'd

think it could set a flag and the new thread could find it. You get a
race condition only if both threads are trying to mess with the flag
simultaneously.

Hmm, I think you're right. Thanks!

J
Jul 19 '05 #5

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

Similar topics

4
by: lebo | last post by:
So I'm new to this python stuff - and this has me stumped # server import SocketServer PORT = 8037 class myRequestHandler(SocketServer.StreamRequestHandler): def handle(self): self.input...
2
by: Daniel Greenblatt | last post by:
Has anyone used the SocketServer.py module successfully on windows? I don't know if I'm doing something terribly wrong, here but I use a SocketServer in my app, running it in a seperate thread,...
3
by: Olivier Hoarau | last post by:
Hello, I have build a client/server application with the socket module. The server mades UDP broadcasting and the client only reads UDP broadcast messages. All work fine. Now I want to use for...
5
by: missiplicity | last post by:
Hi, I am newbie to Python language and am taking my baby steps. I am using Python2.4 from ActiveState on W2K. I am trying to create a simple SocketServer program. Just adding the following 2 lines...
0
by: John Abel | last post by:
Hi! I may be missing something simple, but is there a way to have verify_request change the request before it gets processed by the RequestHandlerClass? Regards J
5
by: scripteaze | last post by:
ok, im new to this sort of coding so excuse me if im not exactly sure as to what i need to pull this off. I need to be able to send a rip1 request to my rip1 enabled device., so i need python to...
2
by: John Salerno | last post by:
I'm now experimenting with the SocketServer class. Originally I subclassed the StreamRequestHandler to make my own custom handler, but a result of this seems to be that the client socket closes...
1
by: Okko Willeboordse | last post by:
All, With Python 2.5 SocketServer features the shutdown method that can be called from another thread to stop the serve_forever loop. However; When the shutdown method is called before...
1
by: Okko Willeboordse | last post by:
Hello, SocketServer.ThreadingTCPServer accepts connections (clients can connect) before and after it's server_forever method is called, see below for an example. IMHO it should only accept...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.