Many of you will remember that earlier this year I moved bbcbasic.co.uk to a new host, primarily to overcome problems caused by my old hosting service capping the monthly bandwidth. The process turned out to be quite painful, perhaps not surprisingly given the relatively unusual ways in which the host is used (e.g. serving the in-browser edition of BBCSDL) and there was a long thread at the time about it.
Since then the new host (Krystal Hosting) has been largely trouble free and I was looking forward to this continuing for a long time. However they have recently informed me that it is their intention "in the near future" to discontinue support for plain (unencrypted) FTP file transfers, and of course I rely on this feature.
Although they haven't explicitly said so, I wouldn't be surprised if they also plan to discontinue unencrypted web (http://) access, which again is something which I critically rely on because BBC BASIC's socklib library does not support encrypted connections (it cannot do so because it in turn uses the SDL2_net library which doesn't).
I have more than once suggested to the SDL developers that they consider adding support for secure connections to their SDL_net library, but they take the view that since SDL is supposed to be 'Simple' - it's what the 'S' stands for - it would not be appropriate and/or practical to do so. It would no doubt be quite difficult, considering the range of platforms supported.
Realistically, given my age and health, I would not be able to move the site again - even if a hosting service could be found which guarantees continued support for unencrypted connections. So at some point in the relatively near future things are going to stop working; exactly what and when will depend on Krystal.
When that happens I can only suggest that you complain to them!
Moving bbcbasic.co.uk to a new host (reprise)
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
- hellomike
- Posts: 184
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Moving bbcbasic.co.uk to a new host (reprise)
In addition to the excellent socklib library maybe you or another brilliant mind could see if it's feasible to develop a curllib library to access the libcurl API.
https://curl.se/libcurl/c/libcurl.html
Then again, I guess this isn't cross-platform.
Just an idea.
Regards,
Mike
https://curl.se/libcurl/c/libcurl.html
Then again, I guess this isn't cross-platform.
Just an idea.
Regards,
Mike
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Moving bbcbasic.co.uk to a new host (reprise)
I presume libcurl is a C source-code library that you have to compile, yes? In which case it ought to be straightforward to compile it into a shared object (.dll in Windows, .so on most other platforms) which exports the relevant functions, then BBC BASIC could access it using SYS "SDL_LoadObject" and SYS "SDL_LoadFunction". Maybe there's some 'gotcha' that I haven't thought of, but I feel it should work.
- hellomike
- Posts: 184
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Moving bbcbasic.co.uk to a new host (reprise)
About a year ago I did a feeble attempt for use in BB4W. I managed to find a recent libcurl.dll somewhere and made the following:
and got this as output.
So at least the functions are easy to call but my lack of knowledge about Internet terminology prevented me to continuing.
Regards,
Mike
Code: Select all
REM>libcurl
REM Source:
REM - https://curl.se/libcurl/
PROClibcurlInit
URL$ = "https://sourceforge.net/" + CHR$0
PRINT FN_curl_version
Curl% = FN_curl_easy_init
IF Curl% THEN
SYS `curl_easy_escape`, Curl%, "https://sourceforge.net/", 0 TO S%
DIM R% LEN$$S%
$$R%=$$S%
SYS `curl_free`, S%
PRINT $$R%
PROC_curl_easy_setopt(Curl%, CURLOPT_URL, R%)
PROC_curl_easy_setopt(Curl%, CURLOPT_FOLLOWLOCATION, 1)
E%=FN_curl_easy_perform(Curl%)
IF E% <> CURLE_OK THEN
PRINT FN_curl_easy_strerror(E%)
ENDIF
PROC_curl_easy_cleanup(Curl%)
ENDIF
END
REM ----------------------------------------------------------------------
DEF PROClibcurlInit
LOCAL dll%, gpa%
SYS "LoadLibrary", @dir$ + "libcurl.dll"
SYS "GetModuleHandle", @dir$ + "libcurl.dll" TO dll%
IF dll% == 0 ERROR 100, "Could not load libcurl.dll"
gpa%=SYS"GetProcAddress"
SYS gpa%, dll%, "curl_easy_init" TO `curl_easy_init`
SYS gpa%, dll%, "curl_easy_cleanup" TO `curl_easy_cleanup`
SYS gpa%, dll%, "curl_easy_setopt" TO `curl_easy_setopt`
SYS gpa%, dll%, "curl_easy_perform" TO `curl_easy_perform`
SYS gpa%, dll%, "curl_easy_strerror" TO `curl_easy_strerror`
SYS gpa%, dll%, "curl_easy_escape" TO `curl_easy_escape`
SYS gpa%, dll%, "curl_free" TO `curl_free`
SYS gpa%, dll%, "curl_version" TO `curl_version`
CURLE_OK = 0
CURLOPT_ERRORBUFFER = 10
CURLOPT_FOLLOWLOCATION = 52
CURLOPT_URL = 2
CURLOPT_VERBOSE = 41
CURL_ERROR_SIZE = 256
ENDPROC
REM ----------------------------------------------------------------------
DEF FN_curl_easy_init
LOCAL C%
SYS `curl_easy_init` TO C%
=C%
REM ----------------------------------------------------------------------
DEF PROC_curl_easy_cleanup(C%)
SYS `curl_easy_cleanup`, C%
ENDPROC
REM ----------------------------------------------------------------------
DEF PROC_curl_easy_setopt(C%, A%, B%)
SYS `curl_easy_setopt`, C%, A%, B%
ENDPROC
REM ----------------------------------------------------------------------
DEF FN_curl_easy_perform(C%)
LOCAL E%
SYS `curl_easy_perform`, C% TO E%
=E%
REM ----------------------------------------------------------------------
DEF FN_curl_easy_strerror(E%)
LOCAL S%
SYS `curl_easy_strerror`, E% TO S%
=$$S% + " (" + STR$E% + ")"
REM ----------------------------------------------------------------------
DEF FN_curl_easy_escape(C%, S%, L%)
LOCAL S%, R%
SYS `curl_easy_escape`, C%, S%, L% TO S%
DIM R% LEN$$S%
$$R%=$$S%
SYS `curl_free`, S%
=$$R%
REM ----------------------------------------------------------------------
DEF FN_curl_version
LOCAL S%
SYS `curl_version` TO S%
=$$S%
Code: Select all
libcurl/8.4.0 OpenSSL/3.1.4 (Schannel) zlib/1.3 brotli/1.1.0 zstd/1.5.5 WinIDN libssh2/1.11.0 nghttp2/1.58.0 ngtcp2/1.1.0 nghttp3/1.1.0
https%3A%2F%2Fsourceforge.net%2F
URL using bad/illegal format or missing URL (3)
>
Regards,
Mike
-
- Posts: 272
- Joined: Tue 18 Jun 2024, 09:32
Re: Moving bbcbasic.co.uk to a new host (reprise)
It's pretty clear what's happened there:
Code: Select all
https%3A%2F%2Fsourceforge.net%2F
- hellomike
- Posts: 184
- Joined: Sat 09 Jun 2018, 09:47
- Location: Amsterdam
Re: Moving bbcbasic.co.uk to a new host (reprise)
I'm sure you are correct. Listing the code and the output was mainly to show that the functionality the libcurl.dll provides is easy to use in BB4W and obviously also in BBCSDL.
Maybe I continue my effort in the near future and start by investing the use of the curl_url_set and curl_url_get API's.
Maybe I continue my effort in the near future and start by investing the use of the curl_url_set and curl_url_get API's.