Home > Archive > PERL CGI Beginners > September 2004 > moving files
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
|
|
| Jeff Herbeck 2004-09-26, 3:55 am |
| Hello,
I am trying to start a "transloading" and webhosting company. This
will allow users to login via apache .htaccess type authentication and
then be able to put a url of a file into a form and the script will
go get that file, download it to the webserver into their html
directory and then be available for world access. I have the security
setup (apache athentication) and I can get their username with
env(REMOTE_USER) but I dont' know what to do from here. I know I want
to use "wget" to get the file, but i can't seem to get it to work in a
script. I am a linux admin, but don't know perl. How can I log in
the http user into linux and go get that file with wget so it will go
in their home directory, which will be their html directory. Can
someone please get me started?
Thanks in advance
Jeff
| |
| Wiggins d'Anconia 2004-09-26, 3:55 am |
| Jeff Herbeck wrote:
> Hello,
>
> I am trying to start a "transloading" and webhosting company. This
> will allow users to login via apache .htaccess type authentication and
> then be able to put a url of a file into a form and the script will
> go get that file, download it to the webserver into their html
> directory and then be available for world access. I have the security
> setup (apache athentication) and I can get their username with
> env(REMOTE_USER) but I dont' know what to do from here. I know I want
> to use "wget" to get the file, but i can't seem to get it to work in a
> script. I am a linux admin, but don't know perl. How can I log in
> the http user into linux and go get that file with wget so it will go
> in their home directory, which will be their html directory. Can
> someone please get me started?
>
> Thanks in advance
>
> Jeff
>
I would avoid using 'wget' and instead opt for the LWP suite of modules.
They should make retrieving a remote file simple (at least over http).
Take a look at the documentation and examples and give it a shot, when
you get stuck ask some more specific questions.
http://search.cpan.org/~gaas/libwww....800/lib/LWP.pm
LWP is available from CPAN.
http://danconia.org
| |
| Wiggins d Anconia 2004-09-29, 3:55 pm |
| Make sure to group reply so that others can help and be helped (and to
avoid getting accidentally ignored)...please bottom post...
> OK, here is what I have so far
>
> use CGI;
> use LWP::Simple;
> $URL = "http://www.jeffherbeck.com/arch.doc";
> $remote_user = $ENV{REMOTE_USER};
>
> getstore($URL, /var/www/html/$remote_user);
>
>
> and I keep getting
>
> Server error!
> The server encountered an internal error and was unable to complete
> your request.
>
> Error message:
> Premature end of script headers: test.cgi
>
> If you think this is a server error, please contact the webmaster.
>
> Error 500
>
>
>
>
> Could you lead me futher?
>
The above does not have a header printed, which is the most common
reason why you would get a 500 error. Following that, unless you print
some response you will also get the "Document Contains No Data" error on
the client side. In general when you have a 500 error you triple check
that a proper header is being printed, that nothing is printed before
the header, and from there use the web server log to diagnose further
causes, such as syntax errors, etc. or use the fatalsToBrowser switch to
have errors go to the client (not necessarily advisable in production
facing systems).
>
> Thanks
>
> Jeff
http://danconia.org
<snip>
| |
| Jeff Herbeck 2004-09-30, 4:44 am |
| So, what kind of header are we talking about here. (I'm still learning)
Jeff
On Wed, 29 Sep 2004 12:43:46 -0600, Wiggins d Anconia
<wiggins@danconia.org> wrote:
> Make sure to group reply so that others can help and be helped (and to
> avoid getting accidentally ignored)...please bottom post...
>
>
> The above does not have a header printed, which is the most common
> reason why you would get a 500 error. Following that, unless you print
> some response you will also get the "Document Contains No Data" error on
> the client side. In general when you have a 500 error you triple check
> that a proper header is being printed, that nothing is printed before
> the header, and from there use the web server log to diagnose further
> causes, such as syntax errors, etc. or use the fatalsToBrowser switch to
> have errors go to the client (not necessarily advisable in production
> facing systems).
>
>
> http://danconia.org
>
> <snip>
>
| |
| Sean Davis 2004-09-30, 3:55 pm |
| HTTP header, I imagine. There is a section in the CGI documentation
about generating these headers.
Sean
On Sep 30, 2004, at 12:25 AM, Jeff Herbeck wrote:
> So, what kind of header are we talking about here. (I'm still
> learning)
>
> Jeff
>
>
> On Wed, 29 Sep 2004 12:43:46 -0600, Wiggins d Anconia
> <wiggins@danconia.org> wrote:
>
> --
> To unsubscribe, e-mail: beginners-cgi-unsubscribe@perl.org
> For additional commands, e-mail: beginners-cgi-help@perl.org
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
|
|
|
|
|