N
N
nirvimel2015-12-14 05:38:38
Python
nirvimel, 2015-12-14 05:38:38

On the basis of what is it better to create an HTTP proxy that passes the body of the image / * server responses to the script / plugin for processing, and quickly passes the rest of the traffic?

The task is to capture all images with image/*Content-Type, process them in a certain way, and then replace the original with the processed version while passing the rest of the traffic as quickly as possible. It is also very desirable to be able to connect a parent proxy, to which traffic will be forwarded.
I could write such a bicycle (prototype) in many of the languages ​​I know, regardless of performance. But I'm interested in the correcta variant of the approach to this task, and not just a list of options, such as "and you can also somehow make a lot of money on this." It would be ideal to use a ready-made server (in a mature state, optimized and honed) with the ability to attach your plugin or script to it. But I didn't find an appropriate solution among the popular servers. If you write the server yourself, then as a basis it is better to take some kind of mature project that provides for the possibility of extension (event interception, for example).
As for Python, in which I was going to solve the problem right away, it turns out that there are practically no suitable options for it. All I found is:

  1. CherryProxy - CherryPy based, good idea, but abandoned in 2012, there are options to connect parent proxy.
  2. proxy2 - based on blocked Threading threads (!), the main focus is on intercepting and replacing SSL, there is no way to connect a parent proxy, I continue to study it for now.
  3. proxy.py - relatively popular on githab, too confused by the complete absence of dependencies, inside the logic is tightly tied to many different states (personally, I do not like any analogies with the state machine, it is opaque and far from a functional approach), no possibility for extension (or monkey patch in many places or a major redesign of the architecture), there is no way to connect the parent proxy.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stalker_RED, 2015-12-14
@nirvimel

If speed is really important to you, then why not take nginx ?

Z
Zakharov Alexander, 2015-12-14
@AlexZaharow

... I will add a separate message, suddenly someone does not read the comments very much. There is also this thing Fiddler.core:
www.telerik.com/fiddler/fiddlercore
There you can do JavaScript scripting using .net. But only he has a not quite free license: www.telerik.com/purchase/fiddlercore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question