Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is CURLOPT_FORBID_REUSE?

Tags:

php

curl

What exactly does FORBID_REUSE do in libcurl, specifically in the PHP implementation of CURL if there is any difference. I found documentation for it here: http://scriptbasic.com/html/texi/mod_curl/mod_curl_3.46.html, but that really doesn't help too much. It just says "if you don't know what you're doing, don't use it."

Well, I'd like to know what I'm doing.

like image 338
Explosion Pills Avatar asked Jul 15 '11 16:07

Explosion Pills


People also ask

What is Curl_easy_setopt?

curl_easy_setopt(3) is used to tell libcurl how to behave. By setting the appropriate options, the application can change libcurl's behavior. All options are set with an option followed by a parameter.

Does Curl reuse connection?

When setting up connections to sites, curl keeps old connections around for a while so that if the next transfer is done using the same host as a previous transfer, it can reuse the same connection again and thus save a lot of time. We call this persistent connections.


2 Answers

From the official documentation:

TRUE to force the connection to explicitly close when it has finished processing, and not be pooled for reuse.

Usually, multiple HTTP requests to the same web server are sent sequentially on the same TCP connection. This option disables that and makes curl open a new TCP connection for each HTTP request, presumably to deal with broken HTTP servers.

like image 97
phihag Avatar answered Sep 28 '22 06:09

phihag


TRUE to force the connection to explicitly close when it has finished processing, and not be pooled for reuse.

In my experience -- I've never had to use it. It's a step to preventing caching.

like image 37
wanovak Avatar answered Sep 28 '22 08:09

wanovak