Asked  7 Months ago    Answers:  5   Viewed   41 times

I am using Authorize.net in my application(its in OSCOMMERCE) , When the user making payment its returning empty response. I debugged and find that it returning this error:

Protocol https not supported or disabled in libcurl

I am sending a prober url starts with https there is no space in that https://secure.authorize.net/gateway/transact.dll

My application in shared hosting server. My doubt is this is server side problem or Programming problem ?

 Answers

87

Create a script called info.php and in it put <?php phpinfo(); ?>. Save it somewhere on your site so you can access it from a browser.

Find the curl section and check what Protocols are supported. If https is not listed, then cURL was not built with SSL support and you cannot use https.

You can also look in the very first section for Registered PHP Streams and see if https is listed. If so, then you can fallback to use PHP's socket functions or functions such as file_get_contents() or fopen with a context.

Since you mention you are on a shared host, request that your host recompile PHP so that both PHP and curl are built with OpenSSL support so you can use encryption, otherwise you will need to find another solution.

Wednesday, March 31, 2021
 
TheFrack
answered 7 Months ago
46

Thanks for all the responses, I've ended up with this PHP/cURL-script for caching images (needed by Flash apps to circumvent a missing crossdomain.xml) - seems to work ok with CentOS 5 Linux and php-5.1.6-27.el5:

<?php

define('MIN_SIZE', 512);
define('MAX_SIZE', 1024 * 1024);
define('CACHE_DIR', '/var/www/cached_avatars/');

$img = urldecode($_GET['img']);
# img sanity checks omitted here
$cached = CACHE_DIR . md5($img);

if (is_readable($cached)) {
        $finfo  = finfo_open(FILEINFO_MIME);
        $mime   = finfo_file($finfo, $cached);
        $length = filesize($cached);
        finfo_close($finfo);
} else {
        $writefh = fopen($cached, 'wb');
        if ($writefh) {
                flock($writefh, LOCK_EX);
                $ch = curl_init($img);
                curl_setopt($ch, CURLOPT_FILE, $writefh);
                curl_setopt($ch, CURLOPT_HEADER, FALSE);
                curl_setopt($ch, CURLOPT_REFERER, $matches[1]);
                curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
                curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE);
                curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE);
                curl_exec($ch);

                $error    = curl_errno($ch);
                $length   = curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD);
                $mime     = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
                $is_image = ($mime != NULL &&
                             (stripos($mime, 'image/gif') !== FALSE ||
                              stripos($mime, 'image/png') !== FALSE ||
                              stripos($mime, 'image/jpg') !== FALSE ||
                              stripos($mime, 'image/jpeg') !== FALSE));

                curl_close($ch);
                fclose($writefh);
                if ($error || $length < MIN_SIZE || $length > MAX_SIZE || !$is_image) {
                        unlink($cached);
                        exit('Download failed: ' . $img);
                }
        }
}

$readfh = fopen($cached, 'rb');
if ($readfh) {
        header('Content-Type: ' . $mime);
        header('Content-Length: ' . $length);

        flock($readfh, LOCK_SH);

        while (!feof($readfh)) {
                $buf = fread($readfh, 8192);
                echo $buf;
        }

        fclose($readfh);
}

?>
Wednesday, March 31, 2021
 
xenon
answered 7 Months ago
99

This was a bug in curl and fixed on 7.28.1 (according to this page http://curl.haxx.se/changes.html).

Note: Modern browsers doesnt send fragment part at the request. But your curl sending it, this is making difference.

Saturday, May 29, 2021
 
Oshrib
answered 5 Months ago
40

The underlying reason for the limitation is that Swift doesn't have first-class metatypes. The simplest example is that this doesn't work:

func isEmpty(xs: Array) -> Bool {
    return xs.count == 0
}

In theory, this code could work, and if it did there would be a lot of other types I could make (like Functor and Monad, which really can't be expressed in Swift today). But you can't. You need to help Swift nail this down to a concrete type. Often we do that with generics:

func isEmpty<T>(xs: [T]) -> Bool {
    return xs.count == 0
}

Notice that T is totally redundant here. There is no reason I should have to express it; it's never used. But Swift requires it so it can turn the abstract Array into the concrete [T]. The same is true in your case.

This is a concrete type (well, it's an abstract type that will be turned into a concrete type any time it's instantiated and P is filled in):

class ImplementProtocolA<P : ProtocolA>

This is a fully abstract type that Swift doesn't have any rule to turn into a concrete type:

class ImplementProtocolB : ImplementProtocolA<ProtocolB>

You need to make it concrete. This will compile:

class ImplementProtocolB<T: ProtocolB> : ImplementProtocolA<T> {}

And also:

class UserDemoPresenter<T: GetUserView> : Presenter {
    typealias V = T
}

Just because you're likely to run into the issue later: your life will go much easier if you'll make these structs or final classes. Mixing protocols, generics, and class polymorphism is full of very sharp edges. Sometimes you're lucky and it just won't compile. Sometimes it will call things you don't expect.

You may be interested in A Little Respect for AnySequence which details some related issues.


private var presenter : UserDemoPresenter<GetUserView>

This is still an abstract type. You mean:

final class Something<T: GetUserView> {
    private var presenter: UserDemoPresenter<T>
}

If that creates a problem, you'll need to create a box. See Protocol doesn't conform to itself? for discussion of how you type-erase so that you can hold abstract types. But you need to work in concrete types. You can't ultimately specialize on a protocol. You must eventually specialize on something concrete in the majority of cases.

Wednesday, July 28, 2021
 
tedders
answered 3 Months ago
49

Probably not what you want to hear, but they have known issues at the moment with ARM.

This workaround seems to work for me:

  • Directly download rustup-init from https://github.com/rust-lang-nursery/rustup.rs for your platform
  • env RUSTUP_USE_HYPER=1 ./rustup-init

It should also work to export RUSTUP_USE_HYPER=1 (assuming you aren't using tcsh) before running the rustup script, but the above is what I tested and used.

Tuesday, August 24, 2021
 
stbamb
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :