• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSURLSessionStreamTask and HTTP(S) proxies
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSURLSessionStreamTask and HTTP(S) proxies


  • Subject: NSURLSessionStreamTask and HTTP(S) proxies
  • From: Thibault Martin-Lagardette <email@hidden>
  • Date: Mon, 06 Feb 2017 10:33:49 +0000

Hello,

I am trying to use NSURLSessionStreamTask, as on paper, it's supposed to do what I want:
I need a raw TCP/IP connection to a server, where I write raw data and from which I receive similar type of data. The server *does not understand HTTP*.

In my situation, the connection to the server can be behind a proxy, and it seems that on principle, the NSURLSession API is supposed to handle that.

However, from what I have observed using Little Snitch and a local proxy (tinyproxy to be precise), is that NSURLSessionStreamTask-s do not care to know about HTTP(S) proxies. It will, however, use a SOCKS proxy if one is set. But I need to be able to go through the HTTP(S) proxies as well.

I find this highly surprising, as it is absolutely possible to use an HTTP(S) proxy for raw TCP/IP connections, simply by using the HTTP CONNECT method (RFC 2817 <https://tools.ietf.org/html/rfc2817>)

So I see two possibilities here: either what I am trying to do is just not yet possible with the current APIs, or I am doing something wrong.

For info, my setup is as follows:
- tinyproxy running on 127.0.0.1 on port 8888
- HTTP and HTTPS proxy pointing to tiny.proxy (/etc/host points it to localhost)
- No SOCKS proxy
- Using default NSURLSessionConfiguration
- `connectionProxyDictionary' left to `nil' to use system settings (also tried setting it to the dict from CFNetworkCopySystemProxySettings)

On running the code, I get Little Snitch asking me if my program can access the TCP server, and I see absolutely nothing in tinyproxy's log about any connection request.
What I should see instead is what happens when I do things manually: I should see a connection request in tinyproxy's logs, and Little Snitch should ask me if tinyproxy (not the program) can access the TCP server.

Because the remote TCP server does not understand HTTP at all, I cannot use an NSURLSessionDataTask to then be converted to a stream task. 

Any thoughts on what I could do?
Am I doing something wrong or is the API just not capable of doing that yet?

Thanks in advance!
--

Thibault ML


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSURLSessionStreamTask and HTTP(S) proxies
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Next by Date: Test, Please Ignore
  • Next by thread: Re: NSURLSessionStreamTask and HTTP(S) proxies
  • Index(es):
    • Date
    • Thread