I have been stuck on this for a while.
I have an http::daemon server running. I accept connections from the client to do various things, mostly pull down files.
One thing I do on the client side is use the mirror function to check if a file is up to date or not with the file on the server and if not it should download it (as it does when I use an apache server to mirror the files). I'm looking to do this same thing with the http daemon server.
Client function
#Syncs up a task file from a url with a local file
sub sync($)
{
(my $file) = @_;
my $encrypted = $crypt->encrypt("/gettasks/$organization/$ENV{COMPUTERNAME}/$file", $cryptKey);
my $rc = mirror($eventsURL.$encrypted, "./tasks/$file");
if ($rc == 304)
{
return "$file is up to date\n"
}
elsif (!is_success($rc))
{
return status_message($rc), " ($eventsURL)\n";
}
}
On the server side I do this to push the file to the client once the request is decrypted and parsed
$c->send_file_response("./tasks/$split[2]/$split[4]");
The thing is this doesn't work, it always downloads the file no matter what and gets a 200 response. I tried every way I can think of to send the header to the client (I'm guessing it wants the date updated from the file on the server) and then seeing if I get a response back but it still downloads the file every time.
I just need the mirror function (or something similar) to work across the http daemon server.
~Blake
I have an http::daemon server running. I accept connections from the client to do various things, mostly pull down files.
One thing I do on the client side is use the mirror function to check if a file is up to date or not with the file on the server and if not it should download it (as it does when I use an apache server to mirror the files). I'm looking to do this same thing with the http daemon server.
Client function
#Syncs up a task file from a url with a local file
sub sync($)
{
(my $file) = @_;
my $encrypted = $crypt->encrypt("/gettasks/$organization/$ENV{COMPUTERNAME}/$file", $cryptKey);
my $rc = mirror($eventsURL.$encrypted, "./tasks/$file");
if ($rc == 304)
{
return "$file is up to date\n"
}
elsif (!is_success($rc))
{
return status_message($rc), " ($eventsURL)\n";
}
}
On the server side I do this to push the file to the client once the request is decrypted and parsed
$c->send_file_response("./tasks/$split[2]/$split[4]");
The thing is this doesn't work, it always downloads the file no matter what and gets a 200 response. I tried every way I can think of to send the header to the client (I'm guessing it wants the date updated from the file on the server) and then seeing if I get a response back but it still downloads the file every time.
I just need the mirror function (or something similar) to work across the http daemon server.
~Blake