logo
Apache Lounge
Webmasters

 

About Forum Index Downloads Search Register Log in RSS X


Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
Post new topic   Forum Index -> Building & Member Downloads View previous topic :: View next topic
Reply to topic   Topic: Using mod_bw with Location directive
Author
GadiK



Joined: 14 Jul 2010
Posts: 14

PostPosted: Sat 22 Jan '11 13:24    Post subject: Using mod_bw with Location directive Reply with quote

Hi all,
We're using Apache 2.2.16 (Windows) for our server.
We want to limit the number of simultaneous downloads from a certain url.
We've modified mod_bw to allow us to state the allowed max connections.

Using <Location> directive we've configured the connection limit to a certain url.

When not using cache it works fine. However, when using cache (mod_cache) the configuration isn't read from the <Location> block.
If we write the configuration outside the <Location> block it is read, but not from within the block.

Does anyone have any idea why this is happening?

Thank you,
Gadi K
Back to top
James Blond
Moderator


Joined: 19 Jan 2006
Posts: 7298
Location: Germany, Next to Hamburg

PostPosted: Mon 24 Jan '11 17:26    Post subject: Reply with quote

From the FAQ page and the examples I've seen I'm not sure if it is working in <location> (haven't tried / won't try), but it work in Directory. if that url is not a virtual one and inside your wwwroot you could limit it that way-

e.g.
Code:

 <VirtualHost *:80>
    BandWidthModule On
    BandWidth all 16384
    LargeFileLimit * 500 4096
    <Directory "c:/apache22/wwwroot/somefolder>
      LargeFileLimit * 100 1024
    </Directory>


This wont limit Directory c:/apache22/wwwroot/somefolder to 16384. The Directory wont "inherit" the settings from the vhost if you use some of the mod's directives.
Back to top
GadiK



Joined: 14 Jul 2010
Posts: 14

PostPosted: Mon 24 Jan '11 17:53    Post subject: Reply with quote

Thanks for the answer. But, I am afraid I haven't made myself clear enough. I should've wrote the configuration like you did. We are using the directives inside the loaction tags:

Code:
<Location /foo/bar>
   BandWidthModule On
   MaxCons all 50   //we added this functionality to better suit our needs
</Location>


And we expect it to limit number of concurrent connections for all URLs that begin with /foo/bar.

If we weren't using mod_cache it would've worked. However, we are using mod_cache and since mod_cache uses ap_hook_quick_handler() it always serves the request before any other module.
This in mind, we modified mod_bw to also use ap_hook_quick_handler(), and mod_cache to call mod_bw itself:

Code:

static const char * const aszPre[] = {"mod_bw.c", NULL};
   
ap_hook_quick_handler(cache_url_handler, aszPre, NULL, APR_HOOK_FIRST);


Then we found out that using ap_hook_quick_handler() has its drawbacks since it is called before any request processing. Apparently the location enclosed directives are not available.

Right now we have solved the problem by adding a call to ap_location_walk() at the beginning of mod_bws' handle function. This gives us the information we need and the wanted functionality works. However, this doesn't feel like the best solution since ap_location_walk() isn't a very documented function.


Anyone has an alternative?


Thank you,
Gadi K
Back to top
chachotoro



Joined: 25 Jan 2011
Posts: 3

PostPosted: Tue 25 Jan '11 12:56    Post subject: Reply with quote

Hello,

I'm looking for the bw_mod for apache 2.2.16 (windows).
I read that you have it.
Could you tell me where you found it ?

Thank you.
Sorry for the bad english...
Back to top
GadiK



Joined: 14 Jul 2010
Posts: 14

PostPosted: Tue 25 Jan '11 13:04    Post subject: Reply with quote

Well actually I didn't download it myself I inherited this project from someone else. However, a quick google search came up with this:
http://bwmod.sourceforge.net/#
Back to top
chachotoro



Joined: 25 Jan 2011
Posts: 3

PostPosted: Tue 25 Jan '11 15:21    Post subject: Reply with quote

Thank you very much for your answer but the version i find is for apache 2.0.54 :

Get Bandwidth Mod v0.7 (Windows DLL for 2.0.54)

and nothing for 2.2.16 (Windows).
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Tue 25 Jan '11 16:54    Post subject: Reply with quote

That's an old Google summer of code page from a few years ago. The module is at version 0.92, the Windows build is 0.91 (no changes in 0.92 affecting Apache 2.2). This module can be used for Apache from apache.org and some others. It was built against 2.2.14 but will work with 2.2.16.

http://apache.ivn.cl/

People running VC9 built versions of Apache from Apache Lounge or Apache Haus, there are both x86 & x64 versions of mod_bw/0.92 at Apache Haus
Back to top
chachotoro



Joined: 25 Jan 2011
Posts: 3

PostPosted: Wed 26 Jan '11 21:19    Post subject: Reply with quote

Sorry but in final the problem seems not to be with the version of the dll.

Because with the last version i have the same problem.

I think it's not a problem with apache but with windows because when i try the dos command : loadlibrary("mod_bw.dll") a echoué (= failed)

Do you have an idea ?
Does this library need some prerequisites ?

Thank you for your answers.
Chacho.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2268
Location: Sun Diego, USA

PostPosted: Wed 26 Jan '11 23:07    Post subject: Reply with quote

I don't know what your doing there at the command line but how are you loading it in Apache? If it errors, what's in Apache's error log and Windows Event Log?
Back to top
GadiK



Joined: 14 Jul 2010
Posts: 14

PostPosted: Tue 01 Feb '11 18:12    Post subject: Reply with quote

Can we get back to my original post?
Has anyone ever dealt with this kind of situation where a module needs to run its handler before mod_cache??

Thank you.
Back to top


Reply to topic   Topic: Using mod_bw with Location directive View previous topic :: View next topic
Post new topic   Forum Index -> Building & Member Downloads