Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8471067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:41:40+00:00 2026-06-10T16:41:40+00:00

I have setup a squid http proxy on my Mac and I have setup

  • 0

I have setup a squid http proxy on my Mac and I have setup my Mac to share its wireless connection. In the wifi connection information on my phone I have setup my HTTP Proxy Settings:

Server: 10.0.2.1
Port:   3128
Authentication: off

In my iOS application I have two ways of accessing the network. For http requests I am using NSURLRequest and for other TCP connections I am using the AsyncSocket library.

All requests using NSURLRequest use the proxy without an issue (for SSL, the proxy acts as a HTTP CONNECT tunnel). However, I cannot seem to get the proxy to be used for the AsyncSocket connections.

I did update the AsyncSocket library to call the following whenever the CFStreams are created e.g.:

//for printing out the proxy settings
static void printEntry (const void* key, const void* value, void* context) {
    CFShow(key);
    CFShow(value);
}

- (BOOL)createStreamsFromNative:(CFSocketNativeHandle)native error:(NSError **)errPtr
{
    // Create the socket & streams.
    CFStreamCreatePairWithSocket(kCFAllocatorDefault, native, &theReadStream, &theWriteStream);
    .
    .
    .
    CFDictionaryRef proxyDict = CFNetworkCopySystemProxySettings();
    CFDictionaryApplyFunction(proxyDict, printEntry, NULL); // I see the proxy settings are correct here

    CFReadStreamSetProperty(theReadStream, kCFStreamPropertyHTTPProxy, proxyDict);
    CFWriteStreamSetProperty(theWriteStream, kCFStreamPropertyHTTPProxy, proxyDict);

    CFRelease(proxyDict);
    return YES;
}

Anything obvious I have missed here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T16:41:42+00:00Added an answer on June 10, 2026 at 4:41 pm

    From the apple documentation:

    https://developer.apple.com/library/ios/#DOCUMENTATION/Networking/Conceptual/CFNetwork/CFStreamTasks/CFStreamTasks.html#//apple_ref/doc/uid/TP30001132-CH6-DontLinkElementID_16

    there is nothing that indicates that this shouldn’t work. The documentation mentions using CFStreams, not CFHTTPStreams.

    Since I couldn’t get it to work as the documentation states and I was running out of time, I implemented my own HTTP proxy code which in the end was ot too difficult. If the configuration indicated that a HTTP proxy was set, I redirected the initial connect to the proxy and initiated a HTTP request with the following headers:

    CONNECT <real host>:<real port> HTTP/1.1
    Host: <real host>
    Proxy-Connection: keep-alive
    Connection: keep-alive
    

    On receiving a complete http response with a 200 response code, I begin socket communication as if communicating directly with the server (e.g. like calling startTLS to begin SSL).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have setup the JDBC connection pooling and its showing the following error when
Ok, this is what I want to do. I have a squid proxy setup
I have setup a CodeIgniter Application on my server at the following URL: http://subdomain.domainame.com/something1/something2/
Have setup an ssl connection app, have already setup connection between client and server
I have setup ability for a user to specify some settings using the in-built
I have setup Codeigniter on my server and I installed Grocery crud on it.
I have setup a new server and copyed my website on to it and
I have setup git server via ssh (one git account and many different public/private
i have setup svn server using svnserve.exe and TortoiseSvn on my pc. svnserve.conf is
I have setup a settings bundle and can successfully pull data from that. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.