Return-Path: Delivered-To: apmail-httpd-apreq-dev-archive@www.apache.org Received: (qmail 21351 invoked from network); 24 Feb 2006 20:31:51 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Feb 2006 20:31:51 -0000 Received: (qmail 92920 invoked by uid 500); 24 Feb 2006 20:31:51 -0000 Delivered-To: apmail-httpd-apreq-dev-archive@httpd.apache.org Received: (qmail 92898 invoked by uid 500); 24 Feb 2006 20:31:51 -0000 Mailing-List: contact apreq-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Id: Delivered-To: mailing list apreq-dev@httpd.apache.org Received: (qmail 92887 invoked by uid 99); 24 Feb 2006 20:31:50 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2006 12:31:50 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of gcaa-apreq-dev@m.gmane.org designates 80.91.229.2 as permitted sender) Received: from [80.91.229.2] (HELO ciao.gmane.org) (80.91.229.2) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 24 Feb 2006 12:31:49 -0800 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1FCjav-0007cT-1z for apreq-dev@httpd.apache.org; Fri, 24 Feb 2006 21:31:17 +0100 Received: from 133-202.240.81.adsl.skynet.be ([81.240.202.133]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Feb 2006 21:31:17 +0100 Received: from f.braem by 133-202.240.81.adsl.skynet.be with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 24 Feb 2006 21:31:17 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: apreq-dev@httpd.apache.org From: Franky Braem Subject: Re: File upload Date: Fri, 24 Feb 2006 21:31:01 +0100 Lines: 91 Message-ID: References: <87lkw0c0j5.fsf@gemini.sunstarsys.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 133-202.240.81.adsl.skynet.be User-Agent: Mozilla Thunderbird 1.0.5 (Windows/20050711) X-Accept-Language: en-us, en In-Reply-To: <87lkw0c0j5.fsf@gemini.sunstarsys.com> Sender: news X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Joe Schaefer wrote: > Franky Braem writes: > > >>Is there a step by step tutorial on how to implement a file upload in >>an Apache module with apreq2? I'm trying to write mod_wxjs (JavaScript >>and wxWidgets as server side script, more info on >>wxjs.sourceforge.net) and I want to add a file upload functionality >>(something like php). >> >> > > > Something like this: > > #include "httpd.h" > #include "apreq_module.h" > #include "apreq_param.h" > #include "apreq_module_apache2.h" > #include "apreq_util.h" > > apreq_handle_t *req; > apreq_param_t *param; > request_rec *r; > > ... initialize r ... > > req = apreq_handle_apache2(r); > > param = apreq_body_get(req, "name of upload widget"); > > if (param == NULL) { > /* error: missing field */ > } > else if (param->upload == NULL) { > /* error: widget not an upload */ > } > else { > > /* have upload field */ > > apr_table_t *info; /* upload headers */ > apr_bucket_brigade *bb; /* upload contents */ > apr_bucket_t *e; > > info = param->info; > /* DO SOMETHING with info */ > > bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); > apreq_brigade_copy(bb, param->upload); > > while ((e = APR_BRIGADE_FIRST(bb)) != APR_BRIGADE_SENTINEL(bb)) { > apr_size_t dlen; > const char *data; > apr_status_t s; > > /* apr_bucket_read() has side effects on spool buckets, which > * is why we read from a copy of the brigade - to conserve memory > */ > s = apr_bucket_read(e, &data, &dlen, APR_BLOCK_READ); > > if (s != APR_SUCCESS) { > /* error: bad bucket read */ > break; > } > else { > /* DO SOMETHING with data, dlen */ > } > > apr_bucket_delete(e); > } > > } > > I'm trying to integrate apreq2 into wxJS, but I get the following crash when trying to handle a request: > apreq2.dll!apreq_filter_relocate(ap_filter_t * f=0x00000000) Line 48 + 0x3 bytes C apreq2.dll!get_apreq_filter(apreq_handle_t * handle=0x05b20938) Line 45 + 0xc bytes C apreq2.dll!apreq_handle_apache2(request_rec * r=0x015aaad0) Line 435 + 0x9 bytes C mod_wxjs.dll!wxjs_handler(request_rec * r=0x015aaad0) Line 287 + 0x9 bytes C++ libhttpd.dll!_ap_run_handler@4() + 0x1f bytes Is it possible to build libapreq2 with Visual Studio Express 2005?