http://qs321.pair.com?node_id=502180


in reply to How Would I access a C++ compiler remotely through a Perl CGI Script?

Well, obviously this works much better over a real shell, but you seem to have figured that out pretty quickly. ;)

But to give you an answer to your question, it could be done. If I would have to implement something like it (at gunpoint), I would use rather a file upload button. That's probably the best way to have it arriving more or less intact to the server.

From then on, you either use cron to check for incoming files every so many minutes and do automatic builds, or you decide it can't be dirty enough for you and you spawn your building scripts or compiler directly from perl. This surely would require setting higher timeouts for your apache daemon and removing all resource limitations you might have. Also, the web browser would have keep the connection open for as long as is needed. And your cgi program would have to be pretty smart about redirecting the right file handles (STDIN, STDOUT, STDERR, perhaps more) so you'd actually see some of what happens on the other side (unless you are a flawless and *very* bored programmer, which might explain your question, too).

Ofcourse, I should not forget to mention the possible security implications of letting people compile and run code on your computer remotely, over the web. It just might not be the sanest thing to do from public computer halls over unencrypted (unauthenticated) connections.

And after you worked around all this, I don't think you would be happy with the end result, either. HTTP and CGI are just not meant to do certain things (efficiently, reliably) which need a whole different approach and environment. To be more precise, a http connection is typically short and stateless, making it very difficult to control and steer long running processes directly.

But you could write a build system or daemon and let http be one of the interfaces to it. If you have a long running process that can be executed independently of HTTP connections to control whatever it is you want to do, possibilities open up.

By the way, perhaps you could try out one of the Linux boot cds. If you have trouble finding one that has a full building environment, make one yourself. With vfat support, you could use free space on the windows drives; and you can easily scp (ssh), rsync or email your programs home. In fact, IIRC, there was a way to mount a server as a local filesystem through ssh. Implement that on your boot cd, and you automatically have easy access to your files at home, too. It takes a bit of work, but once you have something that works, you can just pop the cd in pretty much any computer and have your whole environment customised to your needs.

Not as easy as the ssh option, but you wouldn't have to use windows at all. =)

  • Comment on Re: How Would I access a C++ compiler remotely through a Perl CGI Script?

Replies are listed 'Best First'.
Re^2: How Would I access a C++ compiler remotely through a Perl CGI Script?
by Anonymous Monk on Oct 22, 2005 at 20:34 UTC
    Is there any reason to not use HTTPS? It seems like that'd be more or less as safe as SSH and would allow for the ease of use he seems to be looking for.
      Afraid you missed the true point behind SSH for this task. SSH requires a login/password for the machine you're logging into, whereas https is only going to encrypt the data that is sent between the two computers. SSH prevents a random person from using it, https will only prevent a random person in the middle from understanding what another random person is sending to and from the webserver.


      My code doesn't have bugs, it just develops random features.

      Flame

      https is also very expensive to implement especially for a personal project for a student
        https is not expensive to implement. What is expensive, is having thawte/verisign/other 'trusted' source verify a persons identity and sign their certificate. For an ecommerce site, where you have to convince random strangers that you are who you say you are, that is important, for a personal site, it isn't.