How to filter http request before finishing receiving all data #119

Closed
ai-quantong opened this Issue Jul 30, 2012 · 3 comments

3 participants

@ai-quantong

HI!
I am working for mobile system, the web service is yaws!
In this system, we need to upload and download the file in the wireless environment.
so it is a must to limit to the num of uploading and downloading the doc in one minute
considering of the load of the server. In this way, we need to have a filter that can filter
the following http request ,and decide whether this upload or download will go on.

Importantly, this action must be executed before the server finish receiving the
request data, It is a strategy to decrease the load of our application server.

I spent all day to reading the yaws 1.93 configure document, but I find nothing
about this function. How do I do it ?

Thank you for the wonderful software.

@capflam
Collaborator

Hi,

If you need to reject all requests when the server is loaded, you can use a shaper to throttles HTTP requests. To do so, you must write a module that implements the behaviour "yaws_shaper". Checks will be done just after headers are received.
By using an Appmod, you could handle downloads and uploads and track how many requests are in progress.
If you want a more fine filtering, a better solution would be to rewrite the request by defining an "arg_rewrite_mod" module. Here, checks will be done after the first chunk of data is received (by default 10240 Bytes).

@klacke
Owner
@ai-quantong

thanks for your advise!

@ai-quantong ai-quantong closed this Aug 1, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment