httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Axel-Stéphane SMORGRAV <Axel-Stephane.SMORG...@europe.adp.com>
Subject RE: [users@httpd] passing request to the server
Date Fri, 12 May 2006 12:31:36 GMT
Unless you are doing this in order to familiarise yourself with writing modules for Apache
2.0, I strongly suggest you use a module that already exists and that provides a lot more
flexibility than you module does. That module happens to be mod_rewrite (funny how often it
saves the day!) Combined with mod_proxy it will provide exactly the functionality you need:
 
RewriteEngine on
RewriteRule ^/tiago/precisas/index1.htm http://my.application.server.com/tiago/imprecisas/index1.htm
[P,L]
 
Actually, you probably do not even need mod_rewrite for this specific problem as you could
instead use:
 
ProxyPass /tiago/precisas http://my.application.server.com/tiago/imprecisas

-ascs

________________________________

From: Tiago Semprebom [mailto:tisemprebom@yahoo.com.br] 
Sent: Friday, May 12, 2006 1:27 PM
To: users@httpd.apache.org
Subject: [users@httpd] passing request to the server


Hello,

I'm beginning the development of a handler module and one of the tasks 
of this module is change some request uri to another uri. I developed 
this small module (code below), in this small module I compare if an 
incoming request uri is equal a determinate uri if is true I change this 
request uri for an another uri. I need now to direct this request to the 
server for that it can serve this request and send the result to the 
client.

thank's in advanced,

Tiago Semprebom
---------------------------------------------------------------------------
#include "httpd.h"
#include "ap_config.h"
#include <stdio.h>

static int my_new_handler(request_rec *r)
{
    int APRStatus = OK;

    if (r->method_number != M_GET)
           return DECLINED;

    if (r->finfo.filetype == 0) {
    ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,"print_test: %s", 
r->uri);
    if (!strcmp(r->uri,"/tiago/precisas/index1.htm")){
        r->uri = "/tiago/imprecisas/index1.htm";
    }
        ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r,"print_test2: %s", 
r->uri);
        return HTTP_NOT_FOUND;
    }

    return (APRStatus);
}
     
static void register_hooks(apr_pool_t *p)
{
 ap_hook_handler(my_new_handler,NULL,NULL,APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA my_handler =
{
    STANDARD20_MODULE_STUFF,
    NULL,              /* create per-directory config structure */
    NULL,              /* merge per-directory config structures */
    NULL,              /* create per-server config structure */
    NULL,              /* merge per-server config structures */
    NULL,              /* command apr_table_t */
    register_hooks     /* register hooks */
};


________________________________

Yahoo! Search
Música para ver e ouvir: You're Beautiful, do James Blunt <http://us.rd.yahoo.com/mail/br/tagline/search/video/*http://br.search.yahoo.com/search/video?p=james+blunt&ei=UTF-8&cv=g&x=wrt&vm=r&fr=intl-mail-br-b>


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message