Re: [Patch] Gallery export + HTTP Auth
- From: Larry Ewing <lewing novell com>
- To: Fabian Steffen <fast neteye ch>
- Cc: f-spot-list gnome org
- Subject: Re: [Patch] Gallery export + HTTP Auth
- Date: Thu, 16 Mar 2006 20:43:45 -0600
I've committed a slightly different version of this patch, can you test
it and see if it works for you?
--Larry
On Fri, 2006-03-10 at 14:45 +0100, Fabian Steffen wrote:
> Forgot one line... sorry for the mail-flood.
>
> cheers,
> Fabian
> plain text document attachment (GalleryAuth.diff)
> --- f-spot-0.1.10/src/FormClient.cs.old 2006-03-10 10:24:41.000000000 +0100
> +++ f-spot-0.1.10/src/FormClient.cs 2006-03-10 14:40:53.000000000 +0100
> @@ -2,6 +2,7 @@
> using System.Net;
> using System.IO;
> using System.Text;
> +using System.Text.RegularExpressions;
> using System.Collections;
> using System.Collections.Specialized;
> using System.Web;
> @@ -27,6 +28,14 @@
> private bool multipart = false;
> private bool first_item;
>
> + private string urlRegex =
> + "(http|https|ftp)://" + // matches protocol part
> + "(\\w*){1}:(\\w*){1}@" + // matches a user:pass host construct
> + "[-\\w.]+" + // matches host part
> + "(:\\d+)?" + // matches port (optional)
> + "(~?/([\\w/_.]*(\\?\\S+)?)?)?[^\"]"; // matches path, and anything else (optional)
> + private Regex urlPattern;
> +
> public bool Buffer = false;
> public bool SuppressCookiePath = false;
>
> @@ -39,12 +48,14 @@
> {
> this.Cookies = cookies;
> this.Items = new ArrayList ();
> + this.urlPattern = new Regex(urlRegex);
> }
>
> public FormClient ()
> {
> this.Items = new ArrayList ();
> this.Cookies = new CookieContainer ();
> + this.urlPattern = new Regex(urlRegex);
> }
>
> private void GenerateBoundary ()
> @@ -198,6 +209,17 @@
> {
> this.Progress = progress_item;
> Request = (HttpWebRequest) WebRequest.Create (uri);
> +
> + GroupCollection gc = urlPattern.Match(uri.ToString()).Groups;
> + if (gc.Count > 1) {
> + NetworkCredential cred = new NetworkCredential(gc[2].ToString(), gc[3].ToString());
> + CredentialCache credcache = new CredentialCache();
> + credcache.Add(uri, "Basic", cred);
> +
> + Request.PreAuthenticate = true;
> + Request.Credentials = credcache;
> + }
> +
> CookieCollection cookie_collection = Cookies.GetCookies (uri);
>
> Request.CookieContainer = new CookieContainer ();
> _______________________________________________
> F-spot-list mailing list
> F-spot-list gnome org
> http://mail.gnome.org/mailman/listinfo/f-spot-list
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]