That is strange. The only other thing I can think of is that the requests are
not dynamic request, so the middleware is not being called. Is the URL root
being handled in the app.yaml? something like:
- url: /
static_files: index.html
upload: index.html
Another, thought, what framework are you using webapp, webapp2 flask? It
shouldn't matter, but I'm kind of out of ideas.
Is the code on Github or somewhere I could take look? If you want you can send
me the link off list.
- Kyle
Other then then, I don't know. Is the code public
On Aug 2, 2012, at 7:39 PM, Kate wrote:
> I restarted the instance. I also got a copy of curl.exe for windows and it
> lets me through! :-(
>
> My code is exactly this (below) and is in the file appengine_config.py in the
> root directory.
>
> I also tested your example from my machine and got blocked.
>
> I can't think of why this could be! I even altered appengine_config.py to
> have a syntax error and it picked it up, so I know it is loading.
>
>
> from webob import Response
>
> class AntiCurlMiddleware(object):
> def __init__(self, app):
> self.app = app
>
> def __call__(self, environ, start_response):
> if environ['HTTP_USER_AGENT'].startswith('curl'):
> resp = Response('Too many requests!')
> resp.status = 423
> return resp(environ, start_response)
> return self.app(environ, start_response)
>
> def webapp_add_wsgi_middleware(app):
> return AntiCurlMiddleware(app)
>
>
> On Thursday, August 2, 2012 6:55:37 PM UTC-4, Kyle Finley wrote:
>> How do I restart the instance?
> at appengine.google.com in the instance section you should see a list of
> instance. They each have a "Shutdown" button
>
>> Yes it is in the root directory. I am stumped! I didn't think it was working
>> as I tried testing for different browsers and it didn't catch them.
>
> I don't know, that's strange. I'ts working here:
> http://anticurl.scotch-media.appspot.com/
>
> And if you have included the file in your project, it should at the very
> least stop me from using curl to access your site.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-appengine/-/1jEROOXORQMJ.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine?hl=en.
--
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en.