How to use Apache2::Upload

2005-11-11 Thread Boysenberry Payne
In the Apache2::Upload doc it gives the following example:

use Apache2::Upload;
$req = Apache2::Request->new($r);
$upload = $req->upload(foo);

If I'm using this inside of a mod_perl handler do I need to do
$req = Apache2::Request->new($r);
where $r is my request handle?
Or am I getting confused?

So would the following be correct?

sub handler {

my $r = shift;
my $req = Apache2::Request->new( $r );
my $upload = $req->upload( foo );
my $fh = $upload->fh;
}

In the above would $fh be appropriate to use with Net::FTP->put( $fh )?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: How to use Apache2::Upload

2005-11-11 Thread Boysenberry Payne
Also, are there equivalents to:

$CGI::DISABLE_UPLOADS
and
$CGI::POST_MAX
???

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 3:56 PM, Boysenberry Payne wrote:

In the Apache2::Upload doc it gives the following example:

use Apache2::Upload;
$req = Apache2::Request->new($r);
$upload = $req->upload(foo);

If I'm using this inside of a mod_perl handler do I need to do
$req = Apache2::Request->new($r);
where $r is my request handle?
Or am I getting confused?

So would the following be correct?

sub handler {

my $r = shift;
my $req = Apache2::Request->new( $r );
my $upload = $req->upload( foo );
my $fh = $upload->fh;
}

In the above would $fh be appropriate to use with Net::FTP->put( $fh )?

Thanks,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com


Re: How to use Apache2::Upload

2005-11-11 Thread Philip M. Gollucci

In the Apache2::Upload doc it gives the following example:

I would recommend that you check out:

http://httpd.apache.org/apreq/docs/libapreq2/group__apreq__xs__apr__request__cookie.html

instead ... Apache2::Cookie was just let in for back compat and we don't 
generally recommend it anymore.



--
--
Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without.

It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone...

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com


Re: How to use Apache2::Upload

2005-11-11 Thread Philip M. Gollucci

Boysenberry Payne wrote:

Also, are there equivalents to:

$CGI::DISABLE_UPLOADS
and
$CGI::POST_MAX
???

http://httpd.apache.org/apreq/docs/libapreq2/group__apreq__xs__apr__request.html

Look for
$req-disable_uploads()

and

$req-read_limit($set)

Respectively.

HTH



--
--
Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without.

It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone...

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com


Re: How to use Apache2::Upload

2005-11-11 Thread Michael Peters


Philip M. Gollucci wrote:
 In the Apache2::Upload doc it gives the following example:
 
 I would recommend that you check out:
 
 http://httpd.apache.org/apreq/docs/libapreq2/group__apreq__xs__apr__request__cookie.html
 
 
 instead ... Apache2::Cookie was just let in for back compat and we don't
 generally recommend it anymore.

This is, at least to me, annoying. Apache::Request's API is pretty
simple and familiar to those who know CGI.pm. APR::Request is probably
more flexible, and more like the underlying C API. I don't think this
means that the Apache2::Request modules should be abandoned.

Is there any interest in having someone maintain the Apache2::Request
(Upload, Cookie, etc) family to have the same old API? This shouldn't
detract from the APR::Request modules in any way, and they can still be
encouraged if that's the general consensus. They can even be spun off
into their own distribution and just use the APR::Request underneath.

Thoughts?

-- 
Michael Peters
Developer
Plus Three, LP



Re: How to use Apache2::Upload

2005-11-11 Thread Boysenberry Payne
What is $pool in:

APR::Request::Custom->handle($pool, 
$query_string,
$cookie_header,
$parser,
$read_limit,
$brigade)

and how do I get each of the values for this?

Should I use:

APR::Request->handle( ... );

or the above?

Right now I'm doing the following:

sub handle {

$r = shift;

# uploads	
$req = Apache2::Request->new( $r );
$upload = $req->upload( upload_field_name );

# cookies
$jar = Apache2::Cookie::Jar->new( $r );
$cookies = $self->{jar}->cookies();
$table = Apache2::Cookie->fetch( $r );
}

is there a better way, that I'm not getting?

Thank you,
Boysenberry

boysenberrys.com | habitatlife.com | selfgnosis.com

On Nov 11, 2005, at 5:48 PM, Philip M. Gollucci wrote:

Boysenberry Payne wrote:
Also, are there equivalents to:
$CGI::DISABLE_UPLOADS
and
$CGI::POST_MAX
???
http://httpd.apache.org/apreq/docs/libapreq2/group__apreq__xs__apr__request.html

Look for
$req->disable_uploads()

and

$req->read_limit($set)

Respectively.

HTH



-- 
--
Love is not the one you can picture yourself marrying,
but the one you can't picture the rest of your life without.

It takes a minute to have a crush on someone, an hour to like someone,
and a day to love someone, but it takes a lifetime to forget someone...

Philip M. Gollucci ([EMAIL PROTECTED]) 301.254.5198
Consultant / http://p6m7g8.net/Resume/resume.shtml
Senior Software Engineer - TicketMaster - http://ticketmaster.com




Re: Building Apache 2.0.55

2005-11-11 Thread Paul Smedley
HI Jeff,

On Thu, 10 Nov 2005 11:51:26 UTC, Jeff Trawick [EMAIL PROTECTED] 
wrote:

 On 11/10/05, Paul Smedley [EMAIL PROTECTED] wrote:
  Hi All,
  I'm trying to get Apache2 2.0.55 building and running on OS/2 using
  GCC 3.3.5.  There's a current build of Apache using GCC 2.8.1 but that
  GCC is getting a bit long in the tooth so I'd like to update things :)
 
  Anyway,  I have it building ok - using the unix network_io and poll
  code instead of the OS/2 code as GCC 3.3.5 on OS/2 provides a much
  more unix like behaviour.
 
  [Thu Nov 10 19:51:18 2005] [error] (38)Socket operation on non-socket:
  apr_accept
 
 apparently it doesn't provide as much as is necessary...  does it
 still work with the OS/2 networking?  do APR test programs work better
 or worse with the unix networking implementation?
 
 you are essentially deciding to be an APR developer by switching the
 networking implementation to something that nobody else has used
 before
 
 (APR questions to dev@apr.apache.org)
Yeah I did try the OS/2 networking implementation first and it shows 
in error_log:
(OS 10047)Address family not supported by protocol family: make_sock: 
could not bind to address 0.0.0.0:81
[Fri Nov 11 17:46:47 2005] [alert] no listening sockets available, 
shutting down

and there's no output to screen.


-- 
Cheers,

Paul.



Re: Building Apache 2.0.55

2005-11-11 Thread William A. Rowe, Jr.

Paul Smedley wrote:



Hi All,
I'm trying to get Apache2 2.0.55 building and running on OS/2 using
GCC 3.3.5.  There's a current build of Apache using GCC 2.8.1 but that
GCC is getting a bit long in the tooth so I'd like to update things :)

Anyway,  I have it building ok - using the unix network_io and poll
code instead of the OS/2 code as GCC 3.3.5 on OS/2 provides a much
more unix like behaviour.


But what is GOOD about unix-like behavior?  This is sadly the same nonsense
as trying to build Win32 via cygwin.  You have wrappers that work *almost*
like unix, but you've added another layer of abstraction, and another
library's bugs...


[Thu Nov 10 19:51:18 2005] [error] (38)Socket operation on non-socket:
apr_accept


Ta da..., and boom.  Once you can accept, can it poll/select correctly,
or will you have yet-more quirks?  You've evidently barely scratched
the surface of making apr/unix play OS/2.

The better solution, and nothing against attacking OS/2 using gcc, would
be to modify the build system to correctly detect OS/2 and use that API,
internally.  The beauty of APR is that most everything is abstracted out
and programs such as httpd won't know/care about the difference (and will
be informed of supported/unsupported APIs.)

Once apr is built correctly, there's very little to do on the httpd side.
It has almost no platform specifics, and those are generally picked out
correctly by autoconf.

Please don't reply again on this thread.  Jeff asked politely for you to
continue on dev@apr.apache.org where issues of portability are addressed;
please do.

Bill


mod_proxy balancer maxattempts bug??

2005-11-11 Thread Brian Akins

If I have the following:

Proxy balancer://fill
BalancerMember http://10.165.80.90:80 max=256 timeout=3
BalancerMember http://10.165.30.89:80 max=256 timeout=3
BalancerMember http://10.165.80.88:80 max=256 timeout=3
BalancerMember http://10.165.80.89:80 max=256 timeout=3
BalancerMember http://10.165.30.91:80 max=256 timeout=3
BalancerMember http://10.165.30.92:80 max=256 timeout=3
/Proxy



and later:

ProxyPass / balancer://fill/ timeout=10 maxattempts=3 lbmethod=byrequests


if all 6 members are unreachable, but still OK, proxy tries each 
member before giving up.  should it only try 3?


maybe some different logic needs to be mod_proxy?



 access_status = ap_proxy_pre_request(worker, balancer, r, conf, url);
if (access_status != OK) {
/*
 * Only return if access_status is not HTTP_SERVICE_UNAVAILABLE
 * This gives other modules the chance to hook into the
 * request_status hook and decide what to do in this situation.
 */
if (access_status != HTTP_SERVICE_UNAVAILABLE)
return access_status;
/*
 * Ensure that balancer is NULL if worker is NULL to prevent
 * potential problems in the post_request hook.
 */
if (!worker)
balancer = NULL;
goto cleanup;
}
if (balancer  balancer-max_attempts_set  !max_attempts)
max_attempts = balancer-max_attempts;

--
Brian Akins
Lead Systems Engineer
CNN Internet Technologies


ap_get_server_port differences

2005-11-11 Thread Brian Akins

in 2.1.9 ap_get_server_port uses the following:

 port = r-parsed_uri.port_str ? r-parsed_uri.port :
   r-connection-local_addr-port ? 
r-connection-local_addr-port :

   r-server-port ? r-server-port :
   ap_default_port(r);


in 2.0.55 it uses:

 port = r-parsed_uri.port_str ? r-parsed_uri.port :
   r-server-port ? r-server-port :
   ap_default_port(r);


This just bit me bad!  I was used to being able to declare things like:

ServerName www.domain.com:80

and having redirects (mod_dir, etc) to pick up on this via ap_construct_url


What, if any, is the work around for 2.1.9?  I really don't want to use 
UseCanonicalName On





--
Brian Akins
Lead Systems Engineer
CNN Internet Technologies


Re: ap_get_server_port differences

2005-11-11 Thread Brian Akins
Here's the quick workaround module.  Just load the modules and it tries 
to revert to 2.0 behavior


#include httpd.h
#include http_config.h
#include ap_config.h
#include apr_strings.h
#include http_protocol.h

module AP_MODULE_DECLARE_DATA port_module;

typedef struct {
apr_port_t port;
char *port_str;
} port_config;


static int port(request_rec *r)
{
port_config *conf;

if((conf = ap_get_module_config(r-server-module_config, 
port_module)) != NULL) {

if(conf-port_str) {
/*looking at server/core.c, ap_get_server_port This looks 
to be the best place

 * UseCanonicalName MUST be off, or this is ignored*/
r-parsed_uri.port = conf-port;
r-parsed_uri.port_str = conf-port_str;
}
}

return DECLINED;
}

static int post_config(apr_pool_t * pconf, apr_pool_t * plog,
  apr_pool_t * ptemp, server_rec *s)
{
server_rec *virt;
port_config *port;

for(virt = s; virt; virt = virt-next) {
port = apr_pcalloc(pconf, sizeof(port_config));
if(virt-port) {
port-port = virt-port;
port-port_str = apr_psprintf(pconf, %u, virt-port);
ap_set_module_config(virt-module_config, port_module, port);
}

}

return OK;
}

static void register_hooks(apr_pool_t * p)
{
ap_hook_post_read_request(port, NULL, NULL, APR_HOOK_REALLY_FIRST);
ap_hook_post_config(post_config, NULL, NULL, APR_HOOK_MIDDLE);
}

/* Dispatch list for API hooks */
module AP_MODULE_DECLARE_DATA port_module = {
STANDARD20_MODULE_STUFF,
NULL,   /* create per-dirconfig structures */
NULL,/* merge  per-dirconfig structures */
NULL,   /* create per-server config structures */
NULL,   /* merge  per-server config structures */
NULL,/* table of config file commands   */
register_hooks   /* register hooks  */
};


--
Brian Akins
Lead Systems Engineer
CNN Internet Technologies


Re: bug in mod_dav.c

2005-11-11 Thread Ruediger Pluem


On 11/05/2005 11:41 PM, Ruediger Pluem wrote:
 

[..cut..]

 Good catch. Thank you. I also think that it should be err2-status instead
 of err-status. I just checked in a patch to the trunk
 (r331041, http://svn.apache.org/viewcvs.cgi?rev=331041view=rev).
 Let's wait if there are any objections. If not I will try to get it 
 backported.

Now backported to 2.2.x (r332657, 
http://svn.apache.org/viewcvs.cgi?rev=332657view=rev).
and proposed for backport to 2.0.x (r332661, 
http://svn.apache.org/viewcvs.cgi?rev=332662view=rev).

Regards

RĂ¼diger



Re: svn commit: r327872 - in /httpd/httpd/trunk: CHANGES include/httpd.h server/core_filters.c

2005-11-11 Thread Jeff Trawick
On 10/23/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
 Author: brianp
 Date: Sun Oct 23 15:38:35 2005
 New Revision: 327872

 URL: http://svn.apache.org/viewcvs?rev=327872view=rev
 Log:
 New version of ap_core_output_filter that does nonblocking writes
...
 +static apr_status_t send_brigade_blocking(apr_socket_t *s,
 +  apr_bucket_brigade *bb,
 +  apr_size_t *bytes_written,
 +  conn_rec *c)
 +{
...
 +if (APR_STATUS_IS_EAGAIN(rv)) {
 +rv = apr_wait_for_io_or_timeout(NULL, s, 0);

Whoops, not an API.  This needs to use apr_poll().


Re: Proper declaration for apr_wait_for_io_or_timeout() (was: Re: NWGNUmakefile update for APR1.2?)

2005-11-11 Thread Jeff Trawick
On 11/11/05, Brad Nicholes [EMAIL PROTECTED] wrote:

  On 11/11/2005 at 1:40:32 pm, in message
 [EMAIL PROTECTED], Jeff
 Trawick
 [EMAIL PROTECTED] wrote:
  On 11/11/05, Brad Nicholes [EMAIL PROTECTED] wrote:
Reposting to the APR list with a new subject line.  Does this need
 to
  be taken care of in APR 1.2.x before httpd 2.2 ships?
 
  apr_wait_for_io_or_timeout() is private APR function (not API).  Is
  the caller outside of APR?

 Yes, HTTPD.  trunk/server/core_filters.c

Simply shocking ;)  That code needs to be fixed to call a real API :(