Question about wsgi.input

inhahe inhahe at gmail.com
Mon May 26 15:21:19 EDT 2008


I'm sorry if this is off-topic, i couldn't find a mailing list OR forum for 
WSGI (and #wsgi wasn't very helpful).

i played around with StringIO, and apparently if you write to a stringio the 
position gets set to the end of the write, so if you read from it again, 
without using seek, you won't read what comes next, you'll skip to the end 
of the write.  and if you write without seeking to the end first, you'll 
overwrite part of the string if the reading hasn't caught up.

WSGI says that wsgi.input should block if there's more data to be read from 
the socket, until that data is available. so when the server writes to the 
file object, what happens to the file position? if i were writing a WSGI 
app, i would just seek() to the last place my read ended at just to make 
sure.  but i'm making a server, so i need to know whether i should leave the 
position at the end of the write, when it blocks (or for that matter, if i'm 
writing while it's still reading), or at the end of the previous read?

thanks for any help.








More information about the Python-list mailing list