socket policy flash help

Piet van Oostrum piet at cs.uu.nl
Sat Aug 1 07:52:16 EDT 2009


>>>>> NighterNet <darkneter at gmail.com> (N) wrote:

>N> I need help on the policy to able to let access to user to the server
>N> once the policy access is finish. I been trying to find a good
>N> example, but I got no luck. Using python version 3.1.

>N> Here the code I tested but it not working.

>N> if str(buff) == str("b\'<policy-file-request/>\\x00\'"):

What is buff supposed to contain here? I assume a byte sequence?
Do you reaaly mean that buff[0] contains the byte 'b' and buff[1]
contains a single quote? And the last byte also a single quote? And the
four bytes with \ x 0 0 before that instead of a null byte? In total 29 bytes?

Or did you mean just the 23 bytes long b'<policy-file-request/>\x00'?

Maybe it should be if buff == b'<policy-file-request/>\x00':

>N> 				print ('policy FOUND >>> sending...')
>N> 				rawinput = str('<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>')

The str here is unnecessary as you have already a string.

>N> 				print (rawinput)
>N> 				b = bytes ( ord(c) for c in rawinput)

Why not 
b = b'<?xml version=\"1.0\"?><cross-domain-policy><allow-access-from domain=\"*\" to-ports=\"*\" /></cross-domain-policy>' ?

>N> 				self.sockfd.send(b);

-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list