Compile Error

Started by Midimaster, February 13, 2021, 07:36:36

Previous topic - Next topic

Midimaster

I just installed the BlitzMax NG 64bit on Windows 10 to test the BaH-libcurl. When I run expample #8 it works as expected. I can read the html-page in the OUTPUT-Window, but in the end I have this box on the screen:


What does this mean? What do I do wrong?

The Example8-Code:
Code (BlitzMax) Select
SuperStrict
' Connect to a website via HTTPS, using a certificate bundle.
'
Framework BaH.libcurl
Import BRL.StandardIO
Import BRL.FileSystem

Local curl:TCurlEasy = TCurlEasy.Create()

curl.setWriteString()
curl.setOptInt(CURLOPT_VERBOSE, 1)
curl.setOptInt(CURLOPT_FOLLOWLOCATION, 1)

curl.setOptString(CURLOPT_CAINFO, "cacert.pem") ' the cert bundle
curl.setOptString(CURLOPT_URL, "https://www.schuh-heyder.de")

Local res:Int = curl.perform()

If res Then
Print CurlError(res)
End
End If

curl.cleanup()
Print curl.toString()


The Output-Window (removed the html-page content):
Building ex_08
[ 90%] Processing:ex_08.bmx
[ 95%] Compiling:ex_08.bmx.gui.debug.win32.x64.c
[100%] Linking:ex_08.debug.exe
Executing:ex_08.debug.exe
*
* Rebuilt URL to: https://www.schuh-heyder.de/
*   Trying 217.160.0.5...
* TCP_NODELAY set
* Connected to www.schuh-heyder.de (217.160.0.5) port 443 (#0)
* mbedTLS: Connecting to www.schuh-heyder.de:443
* mbedTLS: Set min SSL version to TLS 1.0
* mbedTLS: Handshake complete, cipher is TLS-ECDHE-RSA-WITH-AES-128-GCM-SHA256
* Dumping cert info:
* cert. version     : 3
* serial number     : 07:66:F1:7C:E6:AE:9F:CF:6B:2D:B6:26:32:34:60:1D
* issuer name       : C=US, O=DigiCert Inc, OU=www.digicert.com, CN=Encryption Everywhere DV TLS CA - G1
* subject name      : CN=*.schuh-heyder.de
* issued  on        : 2020-12-18 00:00:00
* expires on        : 2021-12-17 23:59:59
* signed using      : RSA with SHA-256
* RSA key size      : 2048 bits
* basic constraints : CA=false
* subject alt name  : *.schuh-heyder.de, schuh-heyder.de
* key usage         : Digital Signature, Key Encipherment
* ext key usage     : TLS Web Server Authentication, TLS Web Client Authentication
* SSL connected
GET / HTTP/1.1
Host: www.schuh-heyder.de
Accept: */*

< HTTP/1.1 200 OK
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Keep-Alive: timeout=15
< Date: Sat, 13 Feb 2021 07:20:27 GMT
< Server: Apache
< X-Powered-By: PHP/7.4.15
<
* Connection #0 to host www.schuh-heyder.de left intact

Process complete
...back from Egypt

Derron

The error message possibly comes from libcurl (some output from there) - as it seems to compile fine and the error happens on "execution" ?

so maybe the "error" is something "libcurl" spits out ... but "maxide" reads from the "stderr" pipe (the text stream for error messages - compared to stdout, for normal "output").


I assume doing the same without the "bundle" stuff (just reading eg the https://www.syntaxbomb.com website) works without the error?


bye
Ron

Derron

curl.setOptInt(CURLOPT_VERBOSE, 1)

-> remove that and the compile error message is gone. So it has to do with a message curl prints out.


bye
Ron

Derron

You could also keep it in - and do your own debug-func (replaces the original one - which outputs your stuff I think).

Code (Blitzmax) Select

SuperStrict

' Connect to a website via HTTPS, using a certificate bundle.
'
'

Framework BaH.libcurl
Import BRL.StandardIO
Import BRL.FileSystem

Local curl:TCurlEasy = TCurlEasy.Create()

curl.setWriteString()
curl.setOptInt(CURLOPT_VERBOSE, 1)
curl.setOptInt(CURLOPT_FOLLOWLOCATION, 1)
'register your own debug callback - to disable the message you encountered
curl.setDebugCallback(myCurlDebugFunc)

curl.setOptString(CURLOPT_CAINFO, "../certificates/cacert.pem") ' the cert bundle

curl.setOptString(CURLOPT_URL, "https://www.google.co.uk")

Local res:Int = curl.perform()

If res Then
Print "error: "
Print CurlError(res)
End
End If

curl.cleanup()

'Print curl.toString()



Function myCurlDebugFunc:Int(data:Object, msgType:Int, message:String)
Select msgType
'Case CURLINFO_TEXT       Print "msgType: TEXT"
'Case CURLINFO_HEADER_IN  Print "msgType: HEADER_IN"
'Case CURLINFO_HEADER_OUT Print "msgType: HEADER_OUT"

'curl read some data from remote (eg webpage content
'Case CURLINFO_DATA_IN    Print "msgType: DATA_IN"; Print "data: " +message
End Select

'must return 0
Return 0
End Function




bye
Ron