March 05, 2021, 07:38:11 PM

Author Topic: Compile Error  (Read 111 times)

Offline Midimaster

Compile Error
« on: February 13, 2021, 07:36:36 AM »
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
  1. SuperStrict
  2. ' Connect to a website via HTTPS, using a certificate bundle.
  3. '
  4. Framework BaH.libcurl
  5. Import BRL.StandardIO
  6. Import BRL.FileSystem
  7.  
  8. Local curl:TCurlEasy = TCurlEasy.Create()
  9.  
  10. curl.setWriteString()
  11. curl.setOptInt(CURLOPT_VERBOSE, 1)
  12. curl.setOptInt(CURLOPT_FOLLOWLOCATION, 1)
  13.  
  14. curl.setOptString(CURLOPT_CAINFO, "cacert.pem") ' the cert bundle
  15. curl.setOptString(CURLOPT_URL, "https://www.schuh-heyder.de")
  16.  
  17. Local res:Int = curl.perform()
  18.  
  19. If res Then
  20.         Print CurlError(res)
  21.         End
  22. End If
  23.  
  24. curl.cleanup()
  25. Print curl.toString()
  26.  

The Output-Window (removed the html-page content):
Code: [Select]
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
See my current project on PlayStore: 20Tracks-Audio-Player https://play.google.com/store/apps/details?id=midimaster.twentytrackd

Offline Derron

Re: Compile Error
« Reply #1 on: February 13, 2021, 08:20:28 AM »
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

Offline Derron

Re: Compile Error
« Reply #2 on: February 13, 2021, 09:49:19 AM »
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

Offline Derron

Re: Compile Error
« Reply #3 on: February 13, 2021, 09:59:25 AM »
You could also keep it in - and do your own debug-func (replaces the original one - which outputs your stuff I think).

Code: BlitzMax
  1. SuperStrict
  2.  
  3. ' Connect to a website via HTTPS, using a certificate bundle.
  4. '
  5. '
  6.  
  7. Framework BaH.libcurl
  8. Import BRL.StandardIO
  9. Import BRL.FileSystem
  10.  
  11. Local curl:TCurlEasy = TCurlEasy.Create()
  12.  
  13. curl.setWriteString()
  14. curl.setOptInt(CURLOPT_VERBOSE, 1)
  15. curl.setOptInt(CURLOPT_FOLLOWLOCATION, 1)
  16. 'register your own debug callback - to disable the message you encountered
  17. curl.setDebugCallback(myCurlDebugFunc)
  18.  
  19. curl.setOptString(CURLOPT_CAINFO, "../certificates/cacert.pem") ' the cert bundle
  20.  
  21. curl.setOptString(CURLOPT_URL, "https://www.google.co.uk")
  22.  
  23. Local res:Int = curl.perform()
  24.  
  25. If res Then
  26.         Print "error: "
  27.         Print CurlError(res)
  28.         End
  29. End If
  30.  
  31. curl.cleanup()
  32.  
  33. 'Print curl.toString()
  34.  
  35.  
  36.  
  37. Function myCurlDebugFunc:Int(data:Object, msgType:Int, message:String)
  38.         Select msgType
  39.                 'Case CURLINFO_TEXT       Print "msgType: TEXT"
  40.                 'Case CURLINFO_HEADER_IN  Print "msgType: HEADER_IN"
  41.                 'Case CURLINFO_HEADER_OUT Print "msgType: HEADER_OUT"
  42.                
  43.                 'curl read some data from remote (eg webpage content
  44.                 'Case CURLINFO_DATA_IN    Print "msgType: DATA_IN"; Print "data: " +message
  45.         End Select
  46.        
  47.         'must return 0
  48.         Return 0
  49. End Function
  50.  



bye
Ron

 

SimplePortal 2.3.6 © 2008-2014, SimplePortal