Page 1 of 1

SendNetworkString over ssl?

Posted: Wed Oct 19, 2016 1:03 pm
by Brujah
I want to install a ssl certificate on my server.
Will there be problems with sending user highscores to it after that?

I initiate the connection like this:

Code: Select all

con = OpenNetworkConnection("www.lostlabyrinth.com", 80);
After that I send users highscores like this:

Code: Select all

SendNetworkString(con, "GET /newscore.php?" + p + " HTTP/1.1" + Chr(10))
SendNetworkString(con, "Host: www.lostlabyrinth.com" + Chr(10))
SendNetworkString(con, "User-agent: PureBasicAgent" + Chr(10))
SendNetworkString(con, "Accept: */*" + Chr(10))
SendNetworkString(con, Chr(10))
Will it be enough to change the port to 443?

Re: SendNetworkString over ssl?

Posted: Wed Oct 19, 2016 1:13 pm
by infratec
Since you are only using GET,
you can use ReceiveHTTPMemory().
Should work with http and https.

Code: Select all

URL$ = "https://www.lostlabyrinth.com/newscore.php?" + p

*Buffer = ReceiveHTTPMemory(URL$)
If *Buffer
  
  Debug PeekS(*Buffer, MemorySize(*Buffer), #PB_UTF8|#PB_ByteLength)
  
  FreeMemory(*Buffer)
EndIf
If you need POST ...
Then you need a more homebrewed version with imported libcurl stuff.

Bernd

Re: SendNetworkString over ssl?

Posted: Wed Oct 19, 2016 2:16 pm
by Brujah
Get is enough.
But further thinking about it I guess it would be better to solve the problem on the server side.
Because otherwise players that use an older version of the game could not upload their scores anymore.

Guess its possible to tell the apache via htaccess it should handle one incoming url (newscore.php) different than all others.