P3D3::System proxy

Create issue
Issue #264 open
Moritz Lichter created an issue

I was not able to make MacHG use the system https proxy. I was able to open the bitbucket repository using Safari but not using MacHG. Tried exactly the same configuration without a proxy (and another internet connection), everything works fine.

Comments (13)

  1. Jason Harris repo owner
    • changed status to open

    MacHg just uses the underlying Mercurial python binary, so can you investigate which commands your binary is issuing that MacHg isn't issuing? Ie can you look at the logs and try the same commands that MacHg is sending for eg pull & push?

    Thanks, Jas

  2. Andrew Butterfield

    I am having this same problem. If I go to the repository and run 'hg pull' it works fine

    MacHg keeps giving the error code 255 message (connection refused)

    I've looked at the log but have no idea how to cut and paste a command from there to try it out

  3. Moritz Lichter reporter


    one has to tell Hg which proxy to use by writing it in the hgrc in the .hg directory. Syntax:

    host = what.ever.server.com:<portnumber>

    More information and more possible fields (e.g. to use passwords) can be found here: http://www.selenic.com/mercurial/hgrc.5.html#http-proxy

    Is it possible to include an option that MacHG automatically writes the current active system proxy to that file?


  4. Jason Harris repo owner

    Interesting question... I don't actually use proxies myself. How do you think this interface should work, Ie a check box in some part of the advanced preferences. I can get the active proxy from CFNetworkCopySystemProxySettings() but how to apply this etc might be kind of difficult. I'll think about this...

    Thanks, Jas

  5. Moritz Lichter reporter

    Can you determine whether a proxy is set or not? In the case that you can you could add a checkbox "Use system proxy when set" or something like that. I do not get why applying the proxy is so difficult? You just have to write it in the file and Mercurial will take care of it. Currently I do it by hand and it works well. Or do I miss something?



  6. Jason Harris repo owner

    Network configuration is normally a hideously complex thing. I guess in the configuration of the server I could have a proxy field... And in there could be a button use active proxy which would fill this proxy field in. That would cause a line in the hgrc file to be written...

  7. Moritz Lichter reporter

    That idea sounds good. But I suggest to use a checkbox that disables the text fields for manual input, so one can change of the system proxy and the sever configuration updates automatically. Would detecting a change of the system proxy be very difficult? (That could be helpful if you e.g. use WLan at home and Lan at work and the connection at work requires a proxy, but you do not have to change the system proxy because you switch the network adapters). If yes, it would be of course no problem to click the button manually.

  8. Jason Harris repo owner

    Ohh.. I read

    host = what.ever.server.com:<portnumber>

    as for example:

    www.bitbucket.com = myProxy:8080

    and not literally as the word "host" and all http traffic would go over the host... So this is a basic use current http_proxy as proxy everywhere. That makes a lot more sense as a setting to have. Thanks for persisting with the explanation. Hmm... Now I wonder about the best way to do this... Maybe in the advanced options a check box:

    "Use System Proxy"

    with tooltip

    "Proxy all connections through the current system proxy (if available)"

    Also I think if the individual repo contains a [http_proxy] settings that should override this?

    Does this sound about right?

    Cheers, Jas

  9. Moritz Lichter reporter

    Yes, I think that sound good. You mainly have to copy the system settings

    host = myProxy.com::8081

    And the checkbook option sounds reasonable. You can add comments to the hgrc file. I think it would make sense to comment out the individual proxy and add the system one (if the checkbox is checked), wouldn't it? So something like:

    # host = individual.proxy.host:8083
    host = system.proxy.host:8081


  10. Cameron MacPherson

    Hi guys,

    Thanks for this discussion. I think this thread describes the problem I am having at work. I could not find any settings in MacHg for specifying a proxy or switching to the system settings, but I do not mind altering the .hgrc file. My only problem is that I can not find the .hgrc file on OSX10.8. I suspect I have to create it, but if so, then where?

    Thanks for any help,


  11. Log in to comment