httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Graham Leggett" <minf...@sharp.fm>
Subject Re: writing 2.x module thaty makes SSL connection
Date Tue, 13 Jun 2006 09:16:37 GMT
On Tue, June 13, 2006 9:31 am, Lai Yiu Fai wrote:

> Thanks but looks difficult to me after reading the code.  mod_include is
> quite complicated and writing in filter that I don't familiar.
>
> Is it so simple to fire off a subrequest with current request_rec r like
> below:
>
>  rr = ap_sub_req_lookup_uri("https://some-server/some-doc.xml", r, NULL);
>  if (rr->status == HTTP_OK && ap_run_sub_req(rr) == OK) {
>     /* ... read response ... */
>  }
>
> Does this pass automatically to mod_proxy_http to handle the request? How
> can I read the response back?  Sorry it sounds novice question but I can't
> find similar code for reference.

The syntax in mod_include is <!--#include virtual="url"-->, and the code
that handles this is around line 1579 of mod_include.c:

    else if (!strcmp(tag, "virtual")) {
        /* note: it is okay to pass NULL for the "next filter" since
           we never attempt to "run" this sub request. */
        rr = ap_sub_req_lookup_uri(tag_val, r, NULL);

        if (rr->status == HTTP_OK && rr->finfo.filetype != 0) {
            memcpy((char *) finfo, (const char *) &rr->finfo,
                   sizeof(rr->finfo));
            ap_destroy_sub_req(rr);
            return 0;
        }
        else {
            ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, "unable to get "
                          "information about \"%s\" in parsed file %s",
                          tag_val, r->filename);
            ap_destroy_sub_req(rr);
            return -1;
        }
    }

So it looks like the answer to your question is yes,
ap_sub_req_lookup_uri() should be the function to use. The code above is
an example of it being used.

Regards,
Graham
--



Mime
View raw message