CNT 4713 Lecture Notes - Lecture 3: Telnet, Hypertext Transfer Protocol, Dynamic Programming

107 views4 pages
School
Course
Professor

Document Summary

>you may supply name/e-mail to sites what cookies can be used for: >user session state (web e-mail) how to keep state : protocol endpoints: maintain state at sender/receiver over multiple transactions cookies: http messages carry state. Use a python script to telnet a cookie: #tel-cookie. py - generate input for telnet that includes cookie. Argv{1} is host {0}; argv{2} is get ; argv{3} is cookie. Python scripts can be used to perform dynamic programming for a web server. The only required field is the content-type followed by a blanck line followed by the page. It is better to include the content-length too. Headers from a request can be accessed from the environment variables in operating system. Here request header is cookie so the os variable is http_cookie. Import os module in order to access the request header. Import the cookie module in order to parse the cookie header. If http_cookie" in os. environ: cookie_string=os. environ. get( http_cookie") cookiejar = cookie. simplecookie() cookiejar. load(cookie_string)

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers