FAQ
Hi, list.

I put new small package go-ieproxy. This provide a way to overwrite proxy
configuration by $HTTP_PROXY environment variable.
For example,

package main

import (
     "fmt"
     "io"
     "net/http"
     "os"

     _ "github.com/mattn/go-ieproxy/global" // THIS LINE!
)

func main() {
     os.Setenv("HTTP_PROXY", "")
     os.Setenv("HTTPS_PROXY", "")
     res, err := http.Get("http://www.google.com")
     if err != nil {
         fmt.Fprintln(os.Stderr, err)
         os.Exit(1)
     }
     defer res.Body.Close()
     io.Copy(os.Stdout, res.Body)
}

This handle http proxy with IE configuration.

https://github.com/mattn/go-ieproxy

NOTE: It's not possible to build on non-windows box.

- mattn

BTW, sorry mis-posting e-mail on golang-dev.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Aldrin Leal at Dec 2, 2014 at 12:49 pm
    A challenge foe you: Why not use build tags (perhaps parsing the right linux env vars) to allow other OSes?

    Sent from my Windows Phone

    -----Original Message-----
    From: "mattn" <mattn.jp@gmail.com>
    Sent: ‎12/‎2/‎2014 6:45 AM
    To: "golang-nuts@googlegroups.com" <golang-nuts@googlegroups.com>
    Subject: [go-nuts] [ANN] HTTP Client with IE proxy settings

    Hi, list.


    I put new small package go-ieproxy. This provide a way to overwrite proxy configuration by $HTTP_PROXY environment variable.
    For example,


    package main


    import (
         "fmt"
         "io"
         "net/http"
         "os"


         _ "github.com/mattn/go-ieproxy/global" // THIS LINE!
    )


    func main() {
         os.Setenv("HTTP_PROXY", "")
         os.Setenv("HTTPS_PROXY", "")
         res, err := http.Get("http://www.google.com")
         if err != nil {
             fmt.Fprintln(os.Stderr, err)
             os.Exit(1)
         }
         defer res.Body.Close()
         io.Copy(os.Stdout, res.Body)
    }


    This handle http proxy with IE configuration.


    https://github.com/mattn/go-ieproxy


    NOTE: It's not possible to build on non-windows box.


    - mattn


    BTW, sorry mis-posting e-mail on golang-dev.
    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedDec 2, '14 at 11:44a
activeDec 2, '14 at 12:49p
posts2
users2
websitegolang.org

2 users in discussion

Mattn: 1 post Aldrin Leal: 1 post

People

Translate

site design / logo © 2022 Grokbase