🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
9 messages
9 total messages Started by Mark Jacobs Wed, 08 Sep 2004 16:41
Can you POST from a browser on a PC to a server app on the same PC ?
#1545
Author: Mark Jacobs
Date: Wed, 08 Sep 2004 16:41
12 lines
1470 bytes
Can you POST from a browser on a PC to a server app on the same PC ?

How do you do this? I assume you write your CGI program the same way (or must
you use a TWebApplication to do this?). Does loopback IP addresses come into
this? I can get as far as the CGI program starting up, but there is no
environment variables or STDIN set up to allow it run normally. How does one
go about a "stand-alone FORM POST"?
-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
markj atty critical dotty co dotty uk
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1546
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Sep 2004 17:34
29 lines
2075 bytes
"Mark Jacobs" <markj atty critical dotty co dotty uk> wrote in message
news:413f3653$1@newsgroups.borland.com...

> Can you POST from a browser on a PC to a
> server app on the same PC ?

Yes.  POST vs. GET is nothing more then how the data is formatted and read
when transmitted, but it is still just a single socket connection, there is
nothing overly special about it.

> Does loopback IP addresses come into this?

Of course.  But it has nothing to do with GET vs. POST.  The loopback is
just a means of connecting back to the same machine, you should be using it
in either case.

> I can get as far as the CGI program starting up, but there is no
> environment variables or STDIN set up to allow it run normally.

Then please show your actual code because you are not setting it up
properly.  CGI programs are just executables (usually console apps) that web
servers spawn when needed.  They read from and write to the normal
STDIN/STDOUT that all applications have.  The only difference is that the
web servers can control what the STDIN/STDOUT actually are.  It sounds like
you are not doing that part correctly, if at all.


Gambit
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1547
Author: Hans Galema
Date: Wed, 08 Sep 2004 18:06
31 lines
2086 bytes
Mark Jacobs wrote:
> Can you POST from a browser on a PC to a server app on the same PC ?

If the server app is a webserver or a dedicated webserver then yes.
Otherwise no.

Where the webserver runs is not important. It can be on any machine
that is reachable.

> How do you do this? I assume you write your CGI program the same way (or must
> you use a TWebApplication to do this?). 

If you have a cgi exectable then that should be started by the webserver.
The webserver will forward the POST info to your cgi app.
You can also build a dedicated webserver: a webserver that handles the POST
info itself.

 > Does loopback IP addresses come into
> this? I can get as far as the CGI program starting up,

Are you starting the cgi yourself ? That will not do.

> but there is no
> environment variables or STDIN set up to allow it run normally. How does one
> go about a "stand-alone FORM POST"?

What do you mean with a "stand-alone FORM POST"? Do you have in mind
an exe that gets the POST info from the browser ? That would be
a (dedicated) webserver then.

Hans.
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1548
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Sep 2004 19:40
15 lines
1592 bytes
"Mark Jacobs" <mark@losethisbitjacobsm.com> wrote in message
news:413f5ae0$1@newsgroups.borland.com...

> My CGI app is called dkproces.exe - how does the webserver forward
> the POST info - does it set up the environment, and then run dkproces.exe
> in that environment?

Yes.  It is the server's responsibility to set up two pipes and then assign
them to the spawned process's STDIN and STDOUT handles.  The server then
reads the socket data and pushes it down the STDIN pipe, and then reads data
from the STDOUT pipe and returns it to the web browser.


Gambit
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1551
Author: Mark Jacobs
Date: Thu, 09 Sep 2004 12:19
17 lines
1953 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:413f5fc5$1@newsgroups.borland.com...
| Yes.  It is the server's responsibility to set up two pipes and then assign
| them to the spawned process's STDIN and STDOUT handles.  The server then
| reads the socket data and pushes it down the STDIN pipe, and then reads data
| from the STDOUT pipe and returns it to the web browser.

What you failed to tell me is that the PC that is running the CGI script, must
be a server (or at least running some server software like Microsoft Personal
Web Server for 9x, or IIS5 on XP Pro). For me on XP Pro, I had to get the XP
CD to install IIS, and this was the hard bit. Now I am up and running with my
dkproces.exe file. Cheers everyone!
-- 
Mark Jacobs
DK Computing
http://www.dkcomputing.co.uk
markj atty critical dotty co dotty uk
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1552
Author: Hans Galema
Date: Thu, 09 Sep 2004 14:18
18 lines
1826 bytes
Mark Jacobs wrote:

> What you failed to tell me is that the PC that is running the CGI script, must
> be a server (or at least running some server software like Microsoft Personal
> Web Server for 9x, or IIS5 on XP Pro). 

Sorry, but you were told already that on the PC should run a -dedicated-
webserver.

It is not "some server software" but specifically "webserver software". Apache
and Xitami come to mind.

And if you use a script: A cgi script needs a cgi executable that
interprets the script. The cgi executable should be started by a webserver.
I.E. mypage.php could be a script, php.exe the cgi executable and
Apache the webserver.

Hans.
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1553
Author: Remy Lebeau (TeamB)
Date: Thu, 09 Sep 2004 16:54
14 lines
1513 bytes
"Mark Jacobs" <markj atty critical dotty co dotty uk> wrote in message
news:41404a39@newsgroups.borland.com...

> What you failed to tell me is that the PC that is running the
> CGI script, must be a server (or at least running some
> server software like Microsoft Personal Web Server for
> 9x, or IIS5 on XP Pro).

No, it doesn't.  You can write your own web server program to handle
everything yourself.  You did say that you wanted a stand-alone server.


Gambit
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1554
Author: Mark Jacobs
Date: Thu, 09 Sep 2004 20:53
15 lines
2114 bytes
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:41408a50$1@newsgroups.borland.com...
| You can write your own web server program to handle
| everything yourself.  You did say that you wanted a stand-alone server.

Yes, but how? How can I avoid having to install and set up IIS under Win XP Pro?
I have written a small CGI Web Server App that can be "seen" as a URL from
another PC, when my PC is running IIS, and that works fine. Now that I have
appraised the capabilities of BCB5 Pro's WebRequest and WebResponse objects, I
think I could write a server to respond any request. Actions are a brilliant
idea. But if IIS is not running, the app instantly returns to the console prompt
when run. How does one go from a path name on my PC, to a URL on the intranet,
without using IIS?
-- 
Mark Jacobs
Re: Can you POST from a browser on a PC to a server app on the same PC ?
#1555
Author: Remy Lebeau (TeamB)
Date: Thu, 09 Sep 2004 21:26
14 lines
1585 bytes
"Mark Jacobs" <mark@losethisbitjacobsm.com> wrote in message
news:4140c2d3$1@newsgroups.borland.com...

> Yes, but how? How can I avoid having to install and set up IIS under Win
XP Pro?

Write a standalone application (or service) that uses an HTTP server
component, such as the one provided in Indy (http://www.indyproject.org).
Or you can use any TCP/IP server component, even TServerSocket that ships
with BCB, and then write the HTTP code from scratch.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads