Python Forum

Full Version: recive post request from client(browser) python sockets
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i am writing a simple webserver without using any libraries in python i am trying to recive a post request from the browser

HTML FILE

Output:
<form method="POST"> <input type="text" /> <input type="submit" /> </form>
python file

request = client_connection.recv(1024)
print request
so if i type HELLO WORLD! in the input box and press submit i get this response

Output:
POST / HTTP/1.1 Host: 127.0.0.1:8888 Connection: keep-alive Content-Length: 0 Cache-Control: max-age=0 Origin: http://127.0.0.1:8888 Upgrade-Insecure-Requests: 1 Content-Type: application/x-www-form-urlencoded User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.80 Safari/537.36 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 Referer: http://127.0.0.1:8888/ Accept-Encoding: gzip, deflate, br Accept-Language: en-US,en;q=0.9 Cookie: PHPSESSID=k2ae5h3v8esmiij1eu1mff7ju6; FAea2c25b156a4d770f5eb3b4a876d1c4a=n2nu253hf3bq8oduq4chvuk0i3
i can not find the word HELLO WORLD! anywhere

how can i read the post request in python

Stackoverflow-version
the name tag was missing i fixed it