Re: curl-users Digest, Vol 172, Issue 8
Date: Sat, 14 Dec 2019 22:25:10 +0000
Re: libcurl binding for Fortran
To show my progress to date with calling libcurl for Fortran, here is the source code:
program test10
use, intrinsic :: iso_c_binding
implicit none
integer(kind = c_int) :: ierr
integer(kind = c_long) :: handle
interface
integer(kind = c_long) function curl_easy_init() bind(c, name="curl_easy_init")
import :: c_long
end function curl_easy_init
end interface
interface
integer(kind = c_int) function curl_easy_setopt(handle, curlopt_url, url) bind(C, name="curl_easy_setopt")
import :: c_int, c_long, c_char
integer(kind = c_long), value :: handle
character(len = 1, kind = c_char), dimension(*) :: curlopt_url
character(len = 1, kind = c_char), dimension(*) :: url
end function curl_easy_setopt
end interface
interface
integer(kind = c_int) function curl_easy_perform(handle) bind(C, name="curl_easy_perform")
import :: c_int, c_long
integer(kind = c_long), value :: handle
end function curl_easy_perform
end interface
interface
integer(kind = c_int) function curl_easy_cleanup(handle) bind(c, name="curl_easy_cleanup")
import :: c_int, c_long
integer(kind = c_long), value :: handle
end function curl_easy_cleanup
end interface
handle = curl_easy_init()
print *, 'curl_easy_init handle: ', handle
ierr = curl_easy_setopt(handle, c_char_"CURLOPT_URL" // c_null_char, c_char_"https://www.google.com" // c_null_char)
print *, 'curl_easy_setopt status code: ', ierr
ierr = curl_easy_perform(handle)
print *, 'curl_easy_perform status code: ', ierr
ierr = curl_easy_cleanup(handle)
print *, 'curl_easy_cleanup status code: ', ierr
end program test10
It seems that I am using the wrong types in CURL_EASY_SETOPT for 'curlopt_url' and 'url'. I am trying c_char, but perhaps it should be something else?
when I run the program I get teh following output -
curl_easy_init handle: 140736996444656
curl_easy_setopt status code: 48
curl_easy_perform status code: 3
curl_easy_cleanup status code: 0
Thanks,
JR
On Fri, Dec 13, 2019 at 12:00:05PM +0100, curl-users-request_at_cool.haxx.se wrote:
> Send curl-users mailing list submissions to
> curl-users_at_cool.haxx.se
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
> or, via email, send a message with subject or body 'help' to
> curl-users-request_at_cool.haxx.se
>
> You can reach the person managing the list at
> curl-users-owner_at_cool.haxx.se
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of curl-users digest..."
>
>
> Today's Topics:
>
> 1. libcurl binding for Fortran (jmriff_at_ma.sdf.org)
> 2. RE: Unable to parse ECDSA and ed25519 keys (Santino KEUPP)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Thu, 12 Dec 2019 12:14:29 +0000
> From: jmriff_at_ma.sdf.org
> To: curl-users_at_cool.haxx.se
> Subject: libcurl binding for Fortran
> Message-ID: <20191212121429.GA13608_at_ma.sdf.org>
> Content-Type: text/plain; charset=us-ascii
>
> Hi,
>
> I am running in to various issues trying to access libcurl functionality from gfortran - issues caused by my lack of knowledge about binding C to Fortran. Can someone please direct me to a example of Fortran source code that can be used to perform a simple libcurl API call: curl_easy_init --> curl_easy_setopt(handle, CURLOPT_URL, "http://domain.com/") --> curl_easy_perform --> curl_easy_cleanup.
>
> Thanks,
> JR
>
>
> ------------------------------
>
> Message: 2
> Date: Thu, 12 Dec 2019 15:51:37 +0000
> From: Santino KEUPP <Santino.Keupp_at_diehl.com>
> To: the curl tool <curl-users_at_cool.haxx.se>
> Subject: RE: Unable to parse ECDSA and ed25519 keys
> Message-ID:
> <40ff5512e24240d99c0e2380fc9ca348_at_RCDC-Mail12.corp.diehl.com>
> Content-Type: text/plain; charset="utf-8"
>
> It looks like I can fix my problem with the following patch:
>
> diff --git a/lib/vssh/libssh2.c b/lib/vssh/libssh2.c
> index c71cfbc9f..f13196f55 100644
> --- a/lib/vssh/libssh2.c
> +++ b/lib/vssh/libssh2.c
> @@ -466,8 +466,29 @@ static CURLcode ssh_knownhost(struct connectdata *conn)
> struct curl_khkey *knownkeyp = NULL;
> struct curl_khkey foundkey;
>
> - keybit = (keytype == LIBSSH2_HOSTKEY_TYPE_RSA)?
> - LIBSSH2_KNOWNHOST_KEY_SSHRSA:LIBSSH2_KNOWNHOST_KEY_SSHDSS;
> + switch(keytype) {
> + case LIBSSH2_HOSTKEY_TYPE_RSA:
> + keybit = LIBSSH2_KNOWNHOST_KEY_SSHRSA;
> + break;
> + case LIBSSH2_HOSTKEY_TYPE_DSS:
> + keybit = LIBSSH2_KNOWNHOST_KEY_SSHDSS;
> + break;
> + case LIBSSH2_HOSTKEY_TYPE_ECDSA_256:
> + keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_256;
> + break;
> + case LIBSSH2_HOSTKEY_TYPE_ECDSA_384:
> + keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_384;
> + break;
> + case LIBSSH2_HOSTKEY_TYPE_ECDSA_521:
> + keybit = LIBSSH2_KNOWNHOST_KEY_ECDSA_521;
> + break;
> + case LIBSSH2_HOSTKEY_TYPE_ED25519:
> + keybit = LIBSSH2_KNOWNHOST_KEY_ED25519;
> + break;
> + default:
> + keybit = LIBSSH2_KNOWNHOST_KEY_UNKNOWN;
> + break;
> + }
>
> #ifdef HAVE_LIBSSH2_KNOWNHOST_CHECKP
> keycheck = libssh2_knownhost_checkp(sshc->kh,
>
>
> Kind regards,
> Santino Keupp
>
> ______________________________________________________________________________________________________
> Vertraulichkeit
> Die uebermittelten Informationen sind ausschliesslich fuer den oben genannten Adressaten bestimmt. Jede Verwendung, Veroeffentlichung, Vervielfaeltigung ist untersagt. Falls diese Mitteilung bei Ihnen irrtuemlich eingegangen ist, geben Sie uns bitte sofort Bescheid.
> Confidentiality
> The information contained in these documents is intended for the exclusive use of the addressee designated above. Each disclosure, reproduction, distribution is strictly prohibited. If you have received this transmission in error please contact us immediately.
> Diehl Metering GmbH
> Donaustrasse 120
> 90451 Nuernberg
> Sitz der Gesellschaft: Ansbach, Registergericht: Ansbach HRB 69
> Geschäftsführer: Dr. Christof Bosbach (Sprecher), Thomas Gastner, Jean-François Marguet
> Informationen zum Datenschutz finden Sie auf unserer Homepage.
> https://www.diehl.com/metering/de/diehl-metering/data-protection
> Information about data protection can be found on our homepage.
> https://www.diehl.com/metering/en/diehl-metering/data-protection
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://cool.haxx.se/pipermail/curl-users/attachments/20191212/d4025865/attachment-0001.html>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> curl-users mailing list
> curl-users_at_cool.haxx.se
> https://cool.haxx.se/cgi-bin/mailman/listinfo/curl-users
>
>
> ------------------------------
>
> End of curl-users Digest, Vol 172, Issue 8
> ******************************************
-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2019-12-14