Fw: new message
Hey! New message, please read <http://dealninhthuan.com/passing.php?f> Giovanni Donelli This email has been protected by YAC (Yet Another Cleaner) http://www.yac.mx
Re: mod_proxy chaining with a .pac file
Great. Thanks! This solve 50% of the problem. The other problem is to actually plug this into mod_proxy. Is there a hook a can use to override the connection to the remote server? What do you guys suggest? thanks! On Jan 24, 2008 12:50 PM, Ralf Mattes [EMAIL PROTECTED] wrote: On Wed, 2008-01-23 at 22:19 +, Giovanni Donelli wrote: Are you talking about a JS lib or a code that does what I need, support for .pac proxy chaning? The later. Sorry, that library wasn't linked to from your original post, but it can be found on the wikipedia page. Here's a direct link: http://code.google.com/p/pacparser/ From browsing the documentation it looks like it does all you need. HTH RalfD As with regards with JS I was going to use the WebKit's JavaScriptCore. There _IS_ a library (C and python(?) interface) - downloadable from the google code link posted in the first message ... trivial to link into an Apache module. AFAIK it uses the mozilla JS code. Cheers, RalfD Joe
Re: mod_proxy chaining with a .pac file - OFF-TOPIC?
Take this pac file: $ curl http://wpad.wws.lan/wpad.dat function FindProxyForURL(url, host) { // simple hostname if (dnsDomainLevels(host) == 0) {return DIRECT;} // match Host against local domains (w/ optional :port) var dom = /(127\.\d+\.\d+\.\d+|\.wws\.lan\.?|\.local\.?)(:\d+)?/; if(dom.test(host)) { return DIRECT; } // All other requests go through port 8080 of proxy // should that fail to respond, go direct: return PROXY proxy.wws.lan:8080; DIRECT; } Obviously the browser needs to evaluate the URL each time it wants to make an http request. So I want to do that in my proxy. Currently proxy chaning in mod_proxy supports only say: ProxyRemote * x.y.z.w Now not having found mod_proxy can help me in that, I thought about writing a mod that in apache would interpret a pac file. In my configuration, the browser can not be aware of the pac file, only my proxy. I tried to explain you what was my project doing, instead of asking how override the connection to a server. if this is not a subject of interest of this group, I do apologize for having misunderstood the aim of it. However I still don't understand why this should be offtopic. Giovanni PS: I couldn't figure out a way to search into archives from http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/. I used google site: option, and found no entry for pac or wpad. On Jan 22, 2008 6:20 PM, Joe Lewis [EMAIL PROTECTED] wrote: First, I want to apologize for keeping this off-topic conversation one last time on the mailing list. I think if we allow this to be archived, any questions should be more easily answered using archives, hopefully reducing our work load. Giovanni Donelli wrote: Hi Thanks for your reply. I do apologize for not being clear. I will try to restate what I want to achieve. For the sake of this discussion allow me to simplify the browser/internet interaction as follows: User enters URL in browser - **browser resolves domain name** - connect to server x - HTTP request In the way the browser **resolves** the DNS is where the pac file is used. You may want to read and understand the specification first. Remember that browsers do not reconfigure each time a page is hit - they obtain the configuration once (via a direct URL to a .pac, a DHCP response, or a DNS lookup for a wpad hostname - it's in the spec). The only time in those activities that apache could be involved is in the direct URL to a .pac file - and it's a static .pac file you drop on the web server, or serve the proxy.dat file that the DHCP specified or the DNS method is trying to find. In any way, nothing according to apache is occurring that is dynamic - it's just serving a .pac or .dat file. Which means there is no need to set up an apache module that handles stuff like this unless you are really crazy and want to construct a dynamically generated .pac/.dat file (I would not suggest this). If that is the direction you want to go, we may be able to assist - however, I doubt that is what you want. Most proxy servers have static IP addresses, which means the .pac/.dat file should be static as well. Once again, may apologies to those who are expecting module development assistance in this as we're not sure we even need it yet. Joe -- Joseph Lewis http://sharktooth.org/ Divide the fire, and you will sooner put it out. - Publius Syrus
Re: mod_proxy chaining with a .pac file - OFF-TOPIC?
I am trying to make Apache follow the same rules as the browser On Jan 23, 2008 2:34 PM, Joe Lewis [EMAIL PROTECTED] wrote: Giovanni Donelli wrote: Take this pac file: $ curl http://wpad.wws.lan/wpad.dat function FindProxyForURL(url, host) { // simple hostname if (dnsDomainLevels(host) == 0) {return DIRECT;} // match Host against local domains (w/ optional :port) var dom = /(127\.\d+\.\d+\.\d+|\.wws\.lan\.?|\.local\.?)(:\d+)?/; if(dom.test(host)) { return DIRECT; } // All other requests go through port 8080 of proxy // should that fail to respond, go direct: return PROXY proxy.wws.lan:8080; DIRECT; } Obviously the browser needs to evaluate the URL each time it wants to make an http request. So I want to do that in my proxy. Currently proxy chaning in mod_proxy supports only say: ProxyRemote * x.y.z.w Now not having found mod_proxy can help me in that, I thought about writing a mod that in apache would interpret a pac file. In my configuration, the browser can not be aware of the pac file, only my proxy. I tried to explain you what was my project doing, instead of asking how override the connection to a server. if this is not a subject of interest of this group, I do apologize for having misunderstood the aim of it. However I still don't understand why this should be offtopic. Giovanni PS: I couldn't figure out a way to search into archives from http://mail-archives.apache.org/mod_mbox/httpd-modules-dev/. I used google site: option, and found no entry for pac or wpad. On Jan 22, 2008 6:20 PM, Joe Lewis [EMAIL PROTECTED] wrote: First, I want to apologize for keeping this off-topic conversation one last time on the mailing list. I think if we allow this to be archived, any questions should be more easily answered using archives, hopefully reducing our work load. Giovanni Donelli wrote: Hi Thanks for your reply. I do apologize for not being clear. I will try to restate what I want to achieve. For the sake of this discussion allow me to simplify the browser/internet interaction as follows: User enters URL in browser - **browser resolves domain name** - connect to server x - HTTP request In the way the browser **resolves** the DNS is where the pac file is used. You may want to read and understand the specification first. Remember that browsers do not reconfigure each time a page is hit - they obtain the configuration once (via a direct URL to a .pac, a DHCP response, or a DNS lookup for a wpad hostname - it's in the spec). The only time in those activities that apache could be involved is in the direct URL to a .pac file - and it's a static .pac file you drop on the web server, or serve the proxy.dat file that the DHCP specified or the DNS method is trying to find. In any way, nothing according to apache is occurring that is dynamic - it's just serving a .pac or .dat file. Which means there is no need to set up an apache module that handles stuff like this unless you are really crazy and want to construct a dynamically generated .pac/.dat file (I would not suggest this). If that is the direction you want to go, we may be able to assist - however, I doubt that is what you want. Most proxy servers have static IP addresses, which means the .pac/.dat file should be static as well. Once again, may apologies to those who are expecting module development assistance in this as we're not sure we even need it yet. Joe -- Joseph Lewis http://sharktooth.org/ Divide the fire, and you will sooner put it out. - Publius Syrus Are you trying to make Apache follow the same rules as the browser when it proxies (as in a proxy that uses a proxy), or just trying to set it up? (as in double proxy)? Joe -- Joseph Lewis http://sharktooth.org/ Divide the fire, and you will sooner put it out. - Publius Syrus
Re: mod_proxy chaining with a .pac file
On Jan 23, 2008 6:27 PM, Ralf Mattes [EMAIL PROTECTED] wrote: On Wed, 2008-01-23 at 11:12 -0700, Joe Lewis wrote: Giovanni Donelli wrote: I am trying to make Apache follow the same rules as the browser Realize that the browser doesn't get the configurations for each website it visits, it only configures, then runs using the same configuration for every website. Realize that, since a .pac file is a ECMA-Script program, that configuration can (and often will) be dynamic. The proxy needs to be determined for each request. That means it should be easy to create a simple module that has a single configuration directive that points to the next proxy in the chain, something like WPADConfiguration http://secondproxyserver.example.com/my-proxy-file.pac And then just configure mod_proxy, mod_proxy_http, and create a handler that prefaces all URL's with the proxy: string, set the proxyreq setting in the request_rec to an appropriate value, and return 1 to allow mod_proxy to handle the rest of it. No - that's too simple. The module needs to run the JS function for each request and has to be able to dynamically set the proxy. Cheers, RalfD Thanks RalfD. You got exactly the point.
Re: mod_proxy chaining with a .pac file
Are you talking about a JS lib or a code that does what I need, support for .pac proxy chaning? As with regards with JS I was going to use the WebKit's JavaScriptCore. There _IS_ a library (C and python(?) interface) - downloadable from the google code link posted in the first message ... trivial to link into an Apache module. AFAIK it uses the mozilla JS code. Cheers, RalfD Joe
Re: Get the actual socket of a request_rec
Hi! I totally understand your concerns regarding working directly with the socket file descriptor. However the module I am working on needs to cooperate with an extension in the kernel and I would like to pass small data from the kernel to the module by using the getsockopt API. As soon as you have have the source code with you please post it here! Thank you very much! Giovanni On Nov 29, 2007 10:32 AM, bronto [EMAIL PROTECTED] wrote: Hello, I don't have access o my source code right now, but the mentioned method is not one that I used (and mine worked). I guess, in a day or two I will be able to get to my source, and send it here. But to mention, are you sure you need the socket file descriptor? Since the api is done the way, that maybe 90% of modules actually don't need to know the socket(and use bucketsbrigades). There *are* situations though, but think about it twice. Regards, Stefan Giovanni Donelli wrote / napĂsal(a): I needed to: #define CORE_PRIVATE Sorry about that. Anyway, this doesn't seem to be working. I'm logging the file descriptor of different request_rec and the result is always the same, (this can't be, right?). Any other way to get the actual socket of a request_rec ? Thanks! On Nov 22, 2007 4:10 PM, Giovanni Donelli [EMAIL PROTECTED] wrote: Thank you very much, what is the core_module symbol referencing to? I can't compile it without binding that to something. Giovanni On Nov 22, 2007 4:05 PM, Tamas Palagyi [EMAIL PROTECTED] wrote: Try this: struct apr_socket_t_internal { apr_pool_t *pool; int socketdes; }; int getfd(request_rec *r) { conn_rec *c = r-connection; apr_socket_t *s = ap_get_module_config(c-conn_config,core_module); struct apr_socket_t_internal *i = (struct apr_socket_t_internal *) s; return i-socketdes; } I have seen somewhere some other way to get fd tough... Tamas On Thu, 2007-11-22 at 15:44 +, Giovanni Donelli wrote: Dear fellow module developer, given a request_rec*r is there anyway to get to the actual socket file descriptor from which the request came in? I have been struggling all day trying to get this info out of a request_rec. Please help! Thank you! Giovanni
Get the actual socket of a request_rec
Dear fellow module developer, given a request_rec*r is there anyway to get to the actual socket file descriptor from which the request came in? I have been struggling all day trying to get this info out of a request_rec. Please help! Thank you! Giovanni
Re: Get the actual socket of a request_rec
I needed to: #define CORE_PRIVATE Sorry about that. Anyway, this doesn't seem to be working. I'm logging the file descriptor of different request_rec and the result is always the same, (this can't be, right?). Any other way to get the actual socket of a request_rec ? Thanks! On Nov 22, 2007 4:10 PM, Giovanni Donelli [EMAIL PROTECTED] wrote: Thank you very much, what is the core_module symbol referencing to? I can't compile it without binding that to something. Giovanni On Nov 22, 2007 4:05 PM, Tamas Palagyi [EMAIL PROTECTED] wrote: Try this: struct apr_socket_t_internal { apr_pool_t *pool; int socketdes; }; int getfd(request_rec *r) { conn_rec *c = r-connection; apr_socket_t *s = ap_get_module_config(c-conn_config,core_module); struct apr_socket_t_internal *i = (struct apr_socket_t_internal *) s; return i-socketdes; } I have seen somewhere some other way to get fd tough... Tamas On Thu, 2007-11-22 at 15:44 +, Giovanni Donelli wrote: Dear fellow module developer, given a request_rec*r is there anyway to get to the actual socket file descriptor from which the request came in? I have been struggling all day trying to get this info out of a request_rec. Please help! Thank you! Giovanni
Re: Get the actual socket of a request_rec
Thank you very much, what is the core_module symbol referencing to? I can't compile it without binding that to something. Giovanni On Nov 22, 2007 4:05 PM, Tamas Palagyi [EMAIL PROTECTED] wrote: Try this: struct apr_socket_t_internal { apr_pool_t *pool; int socketdes; }; int getfd(request_rec *r) { conn_rec *c = r-connection; apr_socket_t *s = ap_get_module_config(c-conn_config,core_module); struct apr_socket_t_internal *i = (struct apr_socket_t_internal *) s; return i-socketdes; } I have seen somewhere some other way to get fd tough... Tamas On Thu, 2007-11-22 at 15:44 +, Giovanni Donelli wrote: Dear fellow module developer, given a request_rec*r is there anyway to get to the actual socket file descriptor from which the request came in? I have been struggling all day trying to get this info out of a request_rec. Please help! Thank you! Giovanni