forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


HTTP-Server Question

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Tue Nov 02, 2010 12:17 am    Post subject: HTTP-Server Question Reply with quote

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

Back to top
View user's profile Send private message Visit poster's website
bornsoft
Contributor
Contributor


Joined: 19 Feb 2009
Posts: 113
Location: Germany

PostPosted: Thu Nov 04, 2010 2:24 am    Post subject: Reply with quote

Ahh,

I found out by myself with VDSINET.DLL that if I set " NET SOCKET,AUTO" the whole http-header is returned. Perfect.

In fact I don't understand what the "AUTO" switch is good for, the helpfile says "This enables/disable the client and server making use of the forwarding futures of the server. ..." hmm.

No matter, it's working now.

If anyone should find out, how to get a complete message with VDSIPP.DLL please post it.

Greetings

bornSoft
.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group