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

Move Response building logic into separate function #193

Merged
merged 2 commits into from
Oct 26, 2015

Conversation

griffy
Copy link
Contributor

@griffy griffy commented Aug 3, 2015

This was done mainly to allow for an Httpful\Request to be used with curl_multi_exec like so:

$mh = curl_multi_init();
$requests = array(...);
foreach ($requests as $index => $request) {
    curl_multi_add_handle($mh, $request->_ch);
}

do {
    $status = curl_multi_exec($mh, $running);
} while ($status === CURLM_CALL_MULTI_PERFORM || $running);

$responses = array();
foreach ($requests as $index => $request) {
    $responses[$index] = $request->buildResponse(curl_multi_getcontent($request->_ch));
    curl_multi_remove_handle($mh, $request->_ch);
    curl_close($request->_ch);
}

Not sure if true curl_multi_exec support is desired or within the scope of Httpful, so this is a quick workaround for now.

nategood pushed a commit that referenced this pull request Oct 26, 2015
Move Response building logic into separate function
@nategood nategood merged commit ae8a698 into nategood:master Oct 26, 2015
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

Successfully merging this pull request may close these issues.

2 participants