HTTP theory question

I read RFC6262 and did not quite understand how to correctly encode the value of a cookie. There is a script that communicates with the site and there is a cookiename cookie with the value: a=1&b=c , therefore I have to send to the site side:

 Cookie: cookiename=... 

As options:

  • a=1&b=c i.e. leave the string as it is (and re-encode the characters \ x0- \ x20, ';')
  • a%3D1%26b%3Dc
  • "a=1&b=c"

What happens if you need to transcode the value hello, world! ?

  • hello%20%2Cworld%21
  • "hello, world!"

    1 answer 1

    You can translate an array with parameters in JSON.

    • Of course, you can, and urlencode, but wondered how it should be according to the standard? The question is not how my site should lead, but how can I emulate the behavior of a browser? - chernomyrdin