Re: [AOLSERVER] Problem with file uploads larger than maxinput

2011-06-23 Thread Enrique Catalan
Hi,

The final goal is to have a server-side validation and return a page
template explaining what the problem is rather than just closing the
connection.  Having client-side validation ( JavaScript/Flash like
gmail )  helps in terms of UI but I presume wouldn't be safe enough
agains DoS.

IMHO, I agree with Dossy, to use the driver thread to check the hard
limits and instead of dropping the connection, just mark the HTTP
request and let the request handler to return the 413. I also think
the template could be configured in the 'ns_section
ns/server/${server}/redirects' ,  isn't it ?

If you all agree with this, Brian and I can help to get a patch.

Thanks for the great feedback!,
Enrique.


On Thu, Jun 23, 2011 at 4:28 PM, Fenton, Brian brian.fen...@quest.ie wrote:
 I'm using OpenACS hence the TCL. I just want to let the user know that their 
 file is over the size limit. Could we, in driver.c instead of closing the 
 connection socket, return a custom template (like Apache does) ?

 Brian

 
 From: AOLserver Discussion [AOLSERVER@LISTSERV.AOL.COM] On Behalf Of Jim 
 Davidson [jgdavid...@mac.com]
 Sent: 23 June 2011 15:59
 To: AOLSERVER@LISTSERV.AOL.COM
 Subject: Re: [AOLSERVER] Problem with file uploads larger than maxinput

 I think the short answer is there is no way.

 Checking the code and your error message, this is error condition E_CRANGE.  
 It's returned from SockReadLine which is called repeatedly to read the 
 request line (GET /url/ ...) and headers.  As it reads lines, it parses 
 them for some special conditions.  If it sees a content-length header, it's 
 parsed and verified the content to be sent isn't out of range.  If it is, it 
 returns E_CRANGE and the connection is aborted.  So, there's no Tcl 
 environment available to fiddle with.

 There is some Tcl framework in there for que wait callbacks but it's not 
 exposed for error conditions.  Good idea.

 Question:  What are you trying to do with Tcl?  Maybe you could hack the 
 driver.c code to do something smart at CRANGE alone?  I think it's the most 
 common limit-related error.

 -Jim


 On Jun 23, 2011, at 8:22 AM, Fenton, Brian wrote:

 Thanks Jim

 yes that now logs the fact that the file was too big (multiple times in 
 fact), but how can I access this fact in TCL?

 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[38]: max 
 content exceeded
 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[39]: max 
 content exceeded
 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[40]: max 
 content exceeded
 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[41]: max 
 content exceeded
 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[42]: max 
 content exceeded
 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[43]: max 
 content exceeded
 [23/Jun/2011:15:05:50][27869.163851][-nssock:driver-] Error: conn[44]: max 
 content exceeded

 Brian

 
 From: AOLserver Discussion [AOLSERVER@LISTSERV.AOL.COM] On Behalf Of Jim 
 Davidson [jgdavid...@mac.com]
 Sent: 23 June 2011 14:44
 To: AOLSERVER@LISTSERV.AOL.COM
 Subject: Re: [AOLSERVER] Problem with file uploads larger than maxinput

 Howdy,

 Appears you need to set driver debug mode for the driver for the given 
 socket module thing:

 ns_section ns/server/server1/module/nssock
 ns_param debug 1

 Hopefully that's not too much muck in the server log.

 -Jim


 On Jun 23, 2011, at 7:16 AM, Fenton, Brian wrote:

 Thanks Jim

 I should have mentioned that there was nothing in the error log either.

 So, how would you recommend I capture the fact that the uploaded file is 
 larger than our limit, and feedback to the user?


 thanks
 Brian


 
 From: AOLserver Discussion [AOLSERVER@LISTSERV.AOL.COM] On Behalf Of Jim 
 Davidson [jgdavid...@mac.com]
 Sent: 23 June 2011 13:47
 To: AOLSERVER@LISTSERV.AOL.COM
 Subject: Re: [AOLSERVER] Problem with file uploads larger than maxinput

 Hi,

 The short answer is no, there's no access log entry although there may be a 
 server log message buried in the chatter.

 The reason is the access log is a trace that fires at the end of an HTTP 
 connection and the request isn't a connection until all the content has 
 been read and the data structures hooked up and passed over to a connection 
 thread.  In retrospect, transaction logging should be a lower-level 
 built-in that can deal with logging these aborted transactions.

 You can see what may be logged in the server log by looking at the 
 LogReadError function at the end of nsd/driver.c, maybe a E_RRANGE, max 
 request exceeded.


 -Jim




 On Jun 23, 2011, at 6:04 AM, Fenton, Brian wrote:

 Hi

 When I upload a file larger than the maxinput I get the Firefox browser 
 page with a the connection to the server was reset while the page was 
 loading message. Looking in the access logs it seems to 

Re: [AOLSERVER] ns_ora in Aolserver 4.5 for Win32

2008-04-23 Thread Enrique Catalan
Hi,

We've tried the new nsoracle 2.8 beta version and it is still crashing.  The
error happens in different line but it seems to be the same issue, This time
I got:

 Notice: nsoracle.c:1365:unknown: error in `OCIStmtExecute ()':

The block at Line 1365 is:
if (oci_error_p
(lexpos(), dbh, OCIStmtExecute, query, oci_status)) {
Tcl_SetResult(interp, dbh-dsExceptionMsg.string,
  TCL_VOLATILE);
Ns_OracleFlush(dbh);
return TCL_ERROR;
}

Do you have any ideas why it is crashing?

Thanks a lot,
Enrique.

On Tue, Apr 22, 2008 at 3:16 PM, Enrique Catalan [EMAIL PROTECTED] wrote:

 Hi Dossy,

 Thanks for the link and indeed, that piece of code changed a lot with the
 new function free_fetch_buffers(connection);.

if (oci_error_p (lexpos (), dbh, OCIStmtExecute, query, oci_status))
 {
 Ns_OracleFlush(dbh);
 free_fetch_buffers(connection);
 return TCL_ERROR;
 }

 The version I'm using is the same as it is in
 http://www.friendlybits.com/en/inf_tec_en/win32openacs_en/ .   This is
 using nsoracle 2.7, afaik.  I have asked Maurizio if he could gently include
 the nsoracle 2.8 beta instead of the 2.7 and recompile the whole stuff
 together with this beta version..  Will let you know what happen at the end.

 Thanks again!
 Enrique.


 On Tue, Apr 22, 2008 at 1:27 PM, Dossy Shiobara [EMAIL PROTECTED]
 wrote:

  On 2008.04.22, Enrique Catalan [EMAIL PROTECTED] wrote:
   I found that my server is crashing when it is at line 3905 on the
   nsoracle.c.
 
  What version of nsoracle are you using?  The last tagged release, 2.8b1,
  may have known bugs.  CVS HEAD of nsoracle has a few changes:
 
 http://aolserver.com/sf/cvs/nsoracle/ChangeLog?view=markup
 
  I guess it's time to just tag nsoracle 2.9, maybe.
 
  Can you try building the CVS HEAD version of nsoracle and see if that
  resolves your crash bug?
 
  --
  Dossy Shiobara  | [EMAIL PROTECTED] | http://dossy.org/
  Panoptic Computer Network   | http://panoptic.com/
   He realized the fastest way to change is to laugh at your own
 folly -- then you can let go and quickly move on. (p. 70)
 
 
  --
  AOLserver - http://www.aolserver.com/
 
  To Remove yourself from this list, simply send an email to 
  [EMAIL PROTECTED] with the
  body of SIGNOFF AOLSERVER in the email message. You can leave the
  Subject: field of your email blank.
 




--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] ns_ora in Aolserver 4.5 for Win32

2008-04-23 Thread Enrique Catalan
Hi Dossy,

Thanks for the quick feedback. I used gdb long time ago but only in pure
Linux, not cygwin.  I've never done this before on Windows so any doc/help
would be really appreciated, I'll install WinDbg because there is no Cygwin
on this machine and will try to get the backtrace.

Thanks again!
Enrique

On Wed, Apr 23, 2008 at 3:13 PM, Dossy Shiobara [EMAIL PROTECTED] wrote:

 On 2008.04.23, Enrique Catalan [EMAIL PROTECTED] wrote:
  Do you have any ideas why it is crashing?

 Can you run AOLserver under gdb (there is a Cygwin-compiled Win32 binary
 of gdb you can use, if you have Cygwin installed) and give us a
 backtrace?  Otherwise, you can use the free WinDbg tool from Microsoft:

http://www.microsoft.com/whdc/devtools/debugging/default.mspx

 If you're not familiar with gdb and/or WinDbg and need instructions on
 how to elicit a backtrace, let me know and I'll try to write up some
 docs.

 --
 Dossy Shiobara  | [EMAIL PROTECTED] | http://dossy.org/
 Panoptic Computer Network   | http://panoptic.com/
  He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on. (p. 70)


 --
 AOLserver - http://www.aolserver.com/

 To Remove yourself from this list, simply send an email to 
 [EMAIL PROTECTED] with the
 body of SIGNOFF AOLSERVER in the email message. You can leave the
 Subject: field of your email blank.



--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] ns_ora in Aolserver 4.5 for Win32

2008-04-22 Thread Enrique Catalan
Hi Dossy,

Thanks for the link and indeed, that piece of code changed a lot with the
new function free_fetch_buffers(connection);.

   if (oci_error_p (lexpos (), dbh, OCIStmtExecute, query, oci_status)) {
Ns_OracleFlush(dbh);
free_fetch_buffers(connection);
return TCL_ERROR;
}

The version I'm using is the same as it is in
http://www.friendlybits.com/en/inf_tec_en/win32openacs_en/ .   This is using
nsoracle 2.7, afaik.  I have asked Maurizio if he could gently include the
nsoracle 2.8 beta instead of the 2.7 and recompile the whole stuff together
with this beta version..  Will let you know what happen at the end.

Thanks again!
Enrique.

On Tue, Apr 22, 2008 at 1:27 PM, Dossy Shiobara [EMAIL PROTECTED] wrote:

 On 2008.04.22, Enrique Catalan [EMAIL PROTECTED] wrote:
  I found that my server is crashing when it is at line 3905 on the
  nsoracle.c.

 What version of nsoracle are you using?  The last tagged release, 2.8b1,
 may have known bugs.  CVS HEAD of nsoracle has a few changes:

http://aolserver.com/sf/cvs/nsoracle/ChangeLog?view=markup

 I guess it's time to just tag nsoracle 2.9, maybe.

 Can you try building the CVS HEAD version of nsoracle and see if that
 resolves your crash bug?

 --
 Dossy Shiobara  | [EMAIL PROTECTED] | http://dossy.org/
 Panoptic Computer Network   | http://panoptic.com/
  He realized the fastest way to change is to laugh at your own
folly -- then you can let go and quickly move on. (p. 70)


 --
 AOLserver - http://www.aolserver.com/

 To Remove yourself from this list, simply send an email to 
 [EMAIL PROTECTED] with the
 body of SIGNOFF AOLSERVER in the email message. You can leave the
 Subject: field of your email blank.



--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


[AOLSERVER] ns_ora in Aolserver 4.5 for Win32

2008-04-17 Thread Enrique Catalan
Hi,

I have an issue when using the Aolserver 4.5 for Win32 port by friendlybits
( http://www.friendlybits.com/en/inf_tec_en/win32openacs_en/ ).  This
version works pretty well on Windows Server 2003 except that there is a
weird behavior with ns_ora when using Oracle 10g and when running the
following command:

[ns_ora dml nsdb0
  begin
raise_application_error (-2, 'this is the user error message this is
the user error message this is the user error message this is the user error
message this is the user error message this is the user error message this
is the user error message');
  end;
]

The server crahes with no errror message in the log.  Seems to be a memory
leak in ns_ora.   I've tried the Oracle client 9i and the 10g and got the
same on both.  The server crashes with different lenght of messages.
According to the Oracle doc, the limit of the message including the error
code shouldn't exceed 512 characters.

I was wondering if you've had some similar issues before or just if you know
if there is any known issue with ns_ora and Oracle 10g on Win32?

Thanks in advance,
Enrique.


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] WARNING: dns queries will use non-threadsafe calls

2007-10-22 Thread Enrique Catalan

Thanks Tom, Do you know what do I need to fix that?

I mean, I'm compiling everything with the right switches according to  
the README files to get the threading stuff and still getting this.  
Using tcl 8.4.16 multithreaded and using --enable-threads when  
compiling the aolsvr45.


Thanks!

Quoting Tom Jackson [EMAIL PROTECTED]:


Enrique,

You don't have the threadsafe versions, or configure didn't find them.

tom jackson

On Friday 19 October 2007 08:19, Enrique Catalan wrote:

checking for gethostbyname_r... no
checking for gethostbyaddr_r... no
configure: WARNING: dns queries will use non-threadsafe calls which



--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to   
[EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the   
Subject: field of your email blank.





--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


Re: [AOLSERVER] WARNING: dns queries will use non-threadsafe calls

2007-10-22 Thread Enrique Catalan
I've just found it.  Somehow, the configure is not loading netdb.h  
where getaddrinfo is defined and hence it tries to load the  
gethostbyaddr_r which can't be found neither.  Will try to add the  
include in the header in order to force the loading and debug what's  
wrong with the environment.


Cheers


Quoting Enrique Catalan [EMAIL PROTECTED]:


Thanks Tom, Do you know what do I need to fix that?

I mean, I'm compiling everything with the right switches according to
the README files to get the threading stuff and still getting this.
Using tcl 8.4.16 multithreaded and using --enable-threads when
compiling the aolsvr45.

Thanks!

Quoting Tom Jackson [EMAIL PROTECTED]:


Enrique,

You don't have the threadsafe versions, or configure didn't find them.

tom jackson

On Friday 19 October 2007 08:19, Enrique Catalan wrote:

checking for gethostbyname_r... no
checking for gethostbyaddr_r... no
configure: WARNING: dns queries will use non-threadsafe calls which



--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to
[EMAIL PROTECTED] with the
body of SIGNOFF AOLSERVER in the email message. You can leave the  
  Subject: field of your email blank.





--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


[AOLSERVER] WARNING: dns queries will use non-threadsafe calls

2007-10-19 Thread Enrique Catalan

Hi,

I tried to compile Aolserver4.5 for unix and got weird warning message  
and was wondering if you know how to get rid of that, I hadn't got  
this before.


The messages I got are:

% /usr/local/tcl8.4.16/bin/tclsh8.4 nsconfig.tcl -install  
/usr/local/aolserver4.5/


Executing ./configure TCLSH=/usr/local/tcl8.4.16/bin/tclsh8.4  
--prefix=/usr/local/aolserver4.5 --with-tcl=/usr/local/tcl8.4.16/lib

checking for Tcl configuration... found /usr/local/tcl8.4.16/lib/tclConfig.sh
checking for existence of /usr/local/tcl8.4.16/lib/tclConfig.sh... loading
checking for build with symbols... no
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ANSI C... none needed
checking how to run the C preprocessor... gcc -E
checking for egrep... grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h .. . yes
checking for unistd.h... yes
checking for inttypes.h... (cached) yes
checking for timegm... no
checking for fork1... no
checking for drand48... yes
checking for random... yes
checking for _NSGetEnviron... no
checking for poll... yes
checking dl.h usability... no
checking dl.h presence... no
checking for dl.h... no
checking need for dup high... no
checking for shared libgcc... no
checking for getaddrinfo in -lsocket... no
checking for getnameinfo in -lsocket... no
checking for getaddrinfo... no
checking for getnameinfo... no
checking for gethostbyname_r... no
checking for gethostbyaddr_r... no
configure: WARNING: dns queries will use non-threadsafe calls which  
could result in server instability

configure: creating ./config.status
config.status: creating include/ns.mak
%

Thanks!


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.


[AOLSERVER] java servlets support

2007-06-10 Thread Enrique Catalan

Hi,

After a couple of days trying to make a java servlet works with 
Aolserver without any success I decided to bother you guys and ask if 
some of you have ever tried to do this crazy configuration?


1.- I tried nsjava but it is out of date (it doesn't work with JDK 1.6) 
and when I got an older version of JDK (1.1.8, 1.2.2) I got a lot of 
compilation errors because of compatibility between JDK and gcc. I tried 
with an older version of gcc (2.95) and got lots of problems as well.


2.- I decided to use nsjk2 but before trying that I read some post of 
2004 that it isn't really useful for servlets.


So, my question is basically which approach would you recommend?

Thanks =) !


--
AOLserver - http://www.aolserver.com/

To Remove yourself from this list, simply send an email to [EMAIL PROTECTED] 
with the
body of SIGNOFF AOLSERVER in the email message. You can leave the Subject: 
field of your email blank.