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

Added function to set global curl-options #130

Merged
merged 1 commit into from
Feb 12, 2016
Merged

Added function to set global curl-options #130

merged 1 commit into from
Feb 12, 2016

Conversation

wachterjohannes
Copy link
Contributor

Added possibility to set global curl-options. Sulu has some problems with the curl-connection cache. At some points jackrabbit seems to crash when reusing a connection. I have added the CURLOPT_FORBID_REUSE option to curl-handler and it seems to work. according to @dantleech we decided to add a function which allows to add curl-options to the client (which would replace the force-http-version).

Link to a failing testcase: https://travis-ci.org/sulu-io/sulu/jobs/107715661#L952

@wachterjohannes wachterjohannes changed the title Added curl-options and deprecated forceHttpVersion10 Added function to set global curl-options Feb 8, 2016
@wachterjohannes
Copy link
Contributor Author

@lsmith77 @dbu @dantleech what do you think?

@lsmith77
Copy link
Member

lsmith77 commented Feb 8, 2016

looks good to me

if ($forceHttpVersion10) {
$this->addCurlOptions(array(CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_0));
} elseif (array_key_exists(CURLOPT_HTTP_VERSION, $this->curlOptions)) {
unset($this->curlOptions[CURLOPT_HTTP_VERSION]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for the array_key_exists check, just unset right away. unsetting something that does not exist is no error.

@dbu
Copy link
Member

dbu commented Feb 8, 2016

+1.

version two of jackalope-jackrabbit should use the HTTPlug client abstraction layer instead of requiring a specific version of guzzle... once we have that, users could use the HTTPlug plugins to do such things and the code on our side will be simplified a lot.

@wachterjohannes
Copy link
Contributor Author

@dbu this would be great. i will test this on sulu to be sure that everything is fine. should i also add a testcase for that? would it be possible to release that as a hotfix?

@dbu
Copy link
Member

dbu commented Feb 8, 2016

i think the option is here mostly because testing reveiled problems with that http 1.0 option. so we do have a bit of tests. if you have ideas for more testing, sure. but i hope we eventually get to version 2 and then those tests become obsolete, so its not that important.

can you simplify that unset call? then its ready to merge, once you confirm it works in sulu. and we can tag a patch version, sure.

@wachterjohannes
Copy link
Contributor Author

@dbu i have to be sure that i can inject the parameter from droctrine-phpcr bundle but i am on the way and i think i can finish the PR before lunch (:

@wachterjohannes
Copy link
Contributor Author

@dbu now this should be ready

@@ -44,6 +44,7 @@ class RepositoryFactoryJackrabbit implements RepositoryFactoryInterface
'jackalope.logger' => 'Psr\Log\LoggerInterface: Use the LoggingClient to wrap the default transport Client',
Session::OPTION_AUTO_LASTMODIFIED => 'boolean: Whether to automatically update nodes having mix:lastModified. Defaults to true.',
'jackalope.jackrabbit_force_http_version_10' => 'boolean: Force HTTP version 1.0, this can in solving problems with curl such as https://github.com/jackalope/jackalope-jackrabbit/issues/89',
'jackalope.jackrabbit_curl_options.*' => 'mixed: Additional global curl-options',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would prefer a single option jackalope-jackrabbit_curl_options that contains a hashmap. then users can also use the curl constants to define the options. and you don't need the loop to extract and separate options.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i also thought about that but the current doctrine phpcr-bundle cannot handle this. there you have to define the parameters as an array of scalar https://github.com/doctrine/DoctrinePHPCRBundle/blob/master/DependencyInjection/Configuration.php#L165

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a separate configuration map for curl options then? the bundle config does not need to mirror the internal structure of jackalope.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you think that i should should move this functionality into the bundle?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would add a separate arrayNode next to parameters and call it curl_options. then the DI extension class would gather that information and put the array into that field of $parameters.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good i also will create a PR there

@dbu
Copy link
Member

dbu commented Feb 8, 2016

@lsmith77 how should we handle release management with this one? master is at 1.3 and has the version label feature. 1.2.2...master same with jackalope itself jackalope/jackalope@1.2.7...master

we could start a 1.2 branch from 1.2.7 and make this PR version 1.2.8 - but i feel its not a bugfix so it should go to master. but we probably don't want to release jackalope 1.3 right away, or do we?

@lsmith77
Copy link
Member

lsmith77 commented Feb 8, 2016

I agree this is a feature so it should go into 1.3
As for 1.3 release timing .. I think we do not have to needlessly wait either .. lets not wait until we have enough features but more wait a few months until we make a new minor release increase regardless of how many new features there are.

@wachterjohannes
Copy link
Contributor Author

hmm this sounds good but we should have this feature soon to fix our tests (:

@dbu
Copy link
Member

dbu commented Feb 8, 2016

agreed. @wachterjohannes you could also depend on jackalope 1.3@dev until its released, would that work?

@wachterjohannes
Copy link
Contributor Author

i currently try to configure our composer that we can go to dev-master.

@dbu
Copy link
Member

dbu commented Feb 8, 2016

@wachterjohannes as the branch alias is at 1.3, you should use 1.3.*@dev rather than dev-master. otherwise your users might be in for a confusing update once 1.4 or 2.0 exists (which at that point will be dev-master).

@dbu
Copy link
Member

dbu commented Feb 8, 2016

so last thing to wrap this up: can you please add a line to CHANGELOG.md ? then we are good to merge!

@lsmith77 lsmith77 added review and removed wip/poc labels Feb 8, 2016
dbu added a commit that referenced this pull request Feb 12, 2016
Added function to set global curl-options
@dbu dbu merged commit d4da5a9 into jackalope:master Feb 12, 2016
@lsmith77 lsmith77 removed the review label Feb 12, 2016
@dbu
Copy link
Member

dbu commented Feb 12, 2016

cool, thanks!

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.

3 participants