bornsoft Contributor

Joined: 19 Feb 2009 Posts: 113 Location: Germany
|
Posted: Tue Nov 02, 2010 12:17 am Post subject: HTTP-Server Question |
|
|
Hi,
I'm trying to make a small HTTP-Server that only needs to serve a loginscript written in php.
I tried the VDSHTTPD extension, VDSINET and VDSIPP and all of them seem to have certain limitations.
I found an example by Skit3000 using VDSINET which looked promising:
http://forum.vdsworld.com/viewtopic.php?t=374
But the function @NET(SOCKET,Data) only returns the first header-line (e.g. GET /index.php HTTP/1.1). I need to POST login data and the POST variables are sent within the request body, which is not returned by this function.
I tried VDSIPP TCP-Server and there I only get "Connection: Keep-Alive" several times consecutively, which seems to be the last header line.
I guess it is something with the handling of the carriage returns and linefeeds.
Can anyone help me with this please?
Here are two examples, one with VDSINET and one with VDSIPP. Start the server and then type http://localhost/ into your browser ...
| Code: |
Title HTTP-Server VDSIPP.DLL
#DEFINE Command,Internet
#DEFINE Function,Internet
option decimalsep,.
EXTERNAL vdsipp.dll,DEMO
%%Root = @substr(@path(%0),1,-1)
%%DefaultDoc = index.html
DIALOG CREATE,HTTP-Server VDSIPP.DLL,-1,0,492,260
DIALOG ADD,TEXT,TEXT1,12,21,,,Root-Folder
DIALOG ADD,EDIT,RootEdit,30,20,150,19,%%Root
DIALOG ADD,BUTTON,Start,208,20,64,24,Start
DIALOG ADD,BUTTON,Stop,208,106,64,24,Stop
DIALOG ADD,LIST,LogList,6,190,297,228
DIALOG ADD,STATUS,Status,
DIALOG SHOW
dialog focus,Start
INTERNET TCP-SERVER,CREATE,1
:EvLoop
wait 0.001
%E = @event()
if %E
goto %E
end
goto EvLoop
:TCP-SERVER1ONCONNECT
dialog set,status,Users: @internet(tcp-server,UserCount,1)
goto EvLoop
:TCP-SERVER1ONMESSAGE
%%ID = @internet(tcp-server,UserID,1)
%%Message = @internet(tcp-server,message,1)
if @not(@null(%%Message))
list add,LogList,[%%ID] %%Message
%%Message =
end
goto evloop
:TCP-SERVER1ONDISCONNECT
dialog set,status,Users: @internet(tcp-server,UserCount,1)
goto EvLoop
:StartButton
%%Root = @dlgtext(RootEdit)
INTERNET TCP-SERVER,ACTIVATE,1,80
goto EvLoop
:StopButton
INTERNET TCP-SERVER,DEACTIVATE,1
goto EvLoop
:Close
INTERNET TCP-SERVER,DEACTIVATE,1
INTERNET TCP-SERVER,DESTROY,1
exit
|
| Code: |
Title HTTP-Server VDSINET.DLL
#DEFINE Command,Net
#DEFINE Function,Net
option decimalsep,.
EXTERNAL vdsinet.dll,Public Freeware Key|90257236
%%Root = @substr(@path(%0),1,-1)
%%DefaultDoc = index.html
DIALOG CREATE,HTTP-Server VDSINET.DLL,-1,0,492,260
DIALOG ADD,TEXT,TEXT1,12,21,,,Root-Folder
DIALOG ADD,EDIT,RootEdit,30,20,150,19,%%Root
DIALOG ADD,BUTTON,Start,208,20,64,24,Start
DIALOG ADD,BUTTON,Stop,208,106,64,24,Stop
DIALOG ADD,LIST,LogList,6,190,297,228
DIALOG ADD,STATUS,Status,Server closed@tab()0 Client(s) connected
DIALOG SHOW
dialog focus,Start
:EvLoop
wait 0.001
%E = @event()
if %E
goto %E
end
:ServerLoop
dialog set,Status,Server @NET(SOCKET,STATUS)@tab()@NET(SOCKET,CLIENTS) Client(s) connected
%%Event = @NET(SOCKET,Event)
if @equal(%%Event,NETWORK)
%%ID = @NET(SOCKET,SenderID)
%%Request = @NET(SOCKET,Data)
if @not(@null(%%Request))
list add,LogList,[%%ID]@tab()%%Request
end
end
goto EvLoop
:StartButton
%%Root = @dlgtext(RootEdit)
NET SOCKET,PORT,80
NET SOCKET,SERVER
NET SOCKET,VDSEVENTS
goto EvLoop
:StopButton
NET SOCKET,Close
goto EvLoop
:Close
NET SOCKET,Close
exit
|
|
|