func ThirdPartyInfoForLocation(ctx context.Context, client httprequest.Doer, url string) (bakery.ThirdPartyInfo, error) {
	dclient := newDischargeClient(url, client)
	info, err := dclient.DischargeInfo(ctx, &dischargeInfoRequest{})
	if err == nil {
		return bakery.ThirdPartyInfo{
			PublicKey: *info.PublicKey,
			Version:   info.Version,
		}, nil
	}
	derr, ok := errgo.Cause(err).(*httprequest.DecodeResponseError)
	if !ok || derr.Response.StatusCode != http.StatusNotFound {
		return bakery.ThirdPartyInfo{}, errgo.Mask(err)
	}
	// The new endpoint isn't there, so try the old one.
	pkResp, err := dclient.PublicKey(ctx, &publicKeyRequest{})
	if err != nil {
		return bakery.ThirdPartyInfo{}, errgo.Mask(err)
	}
	return bakery.ThirdPartyInfo{
		PublicKey: *pkResp.PublicKey,
		Version:   bakery.Version1,
	}, nil
}
// ThirdPartyInfoForLocation returns information on the third party
// discharge server running at the given location URL. Note that this is
// insecure if an http: URL scheme is used. If client is nil,
// http.DefaultClient will be used.
ThirdPartyInfoForLocation returns information on the third party
discharge server running at the given location URL. Note that this is
insecure if an http: URL scheme is used. If client is nil,
http.DefaultClient will be used.
// ThirdPartyInfoForLocation returns information on the third party // discharge server running at the given location URL . Note that this is // insecure if an http : URL scheme is used . If client is nil // http . DefaultClient will be used .
func ThirdPartyInfoForLocation(ctx context.Context, client httprequest.Doer, url string) (bakery.ThirdPartyInfo, error) {
	dclient := newDischargeClient(url, client)
	info, err := dclient.DischargeInfo(ctx, &dischargeInfoRequest{})
	if err == nil {
		return bakery.ThirdPartyInfo{
			PublicKey: *info.PublicKey,
			Version:   info.Version,
		}, nil
	}
	derr, ok := errgo.Cause(err).(*httprequest.DecodeResponseError)
	if !ok || derr.Response.StatusCode != http.StatusNotFound {
		return bakery.ThirdPartyInfo{}, errgo.Mask(err)
	}
	pkResp, err := dclient.PublicKey(ctx, &publicKeyRequest{})
	if err != nil {
		return bakery.ThirdPartyInfo{}, errgo.Mask(err)
	}
	return bakery.ThirdPartyInfo{
		PublicKey: *pkResp.PublicKey,
		Version:   bakery.Version1,
	}, nil
}
func ThirdPartyInfoForLocation ( ctx context . Context , client httprequest . Doer , url string ) ( bakery . ThirdPartyInfo , error ) { dclient := newDischargeClient ( url , client ) info , err := dclient . DischargeInfo ( ctx , & dischargeInfoRequest { } ) if err == nil { return bakery . ThirdPartyInfo { PublicKey : * info . PublicKey , Version : info . Version , } , nil } derr , ok := errgo . Cause ( err ) . ( * httprequest . DecodeResponseError ) if ! ok || derr . Response . StatusCode != http . StatusNotFound { return bakery . ThirdPartyInfo { } , errgo . Mask ( err ) } pkResp , err := dclient . PublicKey ( ctx , & publicKeyRequest { } ) if err != nil { return bakery . ThirdPartyInfo { } , errgo . Mask ( err ) } return bakery . ThirdPartyInfo { PublicKey : * pkResp . PublicKey , Version : bakery . Version1 , } , nil }
ThirdPartyInfoForLocation returns information on the third party
discharge server running at the given location URL.
ThirdPartyInfoForLocation returns information on the third party discharge server running at the given location URL .
// The new endpoint isn't there, so try the old one.