-
Notifications
You must be signed in to change notification settings - Fork 34
Description
I try to use headers to send cookies, but encountered errors.
I boot two vmwares, running phearjs on Archlinux(192.168.190.133) and host it via supervisor and nginx, and I developed a simple LAMP on XUbuntu(192.168.190.128), which simulate my target visit server.
My env:
$ uname -a
Linux localhost 4.8.4-1-ARCH #1 SMP PREEMPT Sat Oct 22 18:26:57 CEST 2016 x86_64 GNU/Linux // archlinux
$ git log --pretty=oneline | head
52f17085994d1373d2247e19b622c9add8e49bf5 Use Pug instead of Jade
$ node -v
v6.9.1
$ phantomjs -v
2.1.1
I startup phearjs properly, and passed the README.md Example.
I paste the code encodeURIComponent(JSON.stringify({a: 1})) into chrome js console, and it says:
"%7B%22a%22%3A1%7D"
So I concat http://192.168.190.133/?fetch_url=http%3A%2F%2F192.168.190.128%2Fcookie-test.php&headers= with %7B%22a%22%3A1%7D:
http://192.168.190.133/?fetch_url=http%3A%2F%2F192.168.190.128%2Fcookie-test.php&headers=%7B%22a%22%3A1%7D
If I visit the url above, I would encounter:
{"success":false,"reason":"Malformed request headers."}
I noticed that %22 would change to double quota ", so I tried remove these double quota, using %7Ba%3A1%7D, visiting the url below:
http://192.168.190.133/?fetch_url=http%3A%2F%2F192.168.190.128%2Fcookie-test.php&headers=%7Ba%3A1%7D
And I encounter:
{"success":false,"reason":"Additional headers not properly formatted, e.g.: encodeURIComponent('{extra: \"Yes.\"}')."}
I guess I misunderstood the usage of headers parameter.
I appreciate any help, it would be great if anyone can give me an example illustrating how to use headers.
Thanks in advance!