Linux   发布时间:2022-03-31  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了symfony – 如何在Mink中配置curl参数?大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

概述

我正在尝试将Behat带到https安全项目,并且在启动curl请求时mink失败. Scenario: Loggin in # features/debt.feature:6 Given I am on "/" # FeatureContext::visit()
我正在尝试将Behat带到https安全项目,并且在启动curl请求时mink失败.

Scenario: Loggin in                              # features/debt.feature:6
    Given I am on "/"                              # FeatureContext::visit()
      [curl] 51: SSL: certificate subject name 'ubuntu' does not match target host name 'wizard' [url] https://wizard/admin/dev.PHP/ [info] array (
        'url' => 'https://wizard/admin/dev.PHP/','content_type' => NULL,'http_code' => 0,'header_size' => 0,'request_size' => 0,'filetime' => -1,'ssl_verify_result' => 1,'redirect_count' => 0,'@R_299_10586@l_time' => 0.061943,'namelookup_time' => 0.000234,'connect_time' => 0.000344,'pretransfer_time' => 0,'size_upload' => 0,'size_download' => 0,'speed_download' => 0,'speed_upload' => 0,'download_content_length' => -1,'upload_content_length' => -1,'starttransfer_time' => 0,'redirect_time' => 0,'cerTinfo' => 
        array (
        ),) [debug] * About to connect() to wizard port 443 (#0)
      *   Trying 127.0.0.1... * connected
      * Connected to wizard (127.0.0.1) port 443 (#0)
      * successfully set certificate verify LOCATIOns:
      *   CAfile: none
        CApath: /etc/ssl/certs
      * SSL connection using DHE-RSA-AES256-SHA
      * Server certificate:
      *      subject: CN=ubuntu
      *      start date: 2011-05-23 08:26:04 GMT
      *      expire date: 2021-05-20 08:26:04 GMT
      * SSL: certificate subject name 'ubuntu' does not match target host name 'wizard'
      * Closing connection #0

通过设置这2个卷曲参数可以解决这个问题:

CURLOPT_SSL_VERIFYPEER = false
CURLOPT_CERTinFO = false

我知道Mink在内部使用guzzle,它会启动curl请求.如何使用curl选项正确实例化guzzle客户端?

解决方法

是的,它已知问题,现在唯一的解决方案是你的behat.yml:

default:
    paths:
        features: .
        bootstrap: %behat.paths.features%/bootstrap    
    extensions:
        Behat\MinkExtension\Extension:
            base_url: http://yourhost/
            goutte:
                guzzle_parameters:
                    ssl.certificate_authority: system
                    curl.options:
                        64: false   # CURLOPT_SSL_VERIFYPEER
                        172: false  # CURLOPT_CERTinFO

大佬总结

以上是大佬教程为你收集整理的symfony – 如何在Mink中配置curl参数?全部内容,希望文章能够帮你解决symfony – 如何在Mink中配置curl参数?所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。