A very rough pseudo code is as follows:

await readcmdline()
# inside: await readline() then parse http request line: cmd , url, ver

await readheads()
# loop with readline again. Then use email module to parse.

content-length = heads['content-length']
# note that "heads" is a headers only email message as recommended above.

# Normally you should do this:
await readbody(content-length)
parsepostparameters() # use urllib.parse.parse_qs

# However if your focus is on large data then you should
# customize above two lines so that while you are
# reading you should simultenously pipe/dump the data
# to where you'll use/store.

sendminimalresponse()  # Be nice.

Of course above recommendation is valid IF
your client is some kind of a browser and POSTs
just by content-length. As a non standand
possibility, the client may post using "Chunked" transfer
(which is more appropriate for large data). Then you
should readbody in chunks.

Regards,
Imran


On 11/2/15, Anupam Gupta <[email protected]> wrote:
> i am new to python asyncio . i want to read and data from a post request .
> when data is in large amount ,
> My  code is receiving an empty data from reader.read() function
> please suggest me some way to read bulk data in one shot.

Reply via email to