RE: Is it possible to change the browser's address/location URL without Redirect?
One option: If there's an erro in form 2, Save the user's form data in some session variables Then use a META HTTP-EQUIV=Refresh CONTENT=0; URL=/step2 tag to get the user's browser to redirect. Then populate the form with the data and error message you saved in his/her session object. There are obviously many other ways to do this... but if you're using some sort of session data structure, this is probably the easiest way to get it done. Shawn -Original Message- From: Harry Zhu [mailto:[EMAIL PROTECTED]] Sent: August 9, 2002 2:26 PM To: [EMAIL PROTECTED] Subject: Is it possible to change the browser's address/location URL without Redirect? Looks like my explanation is too long or too bad. The simple idea is in page step 1, after the form action=/step/2 method=post.../form submitted, I want the browser show something http://www.example.com/step/1/error, instead of http://www.example.com/step/2, if there is a need for user to correct the data submitted. It might be accomplished by using one of the approaches outlined below, but I was wondering if there's other way that can save the overhead of the write/read or resend the data, and the re-process. Probably not much we can do if the URL displayed in the browser's address/location bar depends only on the action value of the form submitted, not based on the server response? Harry - Original Message - From: Harry Zhu [EMAIL PROTECTED] To: mod_perl list [EMAIL PROTECTED] Sent: Thursday, August 08, 2002 4:22 PM Subject: Can I change the browser's address/location? Suppose I have a generic content handler to handle requst /step/1, /step/2, ..., /step/n Location /step SetHandler perl-script PerlHandler MyHandler /Location #MyHandler.pm package MyHandler; sub handler { my $r=shift; my $step = substr($r-path_info(),1); #do something before fetch the content #fetch content: usually include a form that will assign action /step/($step+1) } So if everything goes well, the user will follow through from step 1, step 2, until fnish. Now if in the #do something ... part, something is wrong, it will usually require user go back to the same step, for example, to fill the form again. The way my old cgi script does is just generate the form with prefilled value plus some error message indicate what's wrong. It works ok but the browser location will show /step/($step+1) while it actually is /step/$step. Now that I am working it on mod-perl I thought I should be able to do something about it. I briefly browsed the 2 mod-perl books (eagle, cookbook), and could not found a simple solution yet (or I missed it?). I was think using one of the folowing might work:z 1) save the request data in a temp file and redirect or http-refresh to /step/$step?$session_id or /step/$step/error?$session_id Remember the content is dynamic and depend on the input form data, so simple redirect may not work. Looks like Apache will not post the form data when redirect with Location? 2) print a short form with hidden data and assign action=/step/$step/error then submit right away (onload=form.submit()?) Does anybody have a simple solution, e.g. without redirect? Is it possible to change the URI showing in the browser's address/location bar? I would appreciated if somebody can pointer me to the right direction. Harry
Problem: Apache2 / Perl 5.8.0 / mod_perl 2.0 / PHP all on Win32
I am in a bit of a jam. I think the cross-post is necessary since I need the help of Apache, mod_perl, and PHP developers/users. I apologize for the length, if you have time, my explanation (at the end) should clarify what I mean. Summary --- I need: - A perl-enabled web server to run on the win32 platform - mod_perl to allow for persistent (stay connected on the server side) Net::Telnet objects (CGI is unacceptable since a new process is spawned at each request leaving no room for persistent objects) - Multiple perl interpreters of Apache2 / mod_perl 2.0 to serve more than one mod_perl request at a time - Access to the client's Net::Telnet object during all of his/her requests throughout his/her session - I might need Perl 5.8.0 for threads::shared to solve the above problem - A way for mod_perl scripts to communicate with PHP scripts quickly and efficiently Does anybody know what kind of configuration I could use to support all of my needs above? Does anybody know another way for mod_perl 2.0 and PHP to communicate other than apache_notes (if it's true I can't use apache_notes with Apache2 / PHP 4.2.X)? If a solution is not available now (ie. I can't share Net::Telnet objects in different requests, or, PHP isn't fully supporting Apache2), when will it be available (if ever)? Thanks for your time and any help, Shawn Brief (?) Explanation - I need a win32 server to provide a sort of web-interface to perl Net::Telnet objects (which is just a wrapper for telnet sessions written in perl). These objects open sockets/file_handles on the server and have to be accessible to my server-side scripts throughout multiple client requests. ie. A session for Client_123 might look like: Request 1: Client_123's telnet object is initialized (connects to a remote telnet host) Request 2 - n-1: A script on the server executes commands on Client_123's telnet connection Request n: Client_123's telnet object is destroyed From mod_perl 2.0 docs (http://perl.apache.org/docs/2.0/os/win32/install.html): A mod_perl 1.0 enabled server based on Apache 1.3 on Win32 is limited to a single thread serving a request at a time. This effectively prevents concurrent processing, which can have serious implications for busy sites. This problem is addressed in the multi-thread/multi-process approach of mod_perl 2.0/Apache 2.0 Obviously I need Apache2/mod_perl2 if I want to be able to have more than one client request executing perl code at the same time. However, I need to make sure that the Net::Telnet object is accessible (ie. in shared memory, indexed by the clients session_id) for all of Client_123's request. I was told that I might be able to use threads::shared to keep the Net::Telnet objects accessible by multiple mod_perl threads in mod_perl2 and Perl 5.8.0 so that shouldn't be a problem... as long as I use Apache2 / mod_perl 2.0 / Perl 5.8.0. Thrown in to the mix is the fact that I need some PHP scripts to communicate (transfer parameters) to mod_perl scripts, and for the mod_perl to transfer the results back to the PHP scripts. I have this working using apache notes in Apache1.3.26 / mod_perl 1.27 / PHP 4.21. However (as mentioned above) only one mod_perl request (involving telnet stuff) can be served at a time so I need to upgrade to Apache2, where there isn't apache_note support (http://bugs.php.net/bug.php?id=17557).
Persistent Net::Telnet Objects in Apache2/mod_perl2
Hey everyone, It's me again... the persistent telnet mod_perl newbie! (http://msgs.securepoint.com/cgi-bin/get/apache0205/204.html) I have implemented my project using persistent telnet connections (one for each user session accessible throught the session to perform various functions through telnet) on win2000: Apache/1.3.26 (Win32) mod_perl/1.27_01-dev Now for my next trick! When I started I didn't realize that mod_perl on win32 could only handle one request at a time!!! This is obviously not acceptable for deployment. So, I would like to upgrade to Apache2/mod_perl2 to take advantage of the multi-process mod_perl model that the _very_ kind Randy Kobes told me about (http://groups.google.ca/groups?dq=hl=enlr=ie=UTF-8oe=UTF-8selm=afv3gu% 24qt2%242%40canopus.cc.umanitoba.ca). However, with a multi-process model, I'm not sure how I will be able to keep a user's telnet-session-object accessible throughout multiple requests. Currently it's not a problem since there's only one process for ALL mod_perl requests. In Apache2/mod_perl2 there will be more than one process so I need some sort of mapping to make sure my clients are aways served by the same process. Is this possible? Am I in way over my head (again!!) ? Another problem is that I have also been informed that my _MUCH_ used apache_notes function in php will not be available to me in Apache2 (http://bugs.php.net/bug.php?id=17557). I realize this is an Apache2 thing, but I was wondering if anyone here knows of a workaround that will allow my php scripts to communicate with mod_perl (and vice-versa) until (hopefully) the function is ported to Apache2. Thanks in advance, Shawn French AcceLight Networks 613.266.4753 [EMAIL PROTECTED]
RE: Persistent Net::Telnet Objects in Apache2/mod_perl2
Stas Bekman wrote: It seems that you are after the same functionality as Apache::DBI, you want a pool of items that you want to be able to choose from. Look for threads::shared (perl 5.8.0), just create a shared hash with keys that you use for the map and the values for the actual connection objects. YES!!! That is exactly what I need! Where do I find perl 5.8.0 and threads::shared? I need a perl binary for windows since I'm without a compiler... As for the apache notes, I hope your right that it would be easy to implement, otherwise I can't upgrade to apache2 without some _huge_ workarounds... which are always nice to avoid :) Shawn
RE: Persistent Net::Telnet Objects
I just found this: http://www.devshed.com/Talk/Books/ProApache/page2.html On Windows platforms, Apache does not fork; consequently, the directives for controlling the number of processes or their lifetime have no effect. Instead, Apache runs as a multi-threaded process Recall that I am using: Apache/1.3.20 (Win32) mod_perl/1.25_01-dev mod_ssl/2.8.4 OpenSSL/0.9.6a on Windows 2000 with PHP 4.21 Would this be why my scripts are working? Does this mean that as long as I stay with windows I will be alright? I realize (as Medi Montaseri pointed out) that my scripts might not be too secure (ie. hijacking a telnet session) however I am only concerned about getting this working, and making sure it will remain working, as it will be run behind a firewall in a corporate intranet. For now I will continue coding with my current architecture hoping that the above mentioned information is correct. Thanks for all the help! Shawn