diff --git a/tests/network/network.lua b/tests/network/http.lua similarity index 80% rename from tests/network/network.lua rename to tests/network/http.lua index b758fe9..369742c 100644 --- a/tests/network/network.lua +++ b/tests/network/http.lua @@ -20,12 +20,12 @@ end function socketConnected(socket) setObjectText(globalLabel, "Connected!") - eIOWrite(socket, "GET /luaenginetest.html HTTP/1.1\r\nHost: www.syping.de\r\nUser-Agent: LuaEngine\r\nConnection: close\r\n\r\n") + eIOWrite(socket, "GET / HTTP/1.1\r\nHost: www.syping.de\r\nUser-Agent: LuaEngine\r\nConnection: close\r\n\r\n") socketFlush(socket) end function socketReadyRead(socket) setObjectText(globalLabel, "Reading...") local readData = eIOReadAll(socket) - setObjectText(globalLabel, "" .. readData) + setObjectText(globalLabel, readData) end diff --git a/tests/network/https.lua b/tests/network/https.lua new file mode 100644 index 0000000..ccce08f --- /dev/null +++ b/tests/network/https.lua @@ -0,0 +1,32 @@ +local globalLabel + +function main() + -- Window + mainWindow = createMainWindow("LE TCP Test") + local mainLayout = createLayout(VerticalLayout, mainWindow) + + local socket = createTcpSocket() + connect(socket, "connected()", "socketConnected") + connect(socket, "readyRead()", "socketReadyRead") + socketConnect(socket, "syping.de:443") + + globalLabel = createLabel("Connecting...", mainLayout) + + -- Show Window + setWidgetSize(mainWindow, 650, 450) + showWidget(mainWindow, ShowDefault) + return GuiExecuted +end + +function socketConnected(socket) + setObjectText(globalLabel, "Connected!") + tcpSocketStartTLS(socket) + eIOWrite(socket, "GET / HTTP/1.1\r\nHost: www.syping.de\r\nUser-Agent: LuaEngine\r\nConnection: close\r\n\r\n") + socketFlush(socket) +end + +function socketReadyRead(socket) + setObjectText(globalLabel, "Reading...") + local readData = eIOReadAll(socket) + setObjectText(globalLabel, readData) +end