[AOLSERVER] Lynx/2.3 BETA crashes AOLserver 3.4 + nsvhr

2001-07-30 Thread Dossy

Well, after mentioning that nsvhr crashes strangely on
AOLserver 3.4, and after telling someone to hit one of
my vhosts and them telling me uh, it's down and
wondering why it was just up, and after they tried to
hit it, it went down ... I started sniffing headers
with my snoop script that uses tcpdump, and found
that Lynx was sending this HTTP request:


GET / HTTP/1.0
Accept: */*
Accept: application/x-wais-source
Accept: text/plain
Accept: text/html
Accept: www/mime
User-Agent:  Lynx/2.3 BETA  libwww/2.14
From:



Uh, From: header?  No Host: header?  Hmmm.  There's
no reason why nsvhr shouldn't gracefully degrade to
handle a HTTP/1.0 style connection header...

So, I fired up nsd8x under gdb, and found this:

Program received signal SIGSEGV, Segmentation fault.
0x8082643 in Ns_StrToLower (string=0x0) at str.c:156
156 while (*s != '\0') {

(gdb) bt
#0  0x8082643 in Ns_StrToLower (string=0x0) at str.c:156
#1  0x40174574 in VHRProc (context=0x0, conn=0x8187d88) at nsvhr.c:342
#2  0x8078d0d in Ns_ConnRunRequest (conn=0x8187d88) at op.c:196
#3  0x807f6ae in ConnRun (connPtr=0x8187d88) at serv.c:882
#4  0x807efbe in NsConnThread (arg=0x81450c0) at serv.c:671
#5  0x811c10e in NsThreadMain (arg=0x8194c90) at thread.c:228
#6  0x40025fc5 in pthread_start_thread () from /lib/libpthread.so.0

The relevant portino of nsvhr.c:VHRProc() looks something like this:

340 headers = Ns_ConnHeaders(conn);
341 host = Ns_SetIGet(headers, Host);
342 Ns_StrToLower(host);
343
344 if (host != NULL) {
345 hePtr = Tcl_FindHashEntry(map, host);
346 }

The Ns_StrToLower() is happening regardless of the *host value,
which is the problem.  Move the Ns_StrToLower() to inside
the if statement, and everything should be fine.

Jerry Asher's vhr patch does seem to fix this bug as well,
but adds extra functionality at the same time.  Here's the
minimal patch for this problem:


# diff -Naur nsvhr.c.orig nsvhr.c
--- nsvhr.c.origMon Jul 30 07:45:04 2001
+++ nsvhr.c Mon Jul 30 07:45:29 2001
@@ -339,9 +339,9 @@

 headers = Ns_ConnHeaders(conn);
 host = Ns_SetIGet(headers, Host);
-Ns_StrToLower(host);

 if (host != NULL) {
+Ns_StrToLower(host);
hePtr = Tcl_FindHashEntry(map, host);
 }


I'll file this in SourceForge but I'd like to know what others
think before I go and fix it in CVS ...

-- Dossy

--
Dossy Shiobara   mail: [EMAIL PROTECTED]
Panoptic Computer Network web: http://www.panoptic.com/



Re: [AOLSERVER] Lynx/2.3 BETA crashes AOLserver 3.4 + nsvhr

2001-07-30 Thread Scott Goodwin

FYI:

the From: header is a valid HTTP header. It's meant to pass the email
address of the individual on the client side to the server. The idea is
that if there are problems with the headers from the client, the server
admin can email the person listed in the From: header. It's supposed to be
used with the user's consent, but I'm pretty sure that it isn't used by
anyone (I guess this was before the Web became commercialized), and if the
From: header exists, it'll be empty.

/s.

 
 Jerry Asher's vhr patch does seem to fix this bug as well,
 but adds extra functionality at the same time.

 That's an understatement!

 Here's the
 minimal patch for this problem:
 
 
 # diff -Naur nsvhr.c.orig nsvhr.c
 --- nsvhr.c.origMon Jul 30 07:45:04 2001
 +++ nsvhr.c Mon Jul 30 07:45:29 2001
 @@ -339,9 +339,9 @@
 
   headers = Ns_ConnHeaders(conn);
   host = Ns_SetIGet(headers, Host);
 -Ns_StrToLower(host);
 
   if (host != NULL) {
 +Ns_StrToLower(host);
  hePtr = Tcl_FindHashEntry(map, host);
   }
 
 
 I'll file this in SourceForge but I'd like to know what others
 think before I go and fix it in CVS ...

 I definitely think you should add this fix to SourceForge, but there is
the
 question of what should be happening when a request with no host header
 comes in.

 I created a menuURL which is similar to the errorURL, but uh, different.

 The idea is that no host headers would get redirected to a menuURL.

 I can then build (manually or however) a menuURL page that enumerates the
 hosts provided at the site and provides links COMPLETE with the nssock
 port.  This lets HTTP/1.0 hosts discover what sites are available and get
 to the site they are looking for in a friendly fashion.  This might be
done
 with the errorURL as easily, but there are errorful conditions that can
 occur in which I don't want to give the client browser a generic menu of
 sites and do want to give them a more site specific, error condition
message.

 At any rate, a HTTP/1.0 header should not crash nsvhr, but it's still not
 clear what you do with it after it gets to nsvhr.

 Jerry
 =
 Jerry Asher   [EMAIL PROTECTED]
 1678 Shattuck Avenue Suite 161Tel: (510) 549-2980
 Berkeley, CA 94709Fax: (877) 311-8688





[AOLSERVER] [ aolserver-Support Requests-445215 ] Session Management? (i'm new)

2001-07-30 Thread Ms. Source Forge

Support Requests item #445215, was opened at 2001-07-27 09:14
You can respond by visiting:
http://sourceforge.net/tracker/?func=detailatid=203152aid=445215group_id=3152

Category: Scripting: Tcl/ADP
Group: None
Status: Closed
Priority: 5
Submitted By: Jon Block (jonblock)
Assigned to: Dossy Shiobara (dossy)
Summary: Session Management? (i'm new)

Initial Comment:
So I'm building my very first adp site and I want to
create a log in. (I'm already a seasoned coldfusion
developer so I understand how to make web apps).
Anyway, whats the best way to maintain state as users
navigate from one page to another?

Say for instance, I want to remember the users's
complete address, their favorite color, and a quote of
the day. I can't store all of that as text in a cookie
because cookies have limits as to how much you can
store in them.

ColdFusion has a really nice way of making these types
of session variables available automatically for
each page request.

Whats the best way for me to manage a session in adp?

Thanks!

-Jon Block

--

Comment By: Dossy Shiobara (dossy)
Date: 2001-07-30 11:03

Message:
Logged In: YES
user_id=21885

Look into the ns_share and/or nsv APIs.  Also, I believe
Stefan Arentz has been working on an nssession module, as
well.

If you need persistent session information (ala CF's
clientmanagement stuff) then I think you'll have to look at
the nssession stuff, or hand-roll your own using ns_share
or nsv.

If you want non-persistent session information (ala CF's
sessionmanagement stuff) then the ns_share or nsv APIs
should be good enough.

If Stefan's implementation of nssession isn't doing it for
you, I started writing the spec for what I thought
nssession should be, on the AOLserver wiki:

  http://panoptic.com/wiki/aolserver/nssession

Follow the link to nssession specification -- there's a
lot of work to be done, but it'll result in a fairly robust
session management implementation.

I'm going to close out this ticket since this is really
outside the scope of support and more in development
or training which isn't necessarily what this forum is
for.  You may want to consider asking these kinds of
questions on the AOLserver mailing list.  Follow this URL
if you want to subscribe:

  http://listserv.aol.com/archives/aolserver.html

Follow the link Join or leave the list (or change
settings).

-- Dossy


--

You can respond by visiting:
http://sourceforge.net/tracker/?func=detailatid=203152aid=445215group_id=3152



[AOLSERVER] [ aolserver-Support Requests-440262 ] Using the ns_table and ns_column

2001-07-30 Thread Ms. Source Forge

Support Requests item #440262, was opened at 2001-07-10 19:19
You can respond by visiting:
http://sourceforge.net/tracker/?func=detailatid=203152aid=440262group_id=3152

Category: Scripting: Tcl/ADP
Group: aolserver3_4
Status: Closed
Priority: 5
Submitted By: Tyge Cawthon (tyge)
Assigned to: Nobody/Anonymous (nobody)
Summary: Using the ns_table and ns_column

Initial Comment:
O/S FreeBSD 4.3-stable
DataBase postgreSQL 7.0.2
AOLServer 3.4

Need information about how to use the ns_table and
ns_column command.  Documentation AOL 3.0 states it is
not supported. However, I found documentation (date
2000) that it is but I can not find information on how
it is used.

I would like to print out the column names of a table
with the data.

 In the example I am using the statement is

set tinfo [ns_table info $db $table]

The error is:
unknown command info: should be bestrowid, exists,
list, listall, or value
while executing
ns_table info $db $table


Using a different ADP file, I can see the data so I
know the communications between AOL and the DataBase is
good.

Thanks.

--

Comment By: Tyge Cawthon (tyge)
Date: 2001-07-27 06:05

Message:
Logged In: YES
user_id=217624

Dossy and Petej,
Thanks for your suggestions.  I will not be able to test
this for about two weeks.  Lets close the ticket for now.
If I have problems, I will reopen it.  Once again thanks.

--

Comment By: Dossy Shiobara (dossy)
Date: 2001-07-27 03:13

Message:
Logged In: YES
user_id=21885

Tyge,

Did petej's solution work for you?  Can this ticket be
closed?

-- Dossy


--

Comment By: Peter M. Jansson (petej)
Date: 2001-07-11 07:30

Message:
Logged In: YES
user_id=20577

ns_table and ns_column are deprecated.  If you need the
names of the columns in a table, a good portable way to do
this is to do a select * from sometable where 0=1, which
will return  an empty set, but you can obtain the column
names returned in the ns_set (from ns_db bindrow...).
This should work in any database.

--

You can respond by visiting:
http://sourceforge.net/tracker/?func=detailatid=203152aid=440262group_id=3152



Re: [AOLSERVER] Lynx/2.3 BETA crashes AOLserver 3.4 + nsvhr

2001-07-30 Thread Jerry Asher

At 10:54 AM 7/30/01, Dossy wrote:
On 2001.07.30, Jerry Asher [EMAIL PROTECTED] wrote:
  At any rate, a HTTP/1.0 header should not crash nsvhr, but it's still not
  clear what you do with it after it gets to nsvhr.

I guess I still haven't gotten back from camping just yet.  I thought we
were discussing the case when an HTTP/1.0 header (or /.9?) without the host
field gets to nsvhr, and not the case of what happens when an HTTP/1.1
header gets to nsvhr.

According to my reading of RFC 2068, when an HTTP/1.1 header comes along
without a host field, the server MUST return a BAD REQUEST (regardless of
what makes sense to you or I)

14.23 HOST
...
All Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request)
status code to any HTTP/1.1 request message which lacks a Host header field.

I dunno presumably it's better to tell the user that their client isn't at
HTTP/1.1 as  they might think than to do for them what you expect they
would prefer to have done.  Also, why I am just completely speculating off
the top of my head now (or maybe out my *ss), I think your logic breaks
down with an HTTP/1.1 proxy request which send a proxy to a vhrish
host.  There I think you would agree: send back the bad request and not the
menu url.  To make the logic simpler, perhaps the protocol says HTTP/1.1 =
supply a host field, or suffer a BAD REQUEST.

???

Also, I don't know if anyone else has found that in order to make sure
nsvhr works correctly, for virtual hosts on port 80, you need two
maps:

ns_param   dossy.orghttp://127.0.0.1:2001;
ns_param   dossy.org:80 http://127.0.0.1:2001;

Yes, I've noted that before, and while it could/should be fixed in the
code, I've always just documented that.  (If I recall it may be more
complex than that, I recall it's really for virtual hosts on port X where X
is the port your proxy master listens.)

Jerry

P.S.  Recently, I changed how my master proxy configures it's map to make
it easier to maintain, and to open the door to one day just pulling these
maps out of a database.

In the config.tcl, I enumerate two arrays, and one proc.  One array maps a
server on your site to the socket that it listens on.  The other array is a
list of servers that prefer nsunix.  The proc maps from a HOST field value
(name) to the SERVER that responds to that name, and then takes an optional
value to force the preferred protocol.

The goal is to make it easier to install new hosts, as well as to enable me
to easily switch an entire site from nsunix to/from nssock.  As you can
see, the proc defines the port 80 host for you automatically, and goes so
far as to define www and web variants of any one dot host name (photo.net
gets mapped to photo.net:80 www.photo.net www.photo.net:80 web.photo.net
web.photo.net:80)

Currently (as shown below) all the hosts below are forced to using
nssock/http while I test AOLserver 3.4 versions of nsunix, etc.  You can
also see that some servers will handle the requests for many different host
names.  (I use Tom Jackson's VAT and other techniques for that.)

proc defserver {name aka {protocol http}} {
 global server2port
 if {[string equal $protocol nsunix]} {
 set value unix://${aka}.nsunix
 } else {
 set value http://${name}:$server2port($aka)
 }

 set names [list $name]

 set dots 
 regsub -all {[^\.]} $name  dots
 set dotcount [string length $dots]
 if {$dotcount  2} {
 lappend names www.${name}
 lappend names web.${name}
 }

 foreach n $names {
 ns_param ${n} $value
 ns_param ${n}:0   $value
 ns_param ${n}:80  $value
 }
}

array set server2port {
 abattoir 4000
 asher8000
 hollyjerry   2000
 jerrysworld  5000
 photos   7000
 problemsets  3000
 reminder 
 simon
 solutions9000
 theashergroup3335
 cvsweb   16080
 downloads16080
 webmail  16080
}

array set nsunix {
 abattoir
 asher
 hollyjerry
 jerrysworld
 photos
 problemsets
 reminder
 solutions
 theashergroup
}

ns_section  ns/server/master/module/nsvhr/maps

defserver  192.168.0.16 theashergroup
defserver  209.233.238.162  theashergroup
defserver  hollyjerry.org   hollyjerry
defserver  abattoir.hollyjerry.org  abattoir
defserver  asher.hollyjerry.org asher
defserver  cvsweb.theashergroup.com cvsweb   http
defserver  downloads.hollyjerry.org downloadshttp
defserver  downloads.theashergroup.com  downloadshttp
defserver  webmail.theashergroup.comwebmail  http
defserver  webmail.hollyjerry.org   webmail  http
defserver  jerrysworld.com  jerrysworld
defserver  photos.hollyjerry.orgphotos
defserver  problemsets.hollyjerry.org   

[AOLSERVER] [ aolserver-Support Requests-446022 ] Viewing debug info within a broken adp

2001-07-30 Thread Ms. Source Forge

Support Requests item #446022, was opened at 2001-07-30 10:37
You can respond by visiting:
http://sourceforge.net/tracker/?func=detailatid=203152aid=446022group_id=3152

Category: Scripting: Tcl/ADP
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: M Gordon (zgorm)
Assigned to: Dossy Shiobara (dossy)
Summary: Viewing debug info within a broken adp

Initial Comment:
Hello All,

I am completely new to Aolserver, so please forgive me
if the answer to my question is obvious.

I am having a hell of a time trying to debug my adp
application. Whenever there is an error in an adp that
I have written, instead of seeing a useful error
message when I view that page, all I get is a blank
page.

I already tried to find the answer to my problem in
the online docs, which told me to do the following:

# TCL Config
ns_section ns/server/${servername}/tcl
ns_param ClientDebug 10.0.0.1

Supposedly by setting the value of the ClientDebug
param to the ip address of the client wishing to view
the error information (10.0.0.1), any person who views
a bad adp from that ip should see an error trace. So I
restarted Aolserver and prayed, but this did not work.

Does anyone know why that is?

Also, if you know of a better way to get debug
information, that would be really helpful too.

Thanks.

-Matt

--

Comment By: M Gordon (zgorm)
Date: 2001-07-30 12:50

Message:
Logged In: YES
user_id=284892

the server.log does catalog some database errors, but i am
not really interested in having to tail -f that file while
i am developing. especially since this will mean that i
will see errors from other people developing other pages on
the server.

what i really want is to be able to see error information
when i point my browser to a page with an error on it.

this must be possible. how do people develop sites in adp
if it isn't?

--

Comment By: M Gordon (zgorm)
Date: 2001-07-30 12:49

Message:
Logged In: YES
user_id=284892

the server.log does catalog some database errors, but i am
not really interested in having to tail -f that file while
i am developing. especially since this will mean that i
will see errors from other people developing other pages on
the server.

what i really want is to be able to see error information
when i point my browser to a page with an error on it.

this must be possible. how do people develop sites in adp
if it isn't?

--

Comment By: Dossy Shiobara (dossy)
Date: 2001-07-30 11:04

Message:
Logged In: YES
user_id=21885

Have you tried checking the log/server.log file for your
Tcl errors?

-- Dossy

--

You can respond by visiting:
http://sourceforge.net/tracker/?func=detailatid=203152aid=446022group_id=3152