Sorry for that.

I was using a separate Transport. I found the solution.
I’ve done roughly what is here:
http://golang.org/src/pkg/net/http/client.go?s=8849:8916#L308
Line 308.
For some reason, I always though that it was untenable, thinking that it 
would require more than just the querystring as the Reader.

On Monday, September 3, 2012 6:25:59 PM UTC+3, Johan Euphrosine (Google) 
wrote:
>
> Hi Revence, 
>
> Have you already tried to ask the same question on Stack Overflow or 
> on google-appengine-go@ (they are still using a separate group while 
> the runtime is experimental): 
> http://stackoverflow.com/questions/tagged/google-app-engine 
>
> When defining a custom transport on App Engine you should make sure 
> you use urlfetch.Transport to make the actual request: 
>
> http://code.google.com/p/appengine-go/source/browse/appengine/urlfetch/urlfetch.go#29
>  
>
> Hope that helps. 
>
> On Mon, Sep 3, 2012 at 5:16 PM, Revence Kalibwani 
> <[email protected]<javascript:>> 
> wrote: 
> > This little piece of code shows three problems I have encountered (and 
> > solved, with varying levels of success) while using Go on App Engine. 
> > 
> >   endpoint, e :=  url.Parse(streamType) 
> >   if e != nil { return stream, t.New("Parsing for %s failed.", 
> streamType) } 
> >   //  endpoint.User = url.UserPassword(auth.Username, auth.Password) 
> >   client.Transport  = &http.Transport { 
> >     Proxy : func(req *http.Request) (*url.URL, error) { 
> >       req.SetBasicAuth(auth.Username, auth.Password) 
> >       return nil, nil 
> >     }, 
> >   } 
> >   if post { 
> >     resp, e = client.PostForm(endpoint.String(), options) 
> >   } else { 
> >     endpoint.RawQuery = options.Encode() 
> >     resp, e = client.Get(endpoint.String()) 
> >   } 
> >   if e != nil { return stream, t.New("Could not fetch %s (%s): %v", 
> > endpoint, options.Encode(), e) } 
> > 
> > 
> > 
> > While URL’s that contain auth information are valid—like 
> > http://user:[email protected]/ for example—the parser in Go’s net/url 
> > package can’t handle them. (In fact, in the code, the logic for dealing 
> with 
> > URLs that have auth information is there, but the parsing of them fails 
> > consistently miserably.) This is the case both in development and in 
> > production. 
> > My work-around, as you can see, was first to try to set the User 
> attribute 
> > of the URL object. But for POST requests, it is ignored. Since I will be 
> > dealing with POST requests (as well as GET), I chose the option below 
> it. I 
> > created a fake proxy, whose only job was to enforce auth. It does it on 
> the 
> > Request object, which is never exposed anywhere at any point by the API. 
> The 
> > trick works. 
> > Then another problem shows up, in that in development, the thing works 
> > flawlessly, but in production it consistently returns permission denied. 
> > This is provoked by the proxy—in that GAE doesn’t allow me to work the 
> > proxy, even though that restriction is not documented explicity. When I 
> > remove the proxy dance, it works. 
> > 
> > I wonder how one can express Basic Authentication for a HTTP request 
> without 
> > running afoul of the gae gopher. 
> > (This discussion system allows me to start a discussion xor ask a 
> question; 
> > I want to do both!) 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "Google App Engine" group. 
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msg/google-appengine/-/MrznnN5m970J. 
> > To post to this group, send email to 
> > [email protected]<javascript:>. 
>
> > To unsubscribe from this group, send email to 
> > [email protected] <javascript:>. 
> > For more options, visit this group at 
> > http://groups.google.com/group/google-appengine?hl=en. 
>
>
>
> -- 
> Johan Euphrosine (proppy) 
> Developer Programs Engineer 
> Google Developer Relations 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-appengine/-/O5Cq_C_ZTkMJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to