Location redirect question
|
|
Thread rating:  |
Mark Wheeler - 01 Jun 2005 07:55 GMT Hi,
I'm having a problem with redirecting (Location: script.cgi) after a file has been downloaded.
Here is the gist of the script. It creates two files (one html, the other text), then a download dialog box comes up so the first newly created file can be saved. But after the file is saved, I'm trying to call the script again to download the second file, as I can't seem to get the second file to download after the first one has finished. But all I am getting is the first file downloaded with the 'print "Location: script.cgi?text\n\n"' at the bottom of the saved file. Do I need to change the Content-type or something to be able to call the script again? Here is a sample of the script.
Any ideas would be very helpful. Thanks very much,
Mark ------------------------------------------------------------------------ -
<CODE>
my $request = $ENV{'QUERY_STRING'}; if ($request eq "text") { &save_text; exit; }
# Create the files . . . #=========================== # Save HTML version #===========================
&save_file($htmlname);
print "Location: script.cgi?text\n\n";
exit;
#=========================== # Save TEXT version #===========================
sub save_text {
&save_file($textname);
print "Content-type: text/html\n\n";
print "finished.";
exit;
}
#=========================== # Save files #===========================
sub save_file {
my $path = "$pathtofile$_[0]"; my $filename = $_[0]; my $size = (stat($path))[7]; # the size, in bytes binmode STDOUT;
print "Content-Length: $size\n"; print "Content-Disposition: attachment;filename=$filename\n"; print "Content-Type: application/octet-stream\n\n";
open (FILE, "< $path") || die("Can't open($filename): $!"); binmode(FILE);
my $data; while(read(FILE,$data,4096)) { print $data; } close(FILE);
}
</CODE>
Bill Stephenson - 01 Jun 2005 20:30 GMT I use Interarchy to download perl scripts I want to edit with BBedit. BBEdit uses Interarchy to save the scripts.
When I save a the perl script I first have to check to see if there is a recently active user so the user doesn't get an error while trying to access the script again while I'm in the middle of uploading it with my really slow dial-up connection.
This really doesn't work very well and I need a better way to handle this.
Anyone have a solution/suggestion?
Kindest Regards,
-- Bill Stephenson
Troy Davis - 01 Jun 2005 22:17 GMT Hi Bill,
Two options that are pretty simple:
1. Save the script with a different name until you've got the changes working, then swap the files.
2. Setup a test site on the same server with a separate domain name like test.yourclient.com. Then you can experiment to your heart's content on the entire infrastructure without interrupting public access to the production site.
HTH, Troy __________________ Troy Davis Technology Director Metaphor Studio 538 Reading Road Loft 200 Cincinnati, Ohio 45202
Tel: 513-723-0290 Fax: 513-723-0670 http://metaphorstudio.com
> I use Interarchy to download perl scripts I want to edit with > BBedit. BBEdit uses Interarchy to save the scripts. [quoted text clipped - 13 lines] > -- > Bill Stephenson Jay Savage - 01 Jun 2005 22:40 GMT > I use Interarchy to download perl scripts I want to edit with BBedit. > BBEdit uses Interarchy to save the scripts. [quoted text clipped - 13 lines] > -- > Bill Stephenson Bill,
Just upload the file to something like "my_script.cgi.new". It can take as long as it needs to transfer. Once it's transferred, rename it.
HTH,
-- jay -------------------- daggerquill [at] gmail [dot] com http://www.engatiki.org
Bill Stephenson - 02 Jun 2005 16:16 GMT > Bill, > [quoted text clipped - 8 lines] > daggerquill [at] gmail [dot] com > http://www.engatiki.org Thanks for the reply Jay,
I've done that too, but it's a rather laborious solution to what must be a rather common task and I'm thinking there could be a more automated way to deal with it. Since both BBEdit and Interarchy are already built to work together I was hoping that someone more familiar with their guts may have worked on it already.
So I guess what I'm asking is if there a way to get either of these apps to upload a file with a new name and rename it after the upload is complete with one click. Obviously, this doesn't entirely solve the problem, but it does reduce the potential.
Kindest Regards,
-- Bill Stephenson
Ted Zeng - 02 Jun 2005 19:20 GMT Hi, I use Net::SSH::Perl to connect to a few Macs from a Mac.
To 2 of them, it works fine. But for others, the shell would have password prompt and I have to type the password at the shell to make the script goes through.
I have tried to turn off any options that would ask for authentication. Even set the interactive option to 0 (The default is already false.) But the problem doesn't go away. I turn the debug on and the log is in the end of this message. For the two Macs that works, it has No challenge presented. Trying password authentication.
at the end instead of the password prompt.
Anyone has seen this problem before? I searched the net and found a couple of people had this problem. But there were no answers to their questions.
Here is the script that I used:
$user='name'; $pass = 'password'; $host = '111.22.33.444'; $params{debug} = 1; $params{interactive} = 0; my $ssh = Net::SSH::Perl->new($host,%params,options =>["BatchMode yes"]); $ssh->login($user, $pass); ($stdout, $stderr, $exit) = $ssh->cmd("ls");
ted zeng Adobe Systems
======The debug log Reading configuration data /Users/z/.ssh/config Reading configuration data /etc/ssh_config Connecting to ip, port 22. Remote protocol version 1.99, remote software version OpenSSH_3.8.1p1 Net::SSH::Perl Version 1.27, protocol version 1.5. No compat match: OpenSSH_3.8.1p1. Connection established. Waiting for server public key. Received server public key (768 bits) and host key (1024 bits). Host 'ip' is known and matches the host key. Encryption type: DES3 Sent encrypted session key. Received encryption confirmation. RSA authentication failed: Can't load public key. Doing challenge response authentication. Password:
No challenge presented. Trying password authentication.
Joel Rees - 03 Jun 2005 00:24 GMT > Hi, > I use Net::SSH::Perl to connect to a few Macs from a Mac. [quoted text clipped - 4 lines] > > I have tried to turn off any options that would ask for authentication. Options in or to what? .ssh file? keychain? method call?
> Even set the interactive option to 0 (The default is already false.) > But the problem doesn't go away. I turn the debug on and the log is in [quoted text clipped - 44 lines] > No challenge presented. > Trying password authentication. Sherm Pendley - 03 Jun 2005 00:42 GMT > Anyone has seen this problem before? I searched the net and found a > couple of people [quoted text clipped - 9 lines] > my $ssh = Net::SSH::Perl->new($host,%params,options => > ["BatchMode yes"]); Googling for 'No compat match:' turned up some likely-looking candidates, including this one:
<http://forums.devshed.com/t191670/s.html>
Based on that page, you might try using the 'protocol' option for force Net::SSH::Perl to try an SSH2 connection first:
$params{protocol} = '2,1';
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
Ted Zeng - 10 Jun 2005 17:56 GMT Thanks.
I found out the machines I have the problem with have OS X 10.4.1 installed. 10.3.8 doesn't have the problem.
I generated a public key and copied it to a target machine. Then it is ok. Not a good solution to me. But I can deal with it.
I have looked at ssh_config and sshd_config and still could not figure out why these two OS behave differently.
SSH has been a big pain. I wish it has a switch that would turn it into telnet. I don't care about security in our situation.
ted
>> Anyone has seen this problem before? I searched the net and found a >> couple of people [quoted text clipped - 24 lines] > Cocoa programming in Perl: http://camelbones.sourceforge.net > Hire me! My resume: http://www.dot-app.org Jay Savage - 02 Jun 2005 21:23 GMT > > Bill, > > [quoted text clipped - 23 lines] > > Kindest Regards, The answer is probably no. At least not out of the box. It's not really all that common, at least not any more: most "mission critical" apps are maintained on reasonably high speed connections. In most cases if you're working on an application where a customer just absolutely can't get a 505 error, ever. The comapany pays for a cable or T1--or at least DSL--connection. And usually, if it's that important, especially if you're using renaming to aviod connection problems, you don't want the process to be automated. You want to do it by hand to make sure it works, and you want to verify the checksums on both the download and the upload, just to be sure you've got everything. So no, this probably isn't as common as it seems, although it was certainly more common 5 years ago.
That said, interarchy is extremely AppleScriptable. You should be able to whip up something fairly quickly. If you poke around the Interarchy users group (it's linked from the website) there may even be something out there already.
Anothe option would be to set up a cron job on the server to periodically rename files with a certain extension.
HTH,
-- jay -------------------- daggerquill [at] gmail [dot] com http://www.engatiki.org
Joel Rees - 03 Jun 2005 00:33 GMT I think I'm going to be disagreeable ...
>>> Bill, >>> [quoted text clipped - 28 lines] > really all that common, at least not any more: most "mission critical" > apps are maintained on reasonably high speed connections. Race conditions don't go away just because you have high speed connections.
> In most > cases if you're working on an application where a customer just [quoted text clipped - 8 lines] > > That said, interarchy is extremely AppleScriptable. Bingo.
In fact, I'll bet you can get into Interarchy through perl, but then you can also go direct to ftp or ssh through perl, as well. Set up an entire separate directory hierarchy, shut down the sessions more or less gracefully, and mv the root of the new one over the top of the old one before bringing the server back up.
And the really big sites actually load the new site on a separate (set of) server(s) and switch the IP addresses all at once.
> You should be > able to whip up something fairly quickly. If you poke around the [quoted text clipped - 10 lines] > daggerquill [at] gmail [dot] com > http://www.engatiki.org Sherm Pendley - 03 Jun 2005 00:46 GMT > Race conditions don't go away just because you have high speed > connections. Quite true, but high speed connections *do* shrink the time window, considerably reducing the risk. Unless you have an application that absolutely, positively, must *never* fail, you can easily get to a point where the risk is too low to justify the effort of lowering it even further.
sherm--
Cocoa programming in Perl: http://camelbones.sourceforge.net Hire me! My resume: http://www.dot-app.org
Jay Savage - 03 Jun 2005 03:52 GMT > > Race conditions don't go away just because you have high speed > > connections. [quoted text clipped - 6 lines] > > sherm-- Exactly.
Race conditions don't go away even if you take the the network out of the connection entirely. There's still a very small even with the mv option. But the faster the copy can happen, the less chance of a request being issued while it's unsable. If it takes an hour to write a file, there's a pretty good change many people are going to get 505's or 404's. If it takes 1/10th of a second to shuffle some pointers, theres a pretty good chance no one will ever know.
And "unusable" is really what we're talking about here, not race conditions. I don't think there's much potential for a true race condition. First, hopefully the OS is sane, and second, there's one reading process and one writing process. That's not problematic from a scheduling standpoint, unless I was absent the day tail got defined as a race condition; it's not exactly fertile ground for an infinte loop. The problem is that the OP would like for the web server to have access to a complete (old) file until the complete new file is available.
And there are two solutions to that I can see: 1) get a connection fast enough to narrow the window of opportunity to within the bounds of acceptability, or 2) bait and switch.
-- jay -------------------- daggerquill [at] gmail [dot] com http://www.engatiki.org
John Horner - 03 Jun 2005 02:14 GMT I don't think there's going to be an easy way to over-ride the default "transparent" behaviour of BBEdit/Interarchy to solve your problems. That is, whatever you come up with may not be able to be mapped to the application's "Save" command itself.
But what you want to do is essentially trivial, when looked at as an Applescript problem:
"Can I create a command, which can be called when editing a file in BBEdit, saves the file to an FTP server, with a given prefix or suffix on the filename, then renames two files on that server?"
the answer is definitely yes and should be short work for AppleScript / BBEdit / Interarchy gurus. You're just asking on the wrong list, that's all.
Steve Axthelm - 03 Jun 2005 18:28 GMT > I don't think there's going to be an easy way to over-ride the > default "transparent" behaviour of BBEdit/Interarchy to solve your > problems. That is, whatever you come up with may not be able to be > mapped to the application's "Save" command itself. BBEdit is attachable - assuming the scripting end could be worked out, attaching the script to a menu command won't be a hitch.
-Steve
-- Steve Axthelm steveax@pobox.com
Charles Albrecht - 03 Jun 2005 04:16 GMT >I've done that too, but it's a rather laborious solution to what must be a rather common task and I'm thinking there could be a more automated way to deal with it. The approach I would tend to take would involve more infrastructure - setting up version control (say, subversion or cvs over ssh or tls) and do my save into the [remote] version control system. Then the task on the other end just involves sync'ing or exporting or updating with respect to the relatively local system. As others have noted, this doesn't get rid of the potential for race conditions, but it does allow you to work and upload your work without the sense that you're modifying the "live" version of the file out from under someone.
-Charles charlesa@pobox.com
Peter N Lewis - 03 Jun 2005 05:16 GMT >>Just upload the file to something like "my_script.cgi.new". It can >>take as long as it needs to transfer. Once it's transferred, rename
> >I've done that too, but it's a rather laborious solution to what >must be a rather common task and I'm thinking there could be a more >automated way to deal with it. [ObDisclosure: I'm the author of Interarchy]
The problems with putting this into Interarchy is that there is no guarantee that just because you can upload and overwrite a file, you can safely upload to a different name, delete the file, and then rename the file to the old name. The server may allow upload overwriting, but may not allow delete, not allow rename, change the name transparently on the uploaded file such that the rename fails, etc, etc. Especially for FTP there are so many ways the servers can and do misbehave that general solutions to these sorts of problems require the high level AI in the human brain and are sadly beyond my (or I would probably go so far as to say anybody's) ability to solve in a way that would work for all cases.
These is also the specific problem of this upload/delete/rename solution that the uploaded file will not retain the permissions of the original, which normally is the case for an upload/overwrite. Any solution you implement in AppleScript or Perl would need to take this in to account.
>The approach I would tend to take would involve more infrastructure >- setting up version control (say, subversion or cvs over ssh or [quoted text clipped - 5 lines] >that you're modifying the "live" version of the file out from under >someone. Yes, this would also be my suggestion (and indeed is what we do for our web site). BBEdit works on a local copy. Interarchy mirrors the local copy up to a working copy on the server (and Auto Upload with a trivial macro can allow the current document in BBEdit to be uploaded immediately for rapid testing). When all is well with the working copy on the server (which in our case is live on another port, but only accessible from our network), then rsync is used on the server to copy the working copy to the live copy.
As stated, there is always a short period where the user may get inconsistent results. Short of toggling the live directory (or machine or IP address), this is always going to be the case when applying multiple changes. But the time is now reduced to the local rsync time, which is likely to be nearly instantaneous, and more than sufficient for any normal site (any site without enough traffic to need multiple servers, and not critical enough that money or lives depend on flawless operation).
And as also stated, BBEdit and Interarchy are both highly scriptable (using AppleScript, or Perl), so a script that takes the location of the current window in BBEdit, saves the document back to document.new, deletes and renames the remote file, and then applies any permission settings as required by the file extension, would be relatively straight forward. Mac::Glue would make this a Perl script task.
Enjoy, Peter.
 Signature <http://www.stairways.com/> <http://download.stairways.com/>
Ken Williams - 03 Jun 2005 13:34 GMT > So I guess what I'm asking is if there a way to get either of these > apps to upload a file with a new name and rename it after the upload > is complete with one click. Obviously, this doesn't entirely solve the > problem, but it does reduce the potential. Actually, it *would* entirely solve the problem. Renaming a file is an atomic operation, there's no point at which anybody could get a partial file. People still reading the old file would be fine too, even if the rename happened while they're in the middle of reading; the old file is readable until they close it.
This is all on Unix-ish platforms, though. Windows servers are probably all screwed up about it.
-Ken
Joel Rees - 03 Jun 2005 15:44 GMT >> So I guess what I'm asking is if there a way to get either of these >> apps to upload a file with a new name and rename it after the upload [quoted text clipped - 9 lines] > This is all on Unix-ish platforms, though. Windows servers are > probably all screwed up about it. inodes are wonderful things.
But now it occurs to me to wonder whether UFS over HFS+ fully emulates this behavior.
I've used it in rotating httpd logs, and it seems to work.
-- Joel Rees Re-inventing the wheel -- One of these days it'll be time to properly implement this wheel thing, bang off all the corners so it can actually roll.
Ken Williams - 03 Jun 2005 20:31 GMT >> So I guess what I'm asking is if there a way to get either of these >> apps to upload a file with a new name and rename it after the upload [quoted text clipped - 6 lines] > even if the rename happened while they're in the middle of reading; > the old file is readable until they close it. Peter pointed out in a private email that this isn't reliable using FTP's rename functionality (if your FTP even supports it) - what I meant in the above, though I wasn't clear, was to use /bin/mv on the server, not a rename through the FTP connection.
-Ken
Bill Stephenson - 03 Jun 2005 21:33 GMT >>> So I guess what I'm asking is if there a way to get either of these >>> apps to upload a file with a new name and rename it after the upload [quoted text clipped - 13 lines] > > -Ken Thank you to everyone for the help.
Peter provided a great explanation about why FTP is not suited for this problem. I played with the Applescript "Script Recorder" and didn't get too far, there may be a way to use Applescript, I just don't know much about it.
Here's what I did come up with to make this easier for me..
Open the file from the remote server with BBEdit. Use the "Save a Copy to FTP Server" menu command and save the file with a new name
Then I wrote this cgi script on the remote server to chmod and rename the file... =========================================================== #!/usr/bin/perl use strict; use warnings; use CGI; use CGI::Carp('fatalsToBrowser');
my $Q = new CGI; print $Q->header; print $Q->start_html; my $mode = 0755;
chmod $mode, 'app.cgi-new' or die ("Error 1: $!");
rename("app.cgi-new","app.cgi") or die("Error 2: $!"); print "All Done"; print $Q->end_html; ===========================================================
This isn't as good as I'd like, but it's easier than what I did before.
I know this solution now takes this pretty much way OT and so I apologize...
Kindest Regards,
-- Bill Stephenson
Joel Rees - 03 Jun 2005 23:39 GMT >>> So I guess what I'm asking is if there a way to get either of these >>> apps to upload a file with a new name and rename it after the upload [quoted text clipped - 9 lines] > Peter pointed out in a private email that this isn't reliable using > FTP's rename functionality I'd like a peek at what he wrote, if nobody minds.
> (if your FTP even supports it) - what I meant in the above, though I > wasn't clear, was to use /bin/mv on the server, not a rename through > the FTP connection. Now, I wouldn't want to stir too much oil into the water, but I'm imagining strange things like, ssh would not have such problems (assuming you knew that the server was a regular *NIX server and the server's file system was a system with proper inodes)?
I consider this on topic, myself, because it's definitely one of the things we have to think about when using perl on our Mac OS X boxes. (Urging Peter to add ssh functionality to interarchy might not be on topic, perhaps.)
-- Joel Rees Re-inventing the wheel -- One of these days it'll be time to properly implement this wheel thing, bang off all the corners so it can actually roll.
Peter N Lewis - 04 Jun 2005 01:29 GMT >>>Actually, it *would* entirely solve the problem. Renaming a file >>>is an atomic operation, there's no point at which anybody could [quoted text clipped - 6 lines] > >I'd like a peek at what he wrote, if nobody minds. Sorry, I was trying to reduce the noise as we drift further and further off topic, but it seems ti just added more.
At 23:27 +0800 3/6/05, Peter N Lewis wrote:
>We're getting a bit too esoteric to continue on the list, but this >depends on the FTP server allowing rename/overwrite, which is far >from guaranteed, even under unix. There are quite a few FTP servers >which will give an error in that case, so you would need to delete >the file first and then rename, destroying the atomicness of the >operation.
>> (if your FTP even supports it) - what I meant in the above, though >>I wasn't clear, was to use /bin/mv on the server, not a rename [quoted text clipped - 4 lines] >(assuming you knew that the server was a regular *NIX server and the >server's file system was a system with proper inodes)? Yes, presuming you ssh in, and then apply the old permissions to the new file and then do a mv (much like the script Bill ended up writing), you'd be safe for at least the mainstream unix systems I would think.
Enjoy, Peter.
 Signature <http://www.stairways.com/> <http://download.stairways.com/>
Ted Zeng - 24 Jun 2005 19:25 GMT Hi,
Why the system behaves differently when I ssh to a machine from Terminal than when I ssh to the same machine by Perl's SSH module?
Here is the problem: I added a tool to /usr/local/bin. I updated the profile file. Now if I ssh to the machine, I could use "which tool" to find it.
But when I try to do the same in Perl, the reply is "no tool in /usr/bin /bin /usr/sbin /sbin"
ted zeng Adobe Systems
Chris Devers - 24 Jun 2005 19:41 GMT > Why the system behaves differently when I ssh to a machine from > Terminal than when I ssh to the same machine by Perl's SSH module? It sounds like the script is getting the default system $PATH variable, while the shell is getting the $PATH defined in your login scripts.
Specifying the full path to the tool you want may circumvent this.
Alternatively, your script can declare what $PATH to use, but without seeing the code, I'm not sure how best to do this.
In any case though, if it's an option for you, using a full path would be easier than setting it manually.
 Signature Chris Devers
Ted Zeng - 24 Jun 2005 21:13 GMT Chris,
I know how to circumvent this. But I would like to know why they behave differently. I have assumed they should be the same.
Thanks,
ted zeng
>> Why the system behaves differently when I ssh to a machine from >> Terminal than when I ssh to the same machine by Perl's SSH module? [quoted text clipped - 9 lines] > In any case though, if it's an option for you, using a full path would > be easier than setting it manually. Adrian Hosey - 24 Jun 2005 21:45 GMT : I know how to circumvent this. But I would like to know why they behave : differently. : I have assumed they should be the same. If you want to know the gory details of .login, .bash_login, .profile, and .bash_profile, and which ones get invoked when and in what order, do "man bash", read the man page, and be prepared for a good cry. I don't think anyone is dismissing your intellectual curiosity, but it's a real mess and anyone writing an explanation would just be recopying the stuff in the man page. You're picking at a really bad wart of Unix history.
In the end, you need to set $ENV{PATH} explicitly before you spawn any subprograms. It's the only way to be sure.
 Signature It wasn't me it was the one-armed man!
Joel Rees - 25 Jun 2005 01:29 GMT > : I know how to circumvent this. But I would like to know why they > behave [quoted text clipped - 6 lines] > "man > bash", read the man page, and be prepared for a good cry. Oh, come on now, it's not that bad. ;-/
> I don't think > anyone is dismissing your intellectual curiosity, but it's a real mess > and > anyone writing an explanation would just be recopying the stuff in the > man > page. You're picking at a really bad wart of Unix history. I'd rather say that this is one of those rough edges of the real world that the industry keeps trying to sweep under the carpet. Not so much that Unix is warty (although it is) as that the real world just doesn't wrap up as neatly as some computer vendors would have us believe.
> In the end, you need to set $ENV{PATH} explicitly before you spawn any > subprograms. It's the only way to be sure. And it is the correct solution.
I think there is a cleaner way, but the infrastructure does not exist.
-- Joel Rees
msn.com and hotmail.com users take note -- Microsoft wants to refuse my mail if I don't use SenderID starting November. SenderID was refused as an internet standard and does not stop SPAM, and it contains a Microsoft patented algorithm. Draw your own conclusions.
Wiggins d'Anconia - 24 Jun 2005 19:50 GMT > Hi, > [quoted text clipped - 10 lines] > ted zeng > Adobe Systems The difficult part is that the answer is really "just because" :-). When you use the 'ssh' from the terminal you are using the local ssh client. That client establishes a connection to a remote ssh server and tells that server that it wants to run a command, that command is to init a shell and then interact. So when you send your 'which' command you are interacting with the remote shell over the ssh "tunnel". But when you use Net::SSH::Perl (which I am assuming is the module you are using) you are establishing a connection to a remote SSH session, but the command(s) you send are being exec'd directly (presumably by /bin/sh) which may or may not have loaded the same environment as the normal user shell (for instance, skipping any .bashrc/.bash_profile, etc.). I believe (though haven't tested) that the same would occur if you provided a command to the local ssh client instead of requesting an interactive shell.
Net::SSH provides a wrapper around the local 'ssh' command but I have not used it. I tested it once quite a while ago and preferred Net::SSH::Perl *for my purposes*.
HTH,
http://danconia.org
Ted Zeng - 24 Jun 2005 21:10 GMT Thanks. You make it very clear. I have assumed they should be the same.
I took a look at Net::SSH and it seems it is not what I want. It is much easier to install Net::SSH though.
SSH has been a big headache to me. I wish OS X just has telnet. It is good enough for my purpose. I wish SSH has an option that says turn it into rlogin or telnet.
ted
>> Hi, >> [quoted text clipped - 37 lines] > > http://danconia.org Adam Wells - 24 Jun 2005 21:48 GMT > SSH has been a big headache to me. I wish OS X > just has telnet. It is good enough for my purpose. > I wish SSH has an option that says turn it into rlogin or > telnet. Mac OS X does have a telnet daemon -- but it's disabled by default. On Tiger, you can issue this command as root to start it up:
# launchctl load -w /System/Library/LaunchDaemons/telnet.plist
adam
Ted Zeng - 27 Jun 2005 18:48 GMT Thanks. I will look into this.
ted
>> SSH has been a big headache to me. I wish OS X >> just has telnet. It is good enough for my purpose. [quoted text clipped - 7 lines] > > adam Wiggins d'Anconia - 25 Jun 2005 00:22 GMT > Thanks. You make it very clear. > I have assumed they should be the same. [quoted text clipped - 8 lines] > > ted Other than the installation, which I will certainly grant you Net::SSH::Perl can be a pain with its dependencies, especially on non-linux systems, what doesn't Net::SSH::Perl or Net::SSH provide that Net::Telnet would?
There might be a solution to your issues if you can post some more about the problem.
Regardless, in the end Expect should make either respond in the same way. Granted I wouldn't want to do it either, but Expect can handle just about anything, and Net::SSH::Perl's 'shell' method should provide the interactive capability needed when using Expect.
You could always write a telnet server to run on Mac OS X in Perl ;-). Though I think it was wise for Apple to not even bother installing it, they wouldn't want to get a reputation for having M$ type of security settings...
http://danconia.org
Ted Zeng - 25 Jun 2005 00:35 GMT My problem is it provides much more than I need.
I just need to log in to another Mac to execute commands there. I don't care securities, or anything. rlogin is good enough for me.
I don't want to copy a public key over to that machine ( I don't have to in Panther. But have to in Tiger) before I could talk to that machine. This is a nightmare to me.
ted
> non-linux systems, what doesn't Net::SSH::Perl or Net::SSH provide that > Net::Telnet would?
>> Thanks. You make it very clear. >> I have assumed they should be the same. [quoted text clipped - 30 lines] > > http://danconia.org Joel Rees - 25 Jun 2005 01:47 GMT > My problem is it provides much more than I need. Are your sure?
> I just need to log in to another Mac to execute > commands there. I don't care securities, or anything. > rlogin is good enough for me. Well, there is a company taking contracts from the credit card companies that "just needed some real world data to test something with" and "wasn't going to have that data where it could be accessed improperly". And how many hundreds of thousands of credit card numbers worldwide have been stolen?
> I don't want to copy a public key over to that machine ( I don't have > to > in Panther. But have to in Tiger) This doesn't really make sense. Are you sure that you didn't connect by hand in pather once, and answer the query about whether you would accept the certificate or not? Once the certificate was accepted, perl in Panther might have been accessing the user's .ssh?
Are there any environment files that didn't get transferred or rebuilt, or, if you just upgraded, were there some settings files that got erased?
> before I could talk to that machine. > This is a nightmare to me. Eventually, this kind of thing will get straightened out a bit. But we who write programs still need to be aware of when we need to identify and when we need to encrypt and when we can just spit data. (If we don't, who will?)
-- Joel Rees
msn.com and hotmail.com users take note -- Microsoft wants to refuse my mail if I don't use SenderID starting November. SenderID was refused as an internet standard and does not stop SPAM, and it contains a Microsoft patented algorithm. Draw your own conclusions.
Chris Devers - 25 Jun 2005 01:55 GMT > msn.com and hotmail.com users take note -- > Microsoft wants to refuse my mail if I don't use SenderID starting November. > SenderID was refused as an internet standard and does not stop SPAM, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> and it contains a Microsoft patented algorithm. > Draw your own conclusions. Not that I'm convinced it's a good idea, but...
IETF Approves SPF and Sender-ID
Posted by Zonk on 2005.06.24 15:57 from the protocols-forward dept.
NW writes "According to the records in the IETF's database (here and here), both the SPF and Sender-ID anti-spam proposals were tentatively approved by the IESG (the approval board of the IETF) as experimental standards. It remains to be seen whether any of them will actually put a dent into spam." At the same time, the FTC has opened a central site about email authentication.
<http://slashdot.org/article.pl?sid=05/06/24/1921210&threshold=5> <https://datatracker.ietf.org/public/pidtracker.cgi?command=view_id&dTag=12662&rf c_flag=0> <https://datatracker.ietf.org/public/pidtracker.cgi?command=view_id&dTag=12542&rf c_flag=0> <http://spf.pobox.com/> <http://www.microsoft.com/mscorp/safety/technologies/senderid/default.mspx> <http://www.ietf.org/iesg.html> <http://www.dmnews.com/cgi-bin/artprevbot.cgi?article_id=33190>
 Signature Chris Devers
Joel Rees - 25 Jun 2005 02:23 GMT >> msn.com and hotmail.com users take note -- >> Microsoft wants to refuse my mail if I don't use SenderID starting >> November. >> SenderID was refused as an internet standard and does not stop SPAM, > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I suppose I should twist my mouth properly when I say that.
Maybe, "SenderID was put on a non-standards track by the internet task force and does not stop SPAM,"?
>> and it contains a Microsoft patented algorithm. >> Draw your own conclusions. > > Not that I'm convinced it's a good idea, but... > > IETF Approves SPF and Sender-ID Yeah, that's the typical slashdot leader. Reader beware, do your own research.
As noted early in the threads there, "Experimental" is not standards-track. Watch out for the spin.
> Posted by Zonk on 2005.06.24 15:57 > from the protocols-forward dept. [quoted text clipped - 16 lines] > <http://www.ietf.org/iesg.html> > <http://www.dmnews.com/cgi-bin/artprevbot.cgi?article_id=33190> And the last one is the one I thank you for. I'll be sure to share my results with the Federal Trade Commission.
-- Joel Rees Getting involved in the neighbor's family squabbles is dangerous. But if the abusive partner has a habit of shooting through his/her roof, the guy who lives upstairs is in a bit of a catch-22.
Ted Zeng - 25 Jun 2005 02:31 GMT >> My problem is it provides much more than I need. > Are your sure? Of cause I am sure.
>> I just need to log in to another Mac to execute >> commands there. I don't care securities, or anything. [quoted text clipped - 5 lines] > improperly". And how many hundreds of thousands of credit card numbers > worldwide have been stolen? I know that. I know ssh is very useful in many cases. But I don't need it. The network is internal. And there is nothing in the machines that are worth protecting. In fact, I use telnet on PCs to deal with the same problem.
I have a solution that try to protect some credit card data from stolen to solve my problem that has nothing to protect.
>> I don't want to copy a public key over to that machine ( I don't have >> to [quoted text clipped - 4 lines] > accept the certificate or not? Once the certificate was accepted, perl > in Panther might have been accessing the user's .ssh? I reboot the machines and map the disk image to the drive every time. In Panther, the disk image doesn't have .ssh. I do set up an account and password in the disk image. I use password authorization to access Panther. But I could not do the same with Tiger. The perl script always ask me to type in password by hand. But my goal is automation. To avoid this, I have to put a public key to the target machine and use identity key authorization to access it.
I keep thinking there should be an option that would solve my problem. I have compared sshd_config files from Tiger and Panther today and just could not see how.
> Are there any environment files that didn't get transferred or > rebuilt, or, if you just upgraded, were there some settings files that > got erased? I have looked at the sshd_config files. It seems to me that is the only possible difference in settings.
>> before I could talk to that machine. >> This is a nightmare to me. [quoted text clipped - 3 lines] > and when we need to encrypt and when we can just spit data. (If we > don't, who will?) The problem is I know I just need to spit data, but I couldn't.
ted zeng
Joel Rees - 25 Jun 2005 03:16 GMT [...]
>> This doesn't really make sense. Are you sure that you didn't connect >> by hand in pather once, and answer the query about whether you would [quoted text clipped - 3 lines] > I reboot the machines and map the disk image to the drive every time. > In Panther, the disk image doesn't have .ssh. Hmm. So maybe the ssh libraries on Panther and Tiger default to different behavior when the user's settings are missing?
> I do set up an account and password in the disk image. I use password > authorization > to access Panther. Meaning, the script takes the password (passphrase?) query and answers it?
> But I could not do the same with Tiger. The perl script always ask me > to type in password > by hand. Is it possibly sending the query on STDERR instead of STDOUT? I think perl would allow you to redirect STDERR, if that's the case.
> But my goal is automation. To avoid this, I have to put a public key > to the target machine and use identity key authorization to access it. Yeah, keys certificates can be a pain to deal with in their current form. Would a self-certificate help? Openssl can do self-certificates as well as keys. (Maybe you've already tried that?)
> [...] >> Eventually, this kind of thing will get straightened out a bit. But [quoted text clipped - 3 lines] > > The problem is I know I just need to spit data, but I couldn't. Well, you are the best person to know whether the project wil live long enough to escape its cage, etc.
I'd suggest compiling and installing rsh or some such, but I really shouldn't. I think installing keys for ssh will work out simpler in the end.
-- Joel Rees If Microsoft is effectively taxing the internet, should we call it a sin tax?
Ted Zeng - 27 Jun 2005 19:02 GMT > [...] >>> This doesn't really make sense. Are you sure that you didn't connect [quoted text clipped - 7 lines] > Hmm. So maybe the ssh libraries on Panther and Tiger default to > different behavior when the user's settings are missing? It seems they are. It seems to behave differently when interacting with Net::SSH::Perl.
>> I do set up an account and password in the disk image. I use >> password authorization >> to access Panther. > > Meaning, the script takes the password (passphrase?) query and answers > it? Yes.
>> But I could not do the same with Tiger. The perl script always ask me >> to type in password >> by hand. > > Is it possibly sending the query on STDERR instead of STDOUT? I think > perl would allow you to redirect STDERR, if that's the case. I don't know. Because it is done by the Net::SSH:Perl module.
>> But my goal is automation. To avoid this, I have to put a public key >> to the target machine and use identity key authorization to access it. > > Yeah, keys certificates can be a pain to deal with in their current > form. Would a self-certificate help? Openssl can do self-certificates > as well as keys. (Maybe you've already tried that?) No, I don't. Thanks for this info. I will try to look it up.
>> [...] >>> Eventually, this kind of thing will get straightened out a bit. But [quoted text clipped - 10 lines] > shouldn't. I think installing keys for ssh will work out simpler in > the end. Thanks. I think so too.
ted zeng
> -- > Joel Rees > If Microsoft is effectively taxing the internet, > should we call it a sin tax? Wiggins d'Anconia - 02 Jun 2005 05:02 GMT > Hi, > [quoted text clipped - 10 lines] > need to change the Content-type or something to be able to call the > script again? Here is a sample of the script. I don't think what you are doing is possible. The reason is that the browser is only expecting one set of headers. The "Location" is just a special header, meaning I am sending you somewhere else as opposed to giving you content. The problem is that by the time you send the location, you have already provided a valid and full set of headers and everything following is *just* content including the location string. So it looks to the browser sort of like....
-- Begin Header -- ... Content-Type: text/html\n\n -- End Header -- -- Begin Content -- blah blah blah... Location: script.cgi ## I don't recognize new headers! -- End Content --
Which is why the location shows up in your saved file. MIME e-mail allows additional sets of headers for attachments by including boundaries, etc. but to my knowledge there is no way to do that over HTTP.
Theoretically you could accomplish the same goal by using a bit of client side stuffs, for instance print an HTML page that has a javascript onLoad that pops up a window or two that handles the download call, or you could use a "hidden" frameset that calls each of the downloads in a frame that has no height or width, though in this case the browser location bar won't be changing (or appear to be) and you will then have to worry about escaping back out of the frameset. I suspect there might be a way to get this to work using objects, or something similar like that but that is beyond my knowledge. There is also the new XMLRequest (aka Ajax) stuff but I haven't had time to read up on it so don't know if it is appropriate for this problem, nor how many browsers support it, though Google seems to think enough do to use it.
> Any ideas would be very helpful. Thanks very much, > > Mark > ------------------------------------------------------------------------ - HTH,
http://danconia.org
> <CODE> > [quoted text clipped - 10 lines] > > &save_file($htmlname); Drop the ampersands, that is old style and they shouldn't be needed here.
> print "Location: script.cgi?text\n\n"; > [quoted text clipped - 7 lines] > > &save_file($textname); Where did $textname come from, are you using 'strict' and 'warnings'? Your encapsulation is really severly broken.
> print "Content-type: text/html\n\n"; > [quoted text clipped - 31 lines] > > </CODE> Joel Rees - 02 Jun 2005 06:33 GMT > Which is why the location shows up in your saved file. MIME e-mail > allows additional sets of headers for attachments by including > boundaries, etc. but to my knowledge there is no way to do that over > HTTP. I've dug into what look like specifications for MIME over HTTP, but I've never been able to get it to work.
I have come to the conclusion that I should expect it to turn out to be another of those things that hasn't yet been implemented by anybody, except possibly in highly proprietary client/server implementations that nobody has ever seen. Definitely not in Moz or aIEeee.
Which leaves us with such work arounds as offering several links and hoping the user clicks all the links he wants (as Peter mentions), or feeding the user ECMAscript with events and timers and stuff that cause the user's browser to virtually click the links (per Wiggins's comments).
I've never been able to reliably produce a truly invisible frame in all the browsers. I think it's one of those areas where someone is trying to prevent the inherent security issues without really preventing them. One pixel wide frames just look cheap, not especially suspicious.
-- Joel Rees Re-inventing the wheel -- One of these days it'll be time to properly implement this wheel thing, bang off all the corners so it can actually roll.
Ken Williams - 03 Jun 2005 13:30 GMT >> Which is why the location shows up in your saved file. MIME e-mail >> allows additional sets of headers for attachments by including [quoted text clipped - 9 lines] > implementations that nobody has ever seen. Definitely not in Moz or > aIEeee. At my credit union, when they want me to download two PDFs at once, they pop up two separate windows to do it. I have to turn off my pop-up blocker in Safari, but except for that it works fine - one click, two files.
-Ken
Joel Rees - 03 Jun 2005 15:38 GMT >>> Which is why the location shows up in your saved file. MIME e-mail >>> allows additional sets of headers for attachments by including [quoted text clipped - 14 lines] > pop-up blocker in Safari, but except for that it works fine - one > click, two files. I'd guess that's ECMAscript rather than MIME. Unless you are getting two save dialogues, it's fairly straightforward.
Mark Wheeler - 02 Jun 2005 08:02 GMT Hi all,
Thanks for all your input. What I decided to do was put up a page that had links to download each of the two files. That is working great. I remember doing the "onLoad" thing before, too. That also works great.
Thanks again,
Mark
PChase - 02 Jun 2005 23:48 GMT Hi,
I am trying to send email using MIME::Lite.pm. On one computer it works fine, and on another I get this warning and the mail is not sent: postdrop: warning: unable to look up public/pickup: No such file or directory
Both have Mac OS X, v 10.3.9
What could be wrong?
Thanks.
pc
Dave Gomez - 03 Jun 2005 03:13 GMT PC, sounds like one of two things, mail is not setup correctly, or you are using possibly an account without priveledges.
Dave
> Hi, > [quoted text clipped - 11 lines] > > pc Peter N Lewis - 02 Jun 2005 05:46 GMT >I'm having a problem with redirecting (Location: script.cgi) after a >file has been downloaded. First off, the Location field *must* be an absolute URL, it is not allowed to be a relative URL (so says the specification).
>Here is the gist of the script. It creates two files (one html, the >other text), then a download dialog box comes up so the first newly [quoted text clipped - 5 lines] >file. Do I need to change the Content-type or something to be able >to call the script again? Here is a sample of the script. You cannot respond to a single request from the browser with two responses (one for the first file and one the Location redirect). If you could, you would not need to do what you're doing, you would be able to respond with two responses, one for each file.
You could possibly return two files by sending a multipart response containing both files. I've never tried this myself, or even ever seen this done, but it might be possible.
Obviously, what you could do is return a web page with two links and get the user to click both to download both files.
But then again, maybe I'm misunderstanding what you're trying to do. Peter.
>Any ideas would be very helpful. Thanks very much, > [quoted text clipped - 63 lines] > ></CODE>
 Signature <http://www.stairways.com/> <http://download.stairways.com/>
|
|
|