Android HTTP Request AsyncTask

I think you didn’t understand exactly the way AsyncTask works. But I believe you wish to reuse the code for different tasks; if so, you can create an abstract class and then extend it implementing an abstract method you created. It should be done like this: public abstract class JSONTask extends AsyncTask<String, Void, String> { … Read more

Node.js: how to limit the HTTP request size and upload file size?

Just an update (07-2014), as I’m not able to add comments: As correctly noted above, newer Express versions have deprecated the use of the limit middleware and now provide it as a built-in option for the BodyParser middleware: var express = require(‘express’) var bodyParser = require(‘body-parser’) var app = express() app.use(bodyParser.json({ limit: ‘5mb’ }))

How secure is HTTP_ORIGIN?

HTTP_ORIGIN is a way to protect against CSRF (Cross Site Request Forgery) requests. Currently it is implemented only by Chrome (as of Nov 2011). I tested Firefox and Opera, but they failed. Its name in the request header is Origin. On the server in my PHP script I see it as HTTP_ORIGIN in the $_SERVER … Read more

How to set the allowed url length for a nginx request (error code: 414, uri too large)

From: http://nginx.org/r/large_client_header_buffers Syntax: large_client_header_buffers number size ; Default: large_client_header_buffers 4 8k; Context: http, server Sets the maximum number and size of buffers used for reading large client request header. A request line cannot exceed the size of one buffer, or the 414 (Request-URI Too Large) error is returned to the client. A request header field … Read more

Proxies with Python ‘Requests’ module

The proxies‘ dict syntax is {“protocol”: “scheme://ip:port”, …}. With it you can specify different (or the same) proxie(s) for requests using http, https, and ftp protocols: http_proxy = “http://10.10.1.10:3128” https_proxy = “https://10.10.1.11:1080” ftp_proxy = “ftp://10.10.1.10:3128” proxies = { “http” : http_proxy, “https” : https_proxy, “ftp” : ftp_proxy } r = requests.get(url, headers=headers, proxies=proxies) Deduced from … Read more