[Yum-devel] enable yum to pass http data to repository

David Lutterkort dlutter at redhat.com
Thu Nov 10 00:59:05 UTC 2005


On Wed, 2005-11-09 at 19:16 -0500, Bryan Mills wrote:
> David Lutterkort wrote:
> >If I understand your patch right, the http_data is used to send request
> >parameters to the server; how about changing it so that you can provide
> >a base url with request parameters, i.e., make it so that yum
> >understands a URL of the form
> >http://server.example.com/path?login=bryan&password=passwd
> >  
> >
> The question in this case would be should I do a POST or GET?  I think 
> both syntax should be available so maybe the scheme you suggest would be 
> GET and I would rename my extra config parameter to http_post_data or 
> something like that.

I would make it a GET. I don't think that you want to change the state
on the server with requests from yum (which is part of the meaning of a
POST). Is there a reason why you think a POST is needed ?

> >The sticky part is to make sure that yum properly appends a relative
> >portion to the base url (e.g., in Repository.get), i.e. that the
> >relative part gets put into the base URL before the params.
>
> urlparse.urlsplit can do that for us.  Then just feed everything but the 
> query and fragment in as the base url.
> 
> If we implement this method as a GET then the tricky part will be 
> appending the query and fragment pieces onto the end of each request url.

That should be simple enough: once you have the url in its various parts
(base, query, fragment), you just need to replace sth like "url = base +
'/' + relative" with sth like
        t = urlparse(base)
        url = urlunparse((t[0], t[1], t[2] + "/" + relative, t[3], t[4], t[5]))

The reason I said this is the tricky part is because you need to make
sure you catch all places where URL's are created by adding a relative
part to a base URL.

David

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.baseurl.org/pipermail/yum-devel/attachments/20051109/6dbd2b7e/attachment.pgp 


More information about the Yum-devel mailing list