More Rewrite Request Within SocketServer?

J

John Abel

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 <[email protected]>
To: (e-mail address removed)



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
 
P

Paul Rubin

John Abel said:
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?
 
J

John Abel

Paul said:
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
 
P

Paul Rubin

John Abel said:
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.
 
J

John Abel

Paul said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,120
Latest member
ShelaWalli
Top