Jay S.
Jay S.

Reputation: 491

PHP cURL: Max Length on CURLOPT_USERPWD?

I have a simple GET request in PHP using cURL. It is using basic auth for authentication.

However when the {username}:{password} is longer than 266 characters, it appears to be getting truncated. I looked everywhere but haven't found any documentation stating this. Is it just me?

$data = curl_init($url);

curl_setopt($data, CURLOPT_USERPWD, $username . ":" . $password);
curl_setopt($data, CURLOPT_HTTPAUTH, CURLAUTH_ANY);

$results = curl_exec($data);

echo $results;

curl_close($data);

Upvotes: 4

Views: 608

Answers (1)

gries
gries

Reputation: 1143

I'm not a C expert but I found the following code in the CURL source (!NOT the php extension but the original curl) Looks like CURL only allocates 256byte for the password.

EDIT Removed the old code, because as Daniel Steinberg stated below this code is not used anymore.

Upvotes: 1

Related Questions