Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Cookies with ! context value #31

Open
NabiKAZ opened this issue Sep 3, 2020 · 0 comments
Open

BUG: Cookies with ! context value #31

NabiKAZ opened this issue Sep 3, 2020 · 0 comments

Comments

@NabiKAZ
Copy link
Contributor

NabiKAZ commented Sep 3, 2020

When have a ! char (or maybe similar chars) in the cookies (Cookie: FOO=BAR!BAZ), the chrome Copy as cURL(bash) menu return be like this:

curl 'http://example.com/' \
  -H $'Cookie: FOO=BAR\u0021BAZ' \
  --compressed

When I use that in the https://incarnate.github.io/curl-to-php/ url, see:

// Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/
$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, 'http://example.com/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'GET');
curl_setopt($ch, CURLOPT_ENCODING, 'gzip, deflate');

$headers = array();
$headers[] = $_ENV["'Cookie": ';
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

$result = curl_exec($ch);
if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
}
curl_close($ch);

You can see appears a syntax bug in $headers[] = $_ENV["'Cookie": ';...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant