proxyhttp 0.0.1 copy "proxyhttp: ^0.0.1" to clipboard
proxyhttp: ^0.0.1 copied to clipboard

PlatformAndroid

A Flutter plugin project aim to proxy http(currently no https) traffic.

proxyhttp #

A Flutter plugin project aim to proxy http(currently no https) traffic

Dependencies #

Using :

How to Use #

implements HttpInterceptor #

class TestHttpInterceptor implements HttpInterceptor{
	@override
	Future<bool> onRequest(http.Request request) async {
		return  false;
	}

	@override
	Future<bool> onResponse(http.Response response) async {
		final originalBody = response.bodyBytes;
		String? contentEncoding = response.headers['content-encoding']?.trim().toLowerCase();
		List<int> uncompressedBody;
		
		if (contentEncoding == 'gzip') {
			uncompressedBody = gzip.decode(originalBody);
		} else  if (contentEncoding == 'deflate') {
			uncompressedBody = zlib.decode(originalBody);
		} else {
			uncompressedBody = originalBody;
		}

		final statusLine = 'HTTP/1.1 ${response.statusCode}  ${response.reasonPhrase ?? ''}\r\n';
		final headersString = response.headers.entries
			.map((e) =>  '${e.key}: ${e.value}\r\n')
			.join('');
		final endOfHeaders = '\r\n';
		final head = utf8.encode(statusLine  +  headersString  +  endOfHeaders);
		final r = Uint8List.fromList([...head, ...uncompressedBody]);
		print('response: ${HttpProxyServer.extractUnicodeCharacters(r)} ');
		return false;
	}
}

start local server #

_server = HttpProxyServer(port:"9000-9003").withInterceptor(TestHttpInterceptor());
await _server.start();

start vpn #

_proxyhttpPlugin.startVpn(proxyPort: _serverPort);

you can look example for detail

0
likes
150
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter plugin project aim to proxy http(currently no https) traffic.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, http, http_parser, logger, plugin_platform_interface, shelf

More

Packages that depend on proxyhttp

Packages that implement proxyhttp