haxetink / tink_http

Cross platform HTTP abstraction
https://haxetink.github.io/tink_http
33 stars 19 forks source link

[Feature] Support for requests through HTTP proxy #90

Open zicklag opened 6 years ago

zicklag commented 6 years ago

I am behind an HTTP proxy that requires authentication and I need to make HTTP/HTTPS requests through the proxy in order to get to the Internet. It would be perfect if we could implement this functionality in Tink.

In particular, I would hope to be able to use it for the Lix project. I have an open issue about it here: lix-pm/lix.client#29

kevinresol commented 6 years ago

I think we could do something like this

class ProxyClient implements ClientObject {
  var client:Client;
  var settings:ProxySettings;

  public function new(client, settings) {
    this.client = client;
    this.settings = settings;
  }

  public function request(req) {
    var header = ...; // modify the header according to the proxy settings
    return client.request(new OutgoingRequest(header, req.body));
  }
}
zicklag commented 6 years ago

I like it! :wink: I don't have a whole lot of time to work on it, but if I get the chance I'll try it. Thanks.

kevinresol commented 5 years ago

Any updates?

zicklag commented 5 years ago

I never really got to work on it unfortunately. Got busy. :confused: And the project I'm working with right now is Kha and Armory3D and they use git submodules for everything, so it hasn't been as necessary for me.