DSP

cookie讲解-------浏览器种cookie

2019-07-13 17:03发布

1  responce添加Set-Cookie参数:  http request的返回responce为; [('Content-Type', 'application/x-javascript'), ('P3P', 'CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"'), ('Set-Cookie', 'bfdid=a3efd4ae5266805b00006b0d0000000152bd4c39; Domain=baifen.com; expires=Mon, 26-Dec-2016 09:45:29 GMT; Path=/'), ('Location', 'http://rtb.hahl.com/cm?bfd_cver=1&bfd_err=1&a=223')]
其中里边有: ('Set-Cookie', 'bfdid=a3efd4ae5266805b00006b150000000252bd4ce5; Domain=baifen.com; expires=Mon, 26-Dec-2016 09:48:21 GMT; Path=/')
2 注意事项; 种的域是  baifen.com,那么下次访问baifen.com时候,request会带上cookie 例如, {'HTTP_COOKIE': 'bfdid=a3efd4ae5266805b00006b120000000452bd4e39', 'SCRIPT_NAME': '', 'REQUEST_METHOD': 'GET', 'UWSGI_ROUTER': 'http', 'SERVER_PROTOCOL': 'HTTP/1.1', 'QUERY_STRING': 'bfd_nid=behe&a=223', 'HTTP_ACCEPT_CHARSET': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3', 'HTTP_USER_AGENT': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.97 Safari/537.22', 'HTTP_CONNECTION': 'keep-alive', 'SERVER_NAME': 'alg-1', 'REMOTE_ADDR': '192.168.3.60', 'wsgi.url_scheme': 'http', 'SERVER_PORT': '9033', 'uwsgi.node': 'alg-1', 'wsgi.input': , 'HTTP_HOST': 'www.baifen.com:9033', 'wsgi.multithread': False, 'REQUEST_URI': '/Mapping.do?nid=ad&a=223', 'HTTP_ACCEPT': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'wsgi.version': (1, 0), 'wsgi.run_once': False, 'wsgi.errors': , 'wsgi.multiprocess': True, 'HTTP_ACCEPT_LANGUAGE': 'en-US,en;q=0.8', 'uwsgi.version': '1.4.1', 'wsgi.file_wrapper': , 'HTTP_ACCEPT_ENCODING': 'gzip,deflate,sdch', 'PATH_INFO': '/Mapping.do'}