python - multiple send on httplib.HTTPConnection, and multiple read on HTTPResponse? -
should possible send plain, single http post request (not chunk-encoded), in more 1 segment? thinking of using httplib.httpconnection , calling send method more once (and calling read on response object after each send).
(context: i'm collaborating design of server offers services analogous transactions [series of interrelated requests-responses]. i'm looking simplest, compatible http representation.)
after being convinced friends should possible, found way it. override httplib.httpresponse (n.b. httplib.httpconnection nice enough let specify response_class instantiate).
looking @ socket.py , httplib.py (especially _fileobject.read()), had noticed read() allowed 2 things:
- read exact number of bytes (this returns immediately, if connection not closed)
- read bytes until connection closed
i able extend behavior , allow free streaming few lines of code. had set will_close member of httpresponse 0.
i'd still interested hear if considered acceptable or abusive usage of http.
Comments
Post a Comment