Skip to content

BUG: Cookies with ! context value #31

@NabiKAZ

Description

@NabiKAZ

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": ';...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions