Secure Apache Server with mod_ssl and openssl

2001-05-22 Thread Emma Wermström (EMW)

Hi!

RedHat Linux 7.1
Apache 1.3.19
Perl 5.005
mod_perl 1.24
embperl 
mod_ssl and openssl (precompiled from RedHat Linux 7.1)

I'm trying to establish an SSL link between browser and apache web server.
Before, I had a web page located in two different directories (bla/bla/htdocs/Intro 
and /bla/bla/htdocs/CIP). The idea is that the first directory should use the 
non-secure server and the second should use the secure server. I only want to use ONE 
ip-adress. I tried setting up the following environment in my httpd.conf file:

  Listen 443


DocumentRoot "/bla/bla/htdocs/CIP"
ServerName localhost
SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
Files ~ "\.(cgi|shtml)$">
SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
Error_log /var/log/httpd/ssl_error_log
CustomLog /var/log/httpd/ssl_request_log \
  "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"



I'm also using AuthCookie to provide authentication procedure in order to enter the 
protected directory (/CIP). I specify the login handling procedures for ../CIP in 
the .htaccess file.

I want to be able to access the unprotected documents(http://...) and from them, the 
protected documents(https://) without having to write https explicitly.
But with the above configuration, none of the documents require SSL. 

When I add the following to my conf file before the virtual host, I get an error 
message saying "SSL connection required" in my error_log and I can't enter the 
protected directory.


SSLrequireSSL


Is this something I can specify in the browser I'm using? I'm using a self-signed 
certificate along with the generated key.

Does anyone understand my dilemma? the ssl_error_log shows nothing and I can't enter 
https://localhost.
I'd be grateful for any help on this matter. I've tried the RedHat secure web server 
tutorial but I still don't understand how to configure the webserver for the two 
different directories.
Thanks,

Emma





Re: Real Widgets and Template Languages

2001-05-22 Thread Cees Hek

On Wed, 23 May 2001, Gunther Birznieks wrote:

> Hmmm. I had not thought of this because we do not provide this capability 
> now in the Java widget library that we have and we don't really miss it.
> 
> For color, most UI widgets do not have color. For font and height, I think 
> that most designers don't change this often and if they do, it can be 
> adjusted in the config file ... usually the widgets themselves don't change 
> -- it's the stuff around the forms that do 90% of the time.

I guess what I am really thinking about is things like JavaScript Events.  
The widget would be able to automatically add an onChange JS function to
do client side validation of data.  But a designer might want to add an
onMouseOver to a widget that will display a layer with a hint describing
how that field should be filled in.

You could just add support for MouseOver Hints to the widget library, but
I could probably come up with a bunch of other things a designer might
want to change on a widget to get it to do, and look how they want.

Cees




Re: Real Widgets and Template Languages

2001-05-22 Thread Gunther Birznieks

At 08:54 PM 5/23/2001 +1000, Cees Hek wrote:

>On Tue, 22 May 2001, Gunther Birznieks wrote:
>
>
>This sounds very useful and powerful.  I've been looking for a project to
>help out with, and this one sounds interesting to me.  Let me know if you
>want some help developing it, or someone to bounce ideas off...

Yes!

> > 
> >First Name:
> >Last Name:
> >Comments
> > 
>
>One thing that I think is very important is to let designers have control
>over the look and feel of the interface.  Your widget library should have
>some mechanism to allow a template designer to specify attributes for a
>widget (like width, height, colour, etc...).
>
>
>- or -
>
>
>You can still allow programmers to have control over how the data is
>verified, and other attributed like maxlength for text fields and
>such.
>
>Of course these attributes will not be useful in every type of widget.
>ie if the programmer decided that this widget is going to be a text field
>instead of a textarea, then the above height attribute would be useless,
>and ignored.

Hmmm. I had not thought of this because we do not provide this capability 
now in the Java widget library that we have and we don't really miss it.

For color, most UI widgets do not have color. For font and height, I think 
that most designers don't change this often and if they do, it can be 
adjusted in the config file ... usually the widgets themselves don't change 
-- it's the stuff around the forms that do 90% of the time.

However, it does bring up an interesting point. On the one hand, I want to 
abstract away from the designer what the widget is. For example, it should 
be up to the app developer whether I use a textfield or a text area. But 
defining a "width" for a text area is very different from defining a width 
for a text field.

I realize that in the ideal world we would separate these concerns out. But 
having tried it the HTML::StickyWidgets way and the application widget way, 
I know that I like the application widget way better.  I think there is 
room for your idea though but I haven't honestly thought about it.





Re: Real Widgets and Template Languages

2001-05-22 Thread Gunther Birznieks

At 02:26 PM 5/22/2001 -0400, kyle dawkins wrote:
>On Tue, 22 May 2001 06:25, Matt Sergeant wrote:
> > On Tue, 22 May 2001, Gunther Birznieks wrote:
> > > I want/need a *Perl* solution!
> >
> > Well if you can pay for it... (still unemployed here and getting poorer
> > waiting for people to possibly say yay or nay on possible contracts...)
>
>Ummm... you guys could look at
>
>http://www.smartworker.org

Ummm... you could also read my first post on the subject which already 
mentioned smartworker. Smartworker isn't what we need to accomplish what I 
am talking about.

Smartworker has a great UI framework but it is a UI framework. It does not 
operate at the level of application logic which is the level I wish to have 
widgets operate under.

I realize this is a difficult concept to both explain and understand. 
Hopefully the rest of my post will put it in a different nutshell.


>And if that's not your cup of tea, I should be releasing something sometime
>in the fairly near future that will be.

I am not sure. It would be great if that was the case!

Could you describe in a few sentences what you will be releasing? I don't 
think you precisely understood what I was asking for or read my entire post 
if you just forwarded me to smartworker again, so I hope you forgive my 
skepticism. As mentioned, if what you can provide does what I want, then 
that would be great.

What I don't want: Another HTML Widget library or another UI library

What I do want: A way of logically specifying an application-based widget 
(eg post something saying  that is intelligent enough to 
know how to render itself based on an application config.







RE: Connection to MySQL DB fails when mod_perl enabled...

2001-05-22 Thread Bird Lei

At 03:28 AM 2001/5/22 +0100, you wrote:

>Incidentally, I am using the following module versions:
>
>DBD-MySQL [1.2214];
>DBI [1.13]
>
>Does this have any bearing on my problem?


Does reinstalling the DBI help?  I had problem with DBI before.  I just 
reinstalled it and it works fine.  (I can just ignore everything and 
reinstall it because it's just my test server...)  I didn't check what 
caused the problem tho.

Bird




Re: Apache::Session not storing changes to hashref

2001-05-22 Thread Cees Hek


Apache::Session only does a shallow check of your data structure to see if
it needs to update the database.  If you are only changing values deep
inside a hash structure, A::S will not see the changes, and they will not
be saves.  The man page recommends adding a timestamp to the tied hash and
updating that on every request (ie $s{_timestamp} = time;).

Cees

On Tue, 22 May 2001, Chris Thompson wrote:

> I'm at wits end, I'm hoping someone can tell me what's wrong.
> 
> This is Apache 1.3.19, Redhat 6.2, modperl 1.25, apache::session 1.53
> and MySQL 3.23.36.
> 
> (This is also happening inside HTML::Mason 1.03, but I dont think that has
> anything to do with it. I've crossposted to the mason list in case anyone
> there has seen this behavior, but what I'm doing isnt really out of the
> ordinary, so I dont think it's Mason related)
> 
> I've got a hash %s successfully re tied every request. I'm using it to store
> a session id and userid with success, so I know it's storing.
> 
> Maybe I'm doing too much for A::S but here goes.
> 
> I want an entry in the %s hash that is an array of hashrefs
> 
> so tied-hash -> array -> hash.
> 
> I'm writing this in wizard style, getting one piece of information from the
> client per page. The first step is to get a list of domain names, which I do
> and store in @domain.
> 
> then I do
> 
>   my $c=0;
>   foreach my $dom (@domain) {
>my $ref = { 'domainname' => $dom,
>'term' => '',
>'ns1name' => '',
>'ns1ip' => '',
>'ns2name' => '',
>'ns2ip' => ''
>  };
>$s{regdomains}->[$c++] = $ref;
>   }
> 
>   this data is all successfully stored in the session.
> 
>   We now move to the second page, and if I do a Data::Dumper on %s, I can
> actually see the above structure as I envisioned it.
> 
> (I'll paraphrase here and not paste the whole dump)
> 
>   'regdomains' => [
> {
>   'ns1name' => '',
>   'ns2ip' => '',
>   'domainname' => 'qwert.com',
>   'term' => '2',
>   'ns2name' => '',
>   'ns1ip' => ''
> },
> 
> Note that 'term'=> '2'.
> 
> That's there because before I did the Dumper, I populated the %s with the
> data I had on the term. Each term is read from Apache::Request into
> @term. (Yes, the orders match)
> 
> so I do...
> 
>   my $c=0;
>   foreach my $term (@term) {
>$s{regdomains}->[$c++]->{term} = $term;
>   }
> 
> Then I do the Dumper. You can see the result above. Term is set, and I've
> verified by changing the term per domain name that the data is going in
> correctly.
> 
> Now, as I understand it, the tie is causing any data written into the hash
> to be written to the database.
> 
> The problem is that it's not. When I get to my third page I get four fields
> per domain for the nameservers and assign into the hash with...
> 
>   my $c=0;
>   foreach (@{$s{regdomains}}) {
>$s{regdomains}->[$c]->{ns1name} = $nsn1[$c];
>$s{regdomains}->[$c]->{ns1ip} = $nsip1[$c];
>$s{regdomains}->[$c]->{ns2name} = $nsn2[$c];
>$s{regdomains}->[$c]->{ns2ip} = $nsip2[$c];
>$c++;
>   }
> 
> I then do a Dumper and get...
> 
> 
>   'regdomains' => [
> {
>   'ns1name' => 'a',
>   'ns2ip' => 'd',
>   'domainname' => 'qwert.com',
>   'term' => '',
>   'ns2name' => 'c',
>   'ns1ip' => 'b'
> },
> 
> you'll see that term is now empty. I've watched the db, and reading it's
> cryptic scrawl, I never see any entries for term.
> 
> HELP!
> 
> 
> 

-- 
Cees Hek
SiteSuite Corporation
[EMAIL PROTECTED]




Re: Real Widgets and Template Languages

2001-05-22 Thread Cees Hek


On Tue, 22 May 2001, Gunther Birznieks wrote:

> What I am really looking for is a library that abstracts and allows widgets 
> to be developed that are tied to an application not to a set of HTML 
> necessarily. I guess I will start by providing an example of what I want 
> based on what we currently do in our Java framework when he use Templating 
> there. I'd like it if someone has developed the same thing in Perl that we 
> could reuse, otherwise, we may need to write this.

This sounds very useful and powerful.  I've been looking for a project to
help out with, and this one sounds interesting to me.  Let me know if you
want some help developing it, or someone to bounce ideas off...

> 
>First Name:
>Last Name:
>Comments
> 

One thing that I think is very important is to let designers have control
over the look and feel of the interface.  Your widget library should have
some mechanism to allow a template designer to specify attributes for a
widget (like width, height, colour, etc...).


- or -


You can still allow programmers to have control over how the data is
verified, and other attributed like maxlength for text fields and
such.  

Of course these attributes will not be useful in every type of widget.  
ie if the programmer decided that this widget is going to be a text field
instead of a textarea, then the above height attribute would be useless,
and ignored.


Cees





Re: Apache::Session not storing changes to hashref

2001-05-22 Thread Jeffrey W. Baker



On Tue, 22 May 2001, Chris Thompson wrote:

> I'm at wits end, I'm hoping someone can tell me what's wrong.
>
> This is Apache 1.3.19, Redhat 6.2, modperl 1.25, apache::session 1.53
> and MySQL 3.23.36.
>
> (This is also happening inside HTML::Mason 1.03, but I dont think that has
> anything to do with it. I've crossposted to the mason list in case anyone
> there has seen this behavior, but what I'm doing isnt really out of the
> ordinary, so I dont think it's Mason related)



> That's there because before I did the Dumper, I populated the %s with the
> data I had on the term. Each term is read from Apache::Request into
> @term. (Yes, the orders match)
>
> so I do...
>
>   my $c=0;
>   foreach my $term (@term) {
>$s{regdomains}->[$c++]->{term} = $term;
>   }



Check the Apache::Session docs.  Your changes below the toplevel will not
be noticed.  You must either change something at the top level (like a
timestamp or serial number), or you must frob the session object via
tied(%session)->make_modified();

Docs are your friend and I spent a lot of time writing them.

-jwb






Re: [Mason] Apache::Session not storing changes to hashref

2001-05-22 Thread Dave Baker


--sm4nu43k4a2Rpi4c
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, May 22, 2001 at 03:59:52PM -0400, Chris Thompson wrote:
> I'm at wits end, I'm hoping someone can tell me what's wrong.

[snip]

This is documented (Apache::Session doesn't recurse into the data
structure to look for changes) somewhere ...

I use this whenever changing the session to force it to always get written
back to the database:
  tied(%session)->make_modified;

Dave


--=20

-  Dave Baker  :  [EMAIL PROTECTED]  :  [EMAIL PROTECTED]  :  http://dsb3.com/
GnuPG: 1024D/D7BCA55D / 09CD D148 57DE 711E 6708  B772 0DD4 51D5 D7BC A55D


--sm4nu43k4a2Rpi4c
Content-Type: application/pgp-signature
Content-Disposition: inline

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.5 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7CujhDdRR1de8pV0RAqs9AJ9kk7njnzmOxBxxHil5gzKcwH0btACgiOi1
+UT3Yah27RAff02JB486JD0=
=SNvV
-END PGP SIGNATURE-

--sm4nu43k4a2Rpi4c--



Re: Appending Sessionid to all the urls

2001-05-22 Thread Jay Jacobs

there's always more then one way...

DocumentRoot "/usr/local/apache_mp/htdocs"
RewriteEngine On
RewriteCond /usr/local/apache_mp/htdocs/%{REQUEST_FILENAME} !-f
RewriteRule /?S=([^/]+)/(.*) /$2 [E=SESSION_ID:$1]

This sets $ENV{SESSION_ID} to the session ID, but also catches it, if by
some bizarre and unlikely circumstance your have a directory that matches
someone's Session ID.  In this case the session is:
http://host.domain.com/S=asdfasdf/path/requested.pl

Using mod rewrite also munges the $r->filename which helped things like
mason that looked for it (don't know if it still does).

Jay


On Tue, 22 May 2001, Joachim Zobel wrote:

> At 18:06 22.05.2001 +0800, you wrote:
> >
> >For instance when i access url
> >http://www.nus.edu.sg?sessionid=dfd3453
> >i want all the urls to be appended in all the urls of that website..
> >
> >My qns is everytime i found that the session id is lost... through the
> >many requests and responses.
> >And the new url does not reflect on the client browser..
> >
> >Any one got any idea.. what wrong with my program??
> >
>
> Wrong concept.
> Use a sid in the URL path like
> http://www.nus.edu.sg/sessionid-dfd3453/this/is/it.pl
> Use mod_rewrite to remove /sessionid-\w+
> Use only relative links.
>
> Thats it. You can get the sessionid by parsing $ENV{REQUEST_URI}
>
> Hth,
> Joachim
>
> --
> "... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden
> koennen."- Bertolt Brecht - Leben des Galilei
>
>




Re: Connection to MySQL DB fails when mod_perl enabled...

2001-05-22 Thread Jonathan M. Hollin

My Lords, Ladies and Gentlemen,

I am delighted to announce that this problem is now SOLVED.  That is, I can
now access my MySQL database from a Perl script running under mod_perl.

I won't detail the whole sorry affair again, but the rogue line read:

$dsn = "DBI:$driver:database=shapeshifter;host=localhost";

I must offer special thanks to Guido Moonen [[EMAIL PROTECTED]] who
suggested "In the error log is a error code 10061 (Which stands for
connection refused) this means that the application cannot even open a
connection to the mysql server.  Maybe you should also provide the DSN with
a port number.  Or try to use 127.0.0.1 instead of localhost."  I did try
changing "localhost" to 127.0.0.1 (and also tried the actual IP address of
the computer).  This generated a whole new set of error messages that
finally showed me the light.

Two things were wrong:

1)  I was using "localhost" when I should have been using an IP address

2)  (you're not going to believe this)  My firewall was dropping all
requests between mod_perl (running on my machine) and the MySQL server (on
my LAN) - yet it was allowing the same request using CGI rather than
mod_perl, we're still trying to figure out why

I adjusted both and got the output I have spent 36 hours seeking.

I would like to thank every single person who took the time to offer their
invaluable advice and help.  I would also like to apologise for the huge
volume of traffic this problem generated within the list.  I'm sorry.

Thanks again Guido.

Kindest regards,
Jonathan M. Hollin
Digital-Word.com




Re: Apache::ASP error re: subroutines

2001-05-22 Thread Joshua Chamas

Andrew Koebrick wrote:
> 
> Howdy,
> 
> I am attempting to move a few subroutines from my Apache::ASP pages into a central 
>module, but get the error:
> 
> Undefined subroutine &Apache::ASP::Demo::date_swap called at (eval 6) line 67. , 
>/usr/lib/perl5/site_perl/5.6.0/Apache/ASP.pm line 1506

PerlSetVar GlobalPackage is set to Apache::ASP::Demo I bet, and you called
the sub date_swap() which was not defined there.

> 
> Is there something funky in the Apache::ASP environment regarding how/where modules 
>are handled?  The functions work when in the page, so I dont think there is an 
>internal error there.  I am calling the module with a basic "use ASK" (ASK.pm is the 
>module name).  The module has appropriate ownership/rights.
> 

If you sub is in ASK.pm, then you can reference it like:

  &ASK::date_swap()

or you could define the sub in the global.asa, which takes
on the package name from GlobalPackage, so the sub will be 
in the same package that all your scripts are compiled into.

> I am especially curious why it is looking for dateswap under Apache::Demo::XXX
> 

This is the package that your ASP scripts & includes are compiled into.

Also there is a new mailing list for Apache::ASP at [EMAIL PROTECTED],
but I have been slow to update the docs at the ASP web site & README.

--Josh

_
Joshua Chamas   Chamas Enterprises Inc.
NodeWorks >> free web link monitoring   Huntington Beach, CA  USA 
http://www.nodeworks.com1-714-625-4051



Apache::Session not storing changes to hashref

2001-05-22 Thread Chris Thompson

I'm at wits end, I'm hoping someone can tell me what's wrong.

This is Apache 1.3.19, Redhat 6.2, modperl 1.25, apache::session 1.53
and MySQL 3.23.36.

(This is also happening inside HTML::Mason 1.03, but I dont think that has
anything to do with it. I've crossposted to the mason list in case anyone
there has seen this behavior, but what I'm doing isnt really out of the
ordinary, so I dont think it's Mason related)

I've got a hash %s successfully re tied every request. I'm using it to store
a session id and userid with success, so I know it's storing.

Maybe I'm doing too much for A::S but here goes.

I want an entry in the %s hash that is an array of hashrefs

so tied-hash -> array -> hash.

I'm writing this in wizard style, getting one piece of information from the
client per page. The first step is to get a list of domain names, which I do
and store in @domain.

then I do

  my $c=0;
  foreach my $dom (@domain) {
   my $ref = { 'domainname' => $dom,
   'term' => '',
   'ns1name' => '',
   'ns1ip' => '',
   'ns2name' => '',
   'ns2ip' => ''
 };
   $s{regdomains}->[$c++] = $ref;
  }

  this data is all successfully stored in the session.

  We now move to the second page, and if I do a Data::Dumper on %s, I can
actually see the above structure as I envisioned it.

(I'll paraphrase here and not paste the whole dump)

  'regdomains' => [
{
  'ns1name' => '',
  'ns2ip' => '',
  'domainname' => 'qwert.com',
  'term' => '2',
  'ns2name' => '',
  'ns1ip' => ''
},

Note that 'term'=> '2'.

That's there because before I did the Dumper, I populated the %s with the
data I had on the term. Each term is read from Apache::Request into
@term. (Yes, the orders match)

so I do...

  my $c=0;
  foreach my $term (@term) {
   $s{regdomains}->[$c++]->{term} = $term;
  }

Then I do the Dumper. You can see the result above. Term is set, and I've
verified by changing the term per domain name that the data is going in
correctly.

Now, as I understand it, the tie is causing any data written into the hash
to be written to the database.

The problem is that it's not. When I get to my third page I get four fields
per domain for the nameservers and assign into the hash with...

  my $c=0;
  foreach (@{$s{regdomains}}) {
   $s{regdomains}->[$c]->{ns1name} = $nsn1[$c];
   $s{regdomains}->[$c]->{ns1ip} = $nsip1[$c];
   $s{regdomains}->[$c]->{ns2name} = $nsn2[$c];
   $s{regdomains}->[$c]->{ns2ip} = $nsip2[$c];
   $c++;
  }

I then do a Dumper and get...


  'regdomains' => [
{
  'ns1name' => 'a',
  'ns2ip' => 'd',
  'domainname' => 'qwert.com',
  'term' => '',
  'ns2name' => 'c',
  'ns1ip' => 'b'
},

you'll see that term is now empty. I've watched the db, and reading it's
cryptic scrawl, I never see any entries for term.

HELP!


-- 

| Chris Thompson  [EMAIL PROTECTED] | 
+--+



Re: Connection to MySQL DB fails when mod_perl enabled...

2001-05-22 Thread Jonathan M. Hollin

My Lords, Ladies and Gentlemen,

I am delighted to announce that this problem is now SOLVED.  That is, I can
now access my MySQL database from a Perl script running under mod_perl.

I won't detail the whole sorry affair again, but the rogue line read:

$dsn = "DBI:$driver:database=shapeshifter;host=localhost";

I must offer special thanks to Guido Moonen [[EMAIL PROTECTED]] who
suggested "In the error log is a error code 10061 (Which stands for
connection refused) this means that the application cannot even open a
connection to the mysql server.  Maybe you should also provide the DSN with
a port number.  Or try to use 127.0.0.1 instead of localhost."  I did try
changing "localhost" to 127.0.0.1 (and also tried the actual IP address of
the computer).  This generated a whole new set of error messages that
finally showed me the light.

Two things were wrong:

1)  I was using "localhost" when I should have been using an IP address

2)  (you're not going to believe this)  My firewall was dropping all
requests between mod_perl (running on my machine) and the MySQL server (on
my LAN) - yet it was allowing the same request using CGI rather than
mod_perl, we're still trying to figure out why

I adjusted both and got the output I have spent 36 hours seeking.

I would like to thank every single person who took the time to offer their
invaluable advice and help.  I would also like to apologise for the huge
volume of traffic this problem generated within the list.  I'm sorry.

Thanks again Guido.

Kindest regards,
Jonathan M. Hollin
Digital-Word.com




Re: Appending Sessionid to all the urls

2001-05-22 Thread Joachim Zobel

At 18:06 22.05.2001 +0800, you wrote:
>
>For instance when i access url 
>http://www.nus.edu.sg?sessionid=dfd3453
>i want all the urls to be appended in all the urls of that website..
>
>My qns is everytime i found that the session id is lost... through the 
>many requests and responses.
>And the new url does not reflect on the client browser..
>
>Any one got any idea.. what wrong with my program??
>

Wrong concept.
Use a sid in the URL path like 
http://www.nus.edu.sg/sessionid-dfd3453/this/is/it.pl
Use mod_rewrite to remove /sessionid-\w+
Use only relative links.

Thats it. You can get the sessionid by parsing $ENV{REQUEST_URI}

Hth,
Joachim

--
"... ein Geschlecht erfinderischer Zwerge, die fuer alles gemietet werden
koennen."- Bertolt Brecht - Leben des Galilei




Re: Real Widgets and Template Languages

2001-05-22 Thread jay

Hey all,

I have been giving this very subject area a lot of thought myself - I would like to 
really make a push for HTML/interface widgets in Perl. Have done some work to that end 
and have a lot of ideas.

In addition I was thinking about making an investment of time and resources into this 
idea to bring it to something useful and exciting for developers.

Was just starting to solicit opinions from developers myself.

Would be glad to chip in to a common effort here!

Jay

On Tue, 22 May 2001, Adi Fairbank wrote:

> 
> Gunther,
> 
> I have been interested in the concept of an HTML widget module for a while
> now.  The reason being, my application currently generates all HTML using
> CGI.pm in a mod_perl handler OO-style design, and we are starting to notice
> patterns.. similar pieces of HTML that get generated over and over. 
> Needless to say, componentized, reusable widgets would be very useful for
> us.
> 
> Though I can't make the commitment of writing it myself (if I did, it would
> be about 6 months before you saw any code), I would definitely contribute to
> it, if it existed.  And like you said, the hard part is getting people to
> write the widget objects.
> 
> -Adi





Apache::ASP error re: subroutines

2001-05-22 Thread Andrew Koebrick

Howdy,

I am attempting to move a few subroutines from my Apache::ASP pages into a central 
module, but get the error:

Undefined subroutine &Apache::ASP::Demo::date_swap called at (eval 6) line 67. , 
/usr/lib/perl5/site_perl/5.6.0/Apache/ASP.pm line 1506 

Is there something funky in the Apache::ASP environment regarding how/where modules 
are handled?  The functions work when in the page, so I dont think there is an 
internal error there.  I am calling the module with a basic "use ASK" (ASK.pm is the 
module name).  The module has appropriate ownership/rights. 

I am especially curious why it is looking for dateswap under Apache::Demo::XXX

Any assistance appreciated.  This is my first module and so my error could be 
anywhere, as my ignorance is everywhere.

ASK

Andrew Koebrick
Web Coordinator/Librarian
MN-Planning (Office of Strategic and Long Range Planning)
658 Cedar St., Suite 300
St. Paul, MN 55155

651-296-4156 phone
651-296-3698 fax

www.mnplan.state.mn.us





Re: Appending Sessionid to all the urls

2001-05-22 Thread Michael . Jacob

Hi ktgoh,

you don't tell the browser about the session id. Why?

To use a session id that's appended to the URL is hard work - it has to be
maintaned in every module and html file. So you must append the session id to
every URL in every page and every piece of code that produces html. Ther is no
way to automatically "keep" the id sticky.

A better way for session ids is to put them in front of the URI:
http://www.nus.edu.sg/dfd3453/some/path/and/file.html

This is (part of) my uri-translation-handler:

sub handler ($r: Apache) {
  # only do initial request - not an internal sub req
  return DECLINED unless $r->is_initial_req;
  return DECLINED unless $r->uri =~ m/$DIR_MATCH/o;

  try my $check_uri = &check_uri($r);
  return DECLINED if $check_uri; # URI contains session id and session object
could be read from the DB

  # else redirect to mangled URI
  try my $session_id = &make_session_id($r);
  &redirect($r, $session_id);
  return REDIRECT;
  # end of main handler
}

sub check_uri ($r: Apache) {
  my $uri = $r->uri || undef;
  my (undef, $sessionid, $rest) = split '/', $uri, 3;
  if ($sessionid && $sessionid =~ m/^[0-9a-h]{32,32}$/o) {
$r->uri("/$rest");
try void &lock_session_id($r, $sessionid);
return 1;
  }
  return undef;
}

sub redirect ($r: Apache, $session_id: string min 32 max 32) {
  my $args = $r->args ? '?' . $r->args : '';
  my $uri = $r->parsed_uri;
  $redirect = $uri->scheme . '://' . $uri->$hostinfo . '/'. $session_id . '/' .
$uri->path . $args;
  $r->header_out(Location => $redirect);
}

These session ids are sticky as long as you only use relative paths in your
html. Note: You may want to put your images in a directory that's not covered by
this handler and use absolute paths...


Datum: 22.05.2001 12:03
An:"mod_perl" <[EMAIL PROTECTED]>


Betreff:   Appending Sessionid to all the urls
Nachrichtentext:


Hi all :

I wanted to write a mod URL rewrite program.

I wanted to append session ID to the tail of all the urls of a website.

For instance when i access url http://www.nus.edu.sg?sessionid=dfd3453
i want all the urls to be appended in all the urls of that website..

My qns is everytime i found that the session id is lost... through the many
requests and responses.
And the new url does not reflect on the client browser..

Any one got any idea.. what wrong with my program??

Thanks for your help...

sub handler {

 my $r = shift;
 my $url = $r->uri;
 my $sessID;

 if($url =~ m/sessionid/){
  $sessID= getSessionID($url);
 }

 my $append =?sessionid=$sessID
 my $newURL = $r->uri($url$append);

 return DECLINED;

}

sub getSessionID{
 my  $url = $_[0];
 my  $position = rindex($url,"=")+1;
 my  $sessID = substr($url,$position,8);
 return $sessID;
 }


Regards
kheeteck










Re: Real Widgets and Template Languages

2001-05-22 Thread Adi Fairbank

Gunther,

I have been interested in the concept of an HTML widget module for a while
now.  The reason being, my application currently generates all HTML using
CGI.pm in a mod_perl handler OO-style design, and we are starting to notice
patterns.. similar pieces of HTML that get generated over and over. 
Needless to say, componentized, reusable widgets would be very useful for
us.

Though I can't make the commitment of writing it myself (if I did, it would
be about 6 months before you saw any code), I would definitely contribute to
it, if it existed.  And like you said, the hard part is getting people to
write the widget objects.

-Adi




Re: Real Widgets and Template Languages

2001-05-22 Thread Matt Sergeant

On Tue, 22 May 2001, Gunther Birznieks wrote:

> > > Has someone done this already?
> >
> >Struts. But you knew that already :-)
>
> For those that do not know struts is a Java framework and I think someone
> is trying to get me riled up!
>
> I want/need a *Perl* solution!

Well if you can pay for it... (still unemployed here and getting poorer
waiting for people to possibly say yay or nay on possible contracts...)

-- 


/||** Founder and CTO  **  **   http://axkit.com/ **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
 \\//
 //\\
//  \\




Re: Real Widgets and Template Languages

2001-05-22 Thread Gunther Birznieks

At 10:13 AM 5/22/2001 +0100, Matt Sergeant wrote:
>On Tue, 22 May 2001, Gunther Birznieks wrote:
>
> > Does anyone have a widget framework like this? I think the closest I found
> > to widget abstraction is SmartWorker, but it is not abstract in quite the
> > way that I want above.
>
>We're planning to do something like this as a taglib in XSP for AxKit.
>It's quite a big task though, as we want widgets to also be intelligent in
>the way they are mapped to forms processing code.

I think it is a big task. On the other hand, in thinking about it, I think 
the actual logic behind widgets could be fairly simple. The hard part is 
getting people to write the various widget objects. Again, I think all the 
various HTML widgets could use an underlying library like HTML::StickyWidgets.

And then the remaining hard part is writing the template language wrappers 
that actually allow them to be embedded in pages as tags where it is XSP 
tags for AxKit or plugins for TemplateToolkit.

> > Has someone done this already?
>
>Struts. But you knew that already :-)

For those that do not know struts is a Java framework and I think someone 
is trying to get me riled up!

I want/need a *Perl* solution!

:)






Appending Sessionid to all the urls

2001-05-22 Thread ktgoh



Hi all :
 
I wanted to write a mod URL rewrite 
program.
 
I wanted to append session ID to the tail of all 
the urls of a website.
 
For instance when i access url http://www.nus.edu.sg?sessionid=dfd3453
i want all the urls to be appended in all the urls 
of that website..
 
My qns is everytime i found that the session id is 
lost... through the many requests and responses.
And the new url does not reflect on the client 
browser..
 
Any one got any idea.. what wrong with my 
program??
 
Thanks for your help... 
 
sub handler {
    
 my $r = 
shift;
 my $url = 
$r->uri;
 my $sessID;
 
 if($url =~ 
m/sessionid/){
  $sessID= 
getSessionID($url);
 }
 
 my $append 
=?sessionid=$sessID
 my $newURL = 
$r->uri($url$append);
 
 return 
DECLINED;
 
}
 
sub getSessionID{ 
my  $url = $_[0];     my  $position = 
rindex($url,"=")+1; my  $sessID = 
substr($url,$position,8);     return 
$sessID; }
 
Regards
kheeteck
 
 
 
 
 


Re: Real Widgets and Template Languages

2001-05-22 Thread Matt Sergeant

On Tue, 22 May 2001, Gunther Birznieks wrote:

> Does anyone have a widget framework like this? I think the closest I found
> to widget abstraction is SmartWorker, but it is not abstract in quite the
> way that I want above.

We're planning to do something like this as a taglib in XSP for AxKit.
It's quite a big task though, as we want widgets to also be intelligent in
the way they are mapped to forms processing code.

> Has someone done this already?

Struts. But you knew that already :-)

-- 


/||** Founder and CTO  **  **   http://axkit.com/ **
   //||**  AxKit.com Ltd   **  ** XML Application Serving **
  // ||** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
 \\//
 //\\
//  \\




Real Widgets and Template Languages

2001-05-22 Thread Gunther Birznieks

There has been some discussion on the list lately about generating widgets 
ala CGI.pm, HTML::StickyWidgets etc...

The thing is that these products or plug-ins are very HTML oriented. The 
widget is defined as an HTML widget like a textfield or checkbox or 
dropdown or what-have-you.

What I am really looking for is a library that abstracts and allows widgets 
to be developed that are tied to an application not to a set of HTML 
necessarily. I guess I will start by providing an example of what I want 
based on what we currently do in our Java framework when he use Templating 
there. I'd like it if someone has developed the same thing in Perl that we 
could reuse, otherwise, we may need to write this.

A widget should be a plugin or tag that may be embedded in a template with 
the definition of that widget tied to some APPLICATION-LEVEL piece of data 
entry not at the HTML-LEVEL.

For example,


   First Name:
   Last Name:
   Comments


As you can see the basic idea is that the  tag (or it could be Perl 
object embedded in the template) is actually *intelligent*.

It should be configured as a Perl object that knows that an fname is a 
textfield and an lname is a textfield and a comments field is a text area. 
And if I change my mind and decide that comments is better off as a 
textfield, I should not have to change any templates that use the  tag.

Now, HTML::StickyWidgets and CGI.pm could be used by a true widget 
abstraction library to generate HTML widgets. But what I want to do is 
provide the capability of also abstracting even higher. Like at the data level.

I forsee a

WidgetCollection class which holds widgets together
Widget class that provides the interface to what a widget does
and Widget:: subclasses that provide definitions relevant to the widget 
types used on the forms.

Where HTML::StickyForms comes in is something like

Widget::HTML::TextField
Widget::HTML::TextArea
Widget::HTML::CheckBox

etc...

This is extensible as we provide more cross platforms ones can be added as

Widget::WML::TextField
Widget::WML::CheckBox

And it support intelligence...

Widget::HTML::Date is a widget that would actually contain a drop down for 
month, a drop down for day and a drop down for year parts of a Date.

But the widget object itself can set and get it's data as a Date string.

In other words, the nice thing about a generic Widget library is that you 
can start easy (aka HTML::StickyWidgets) but you can end up with a library 
of common tags that many applications require.

I believe such a library of widget plug-ins could be made semi-indepenent 
of the templating language used with perhaps plugin wrappers for each one 
(In particular I am interested in TemplateToolkit).

The way these widgets would be configured is something like the following

my $widget_collection = new WidgetCollection(
   -WIDGET_FORM_DATA => $CGI , # (CGI.pm object)
   -WIDGET_HASH =>
'fname' =>  new Widget(-TYPE => HTML::TextField, -NAME=> "fname")
 'lname' => new Widget(-TYPE => HTML::TextField, -NAME=> 'lname'),
 'birthday' => new Widget(-TYPE => HTML::Date, -DAY_NAME => "dob_day")
)

Then if I want to get a widget...I can say

my $widget = $widget_collection->getWidget('fname');

By default the widget object data is set using the CGI.pm object (or 
Apache::Request)

But you can manually get and set the data...

print $widget->get_value();

or

$widget->set_value("gunther");

In the case of a date widget...  you can do something like

$widget->set_value("5/22/2001"); if the format defined in the constructor 
of the date widget was "5/22/2001" for mm/dd/

And most importantly, widgets know how to display themselves...

print $fname_widget->display(); prints the HTML text field

whereas

print $date_of_birth_widget->display(); prints the three drop downs that 
represents the month day and year.

Of course, the widget library could be expanded by the open source 
community. For example, I can imagine a date widget that also has a button 
that says "Click for Calendar"... and then a javascript popup comes up with 
a mini-calendar for selecting the date.

Does anyone have a widget framework like this? I think the closest I found 
to widget abstraction is SmartWorker, but it is not abstract in quite the 
way that I want above.

What I want is a business or application context widget that can be 
configured on-the-fly to be something other than a plain HTML widget. After 
using this concept in our Java toolkit for 6 months, I find the abstraction 
to be quite useful and really want to have the same feature in Perl.

Has someone done this already?

Thanks,
  Gunther




Re: Connection to MySQL DB fails when mod_perl enabled...

2001-05-22 Thread Ask Bjoern Hansen

On Mon, 21 May 2001, Rodney Broom wrote:

>   $dbh = DBI->connect($dsn, dbusrname, dbpassword)
> or die "Error: $DBI::errstr";

If you want to die then

 $dbh = DBI->connect($dsn, dbusrname, dbpassword, { RaiseError => 1});

would look neater.

s/Raise/Print/ to just have it spew the error messages to the log
without having to put 'or warn "..."' after every other line.


 - ask

-- 
ask bjoern hansen, http://ask.netcetera.dk/   !try; do();
more than 100M impressions per day, http://valueclick.com