标签: libcurl

PHP - curl_exec挂起

我有一个奇怪的问题与下面的PHP函数.不幸的是,这是一个特殊的"仅生产"案例.

function requestPost($url, $data)
{
        set_time_limit(60);
        $output = array();
        $curlSession = curl_init();

        if($curlSession == false)
                syslog(LOG_INFO,"Falied to create a curl sessions");

        // Set the URL
        curl_setopt ($curlSession, CURLOPT_URL, $url);
        // No headers, please
        curl_setopt ($curlSession, CURLOPT_HEADER, 0);
        // It's a POST request
        curl_setopt ($curlSession, CURLOPT_POST, 1);
        // Set the fields for the POST
        curl_setopt ($curlSession, CURLOPT_POSTFIELDS, $data);
        // Return it direct, don't print it out
        curl_setopt($curlSession, CURLOPT_RETURNTRANSFER,1);
        // This connection will timeout in 30 seconds
        curl_setopt($curlSession, CURLOPT_TIMEOUT,30);
        //The next two …
Run Code Online (Sandbox Code Playgroud)

php apache curl libcurl

18
推荐指数
3
解决办法
9945
查看次数

如何在libcurl中启用https支持?

当我试图$ brew update收到错误时:

error: Protocol https not supported or disabled in libcurl while accessing https://github.com/mxcl/homebrew/info/refs?service=git-upload-pack
Run Code Online (Sandbox Code Playgroud)

但是,当我$ curl --version,我看到:

curl 7.21.4 (x86_64-apple-darwin12.2.0) libcurl/7.21.4 OpenSSL/0.9.8y zlib/1.2.5 libidn/1.20
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp 
Features: IDN IPv6 Largefile NTLM SSL libz 
Run Code Online (Sandbox Code Playgroud)

除非我遗漏了什么,否则这对我来说很好.请注意https协议列表中列出的内容.

$ which curl 产生可疑的回应:

/usr/local/php5/bin/curl
Run Code Online (Sandbox Code Playgroud)

嗯...也许brew是在使用不同的curl(就像那个/usr/bin/curl).让我们来看看:

$ /usr/bin/curl --version

curl 7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8y zlib/1.2.5
Protocols: …
Run Code Online (Sandbox Code Playgroud)

git homebrew libcurl

18
推荐指数
1
解决办法
5万
查看次数

libcurl中不支持或禁用协议https

我在我的应用程序中使用Authorize.net(在OSCOMMERCE中),当用户付款时返回空响应.我调试并发现它返回此错误:

libcurl中不支持或禁用协议https

我送探测器网址以https存在没有空间开始 https://secure.authorize.net/gateway/transact.dll

我在共享托管服务器中的应用 我怀疑这是服务器端问题还是编程问题?

php curl libcurl oscommerce

16
推荐指数
3
解决办法
4万
查看次数

libcurl消息和执行过程的含义

我正在使用libcurlabc-1.tar从服务器获取文件.我想知道libcurl显示此消息的显示的消息和执行的过程的含义.

例如:我提供了下面的一些消息,我知道基本消息的意思就像Content-Length意味着下载的文件长度等.

我想要所有消息的含义,特别是以*(例如Connection #0 to host (nil) left intact)开头的消息

* Re-using existing connection! (#0) with host (nil)
* Connected to (nil) (182.72.67.14) port 65101 (#0)
GET /...... HTTP/1.1
Host: 182.72.67.14:65101
Accept: */*
Connection:keep-alive
< HTTP/1.1 200 OK
< Cache-Control: private
< Content-Length: 186368
< Content-Type: application/x-tar
< Server: Microsoft-IIS/7.5
< Content-Disposition: attachment; filename=abc-1.tar
< X-AspNet-Version: 4.0.30319
< X-Powered-By: ASP.NET
< Date: Tue, 01 Oct 2013 06:29:00 GMT
< …
Run Code Online (Sandbox Code Playgroud)

c linux curl libcurl

16
推荐指数
2
解决办法
2万
查看次数

使用libcurl发送空HTTP标头

我想在我的HTTP数据包中添加一个空头.就像是:

Someheader:
Run Code Online (Sandbox Code Playgroud)

但我发现libcurl不支持这一点.他们通过将空标头与另一个标头连接来提出一种解决方法:

"Someheader:\r\nheader1: value"
Run Code Online (Sandbox Code Playgroud)

最新的libcurl是否提供另一种 - 更合适的 - 发送空标头的方法?

curl libcurl

16
推荐指数
1
解决办法
2336
查看次数

使用Curl在Windows 7中获取Https网页

我只需要获取一个https页面,我正在使用curl当前在我的Path中使用curl.exe应用程序并使用Perl文件调用它.但是,我收到错误"*libcurl中不支持或禁用协议https".我一直在四处寻找,我找不到一套可靠的指令来让它发挥作用.我已经安装了cygwin和OpenSSL-Win32,但有些东西告诉我,我将不得不从头开始编译curl.我没有这方面的经验.你怎么做呢?

windows perl curl cygwin libcurl

15
推荐指数
2
解决办法
2万
查看次数

C++无法传递非POD类型的对象

这是我的代码:

#include <iostream>
#include <fstream>
#include <cstdlib>
#include <stdio.h>
#include <curl/curl.h>
using namespace std;
int main ()
{
    ifstream llfile;
    llfile.open("C:/log.txt");

    if(!llfile.is_open()){
        exit(EXIT_FAILURE);
    }

    string word;
    llfile >> word;
    llfile.close();
    string url = "http://example/auth.php?ll=" + word;

    CURL *curl;
    CURLcode res;

    curl = curl_easy_init();
    if(curl) {
        curl_easy_setopt(curl, CURLOPT_URL, url);
        res = curl_easy_perform(curl);

        /* always cleanup */
        curl_easy_cleanup(curl);
    }
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

编译时这是我的错误:

的main.cpp | 29 |警告:不能通过非POD的对象类型'struct std::string'通过'...'; call将在运行时中止

c++ curl codeblocks libcurl

15
推荐指数
2
解决办法
3万
查看次数

libcurl中不支持或禁用协议"https"

这是我的Podfile内容:

platform :ios, ‘8.0’
use_frameworks!

target 'Project-Name' do

pod 'Firebase/Core'
pod 'Firebase/Messaging'

end
Run Code Online (Sandbox Code Playgroud)

添加pod 'GoogleMaps'到Podfile 时发生相同的错误.

pod install --verbose command在终端上运行时出错:

[!] Error installing Firebase
[!] /usr/local/bin/curl -f -L -o /var/folders/1t/102_4r0x1_3_5dlq8zdbm27r0000gn/T/d20160902-4388-1omozrn/file.tgz https://www.gstatic.com/cpdc/cc5f7aac07ccdd0a/Firebase-3.5.0.tar.gz --create-dirs --netrc-optional

curl: (1) Protocol "https" not supported or disabled in libcurl
Run Code Online (Sandbox Code Playgroud)

编辑1: 如何在Mac OS X上启用curl SSL?

./configure --with-darwinssl 不工作

-bash:./ configure:没有这样的文件或目录


编辑2: 如何在libcurl中启用https支持?

此命令brew install curl --with-libssh2在终端上执行,但不知道下一步该做什么:

UB:lib aspl$ brew install curl --with-libssh2 --verbose
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
No changes …
Run Code Online (Sandbox Code Playgroud)

macos google-maps libcurl ios firebase

15
推荐指数
2
解决办法
8118
查看次数

在多线程环境中使用libcurl会导致与DNS查找相关的非常慢的性能

你将不得不原谅相当大的代码块,但我相信这是对我的问题的近乎最小的再现.问题不是孤立的,example.com而是持续存在于许多其他网站上.

如果我有4个线程主动发出网络请求,curl工作100%罚款.

如果我再添加一个线程,该线程需要大约10倍的时间来执行.我觉得我必须错过一些明显的东西,但它现在逃脱了我.

更新更多信息:这些测试位于虚拟机中.与机器可用的内核数量无关,其中四个请求需要大约100毫秒,其余请求大约需要5500毫秒.

更新2:实际上,我在一个方面是错的,它并不总是4/ n-4分布 - 当我改为4核心时,有时我得到一个不同的结果分布(在1核上运行至少看起来相对一致) - 这里是一个当线程在4核VM上运行时返回其延迟(ms)而不是其http代码时的结果片段:

   191  191
   198  198  167
   209  208  202  208
   215  207  214  209  209
  5650  213 5649  222  193  207
   206  201  164  205  201  201  205
  5679 5678 5666 5678  216  173  205  175
  5691  212  179  206 5685 5688  211 5691 5680
  5681  199  210 5678 5663  213 5679  212 5666  428
Run Code Online (Sandbox Code Playgroud)

更新3:我从头开始构建curl和openssl,删除锁定(因为openssl 1.1.0g不需要它)并且问题仍然存在.(通过以下方式进行的完整性检查/验证):

std::cout << …
Run Code Online (Sandbox Code Playgroud)

c++ multithreading virtual-machine libcurl futex

15
推荐指数
1
解决办法
861
查看次数

cURL - 将输出放入变量?

我目前正在使用此C代码:

CURL *curl;
CURLcode res;

curl = curl_easy_init();
if (curl) {
    curl_easy_setopt(curl, CURLOPT_URL, "http://my-domain.org/");
    res = curl_easy_perform(curl);

    curl_easy_cleanup(curl);
}
Run Code Online (Sandbox Code Playgroud)

它在控制台上打印输出.我怎样才能得到相同的输出,但是把它读成一个字符串?(这可能是一个基本问题,但我还不了解libcurl API ......)

谢谢你的帮助!

麦克风

c libcurl

14
推荐指数
1
解决办法
1万
查看次数