我可以在HTTP 请求
中制作自己的 header 吗?
例如
这是普通的 HTTP 请求
GET / HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT x.x; xx; rv:x.x.x.x) xxx Firefox/3.0.10 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: xx,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
这是带有我的“属性”的标题
GET / HTTP/1.1
Host: google.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT x.x; xx; rv:x.x.x.x) xxx Firefox/3.0.10 (.NET CLR 3.5.30729)
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: xx,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: windows-1250,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Name: John
我将在服务器响应中具有“属性”。我将在 HTTP header 中使用“attrubutes”而不是 session 属性...
顺便说一句,对不起我的英语...;)
最佳答案
您要重新发明 cookie 吗?
您知道,Cookie 就是这样。服务器在 header 中发送的值,客户端将随每个请求返回。
关于http - 我可以做我自己的 HTTP header 属性吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/875096/