@ character in http login

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • simonp@nospam.com

    @ character in http login

    I am trying to use the basic http://user:password@example.com
    form for authentication inside a script.

    My only problem is my username contains the @ character (its an
    email address). As result, the url seems to be parsing
    incorrectly.

    Has anyone found a way around this problem?

    Cheers
    Simon

    --
    Stupendous Tales

    Speculative Fiction, Pulp Dreams
  • Michael B. Trausch

    #2
    Re: @ character in http login

    simonp@nospam.c om wrote in <e2eq70$2ht$1@r eader1.panix.co m> on Sat April 22
    2006 22:53:
    [color=blue]
    > I am trying to use the basic http://user:password@example.com
    > form for authentication inside a script.
    >
    > My only problem is my username contains the @ character (its an
    > email address). As result, the url seems to be parsing
    > incorrectly.
    >
    > Has anyone found a way around this problem?
    >
    > Cheers
    > Simon
    >[/color]

    Well, the way it usually works is:

    http://user:pass@server/

    You may be able to try this:

    http://user%40sample.com:pass@server

    And see if it works. 0x40 is the hex character code for '@', and URL
    encoding works by using % and then the hex char reference (i.e., %20 for a
    space, %40 for '@', and so forth).

    If that doesn't work, then I don't know what else you could do to make it
    work, at least, when authenticating using basic auth like that.

    - Mike

    Comment

    • Gordon Burditt

      #3
      Re: @ character in http login

      >I am trying to use the basic http://user:password@example.com[color=blue]
      >form for authentication inside a script.
      >
      >My only problem is my username contains the @ character (its an
      >email address). As result, the url seems to be parsing
      >incorrectly.
      >
      >Has anyone found a way around this problem?[/color]

      You may be able to use something like
      http://username%40hotmail.com:password@example.com

      where @ is converted to %40 . The same approach may apply if the
      password contains odd characters like @, colon, space, %, etc.

      Gordon L. Burditt

      Comment

      • Michael B. Trausch

        #4
        Re: @ character in http login

        Gordon Burditt wrote in <124lsguc12j3o9 5@corp.supernew s.com> on Sat April 22
        2006 23:18:
        [color=blue][color=green]
        >>I am trying to use the basic http://user:password@example.com
        >>form for authentication inside a script.
        >>
        >>My only problem is my username contains the @ character (its an
        >>email address). As result, the url seems to be parsing
        >>incorrectly .
        >>
        >>Has anyone found a way around this problem?[/color]
        >
        > You may be able to use something like
        > http://username%40hotmail.com:password@example.com
        >
        > where @ is converted to %40 . The same approach may apply if the
        > password contains odd characters like @, colon, space, %, etc.
        >
        > Gordon L. Burditt[/color]

        FYI, you may want to read to ensure that the question hasn't been answered
        the same way you're about to answer it. It is bad form; the question was
        answered twelve minutes prior to you posting the same thing.

        Regards,
        Mike

        Comment

        • Gordon Burditt

          #5
          Re: @ character in http login

          >FYI, you may want to read to ensure that the question hasn't been answered[color=blue]
          >the same way you're about to answer it. It is bad form; the question was
          >answered twelve minutes prior to you posting the same thing.[/color]

          I did. Remember that USENET transmission is not instantaneous.
          Also, article composition takes time. It used to be that a feed
          that was getting articles 3 days old from the far side of the net
          (consisting largely of UUCP feeds) was operating unusually better
          than normal.

          Even now, I doubt that even all well-connected servers get a posted
          article within 2 hours of when it is posted on one of them.

          Gordon L. Burditt

          Comment

          • simonp@nospam.com

            #6
            Re: @ character in http login

            Michael B. Trausch <michael.trausc h.no.spam@comca st.net> wrote:[color=blue]
            > simonp@nospam.c om wrote in <e2eq70$2ht$1@r eader1.panix.co m> on Sat April 22
            > 2006 22:53:
            >[color=green]
            >> I am trying to use the basic http://user:password@example.com
            >> form for authentication inside a script.
            >>
            >> My only problem is my username contains the @ character (its an
            >> email address). As result, the url seems to be parsing
            >> incorrectly.
            >>
            >> Has anyone found a way around this problem?
            >>
            >> Cheers
            >> Simon
            >>[/color]
            >
            > Well, the way it usually works is:
            >
            > http://user:pass@server/
            >
            > You may be able to try this:
            >
            > http://user%40sample.com:pass@server
            >[/color]


            Thank you for the pointer, it pointed me to the right solution.

            It looks like &#64; is the escape character that works for @,
            rather than %40. On using the parse_url() function on the url,
            the correct email username was returned for the user element in
            the resulting array.

            Cheers
            Simon

            --
            Stupendous Tales

            Speculative Fiction, Pulp Dreams

            Comment

            • Michael B. Trausch

              #7
              Re: @ character in http login

              simonp@nospam.c om wrote in <e2f4lq$js4$1@r eader1.panix.co m> on Sun April 23
              2006 01:51:
              [color=blue]
              >
              > Thank you for the pointer, it pointed me to the right solution.
              >
              > It looks like &#64; is the escape character that works for @,
              > rather than %40. On using the parse_url() function on the url,
              > the correct email username was returned for the user element in
              > the resulting array.
              >
              > Cheers
              > Simon
              >[/color]

              Very good... I didn't realize that the server would recognize it in that
              fashion. You could probably use urldecode() for getting the %40 out of it,
              did you try it that way?

              If you do, I'd be curious to see the result. I don't have the ambition to
              code that up for a test right now, since I've got other things keeping my
              plate rather full at the moment... <G>

              - Mike

              Comment

              • John Dunlop

                #8
                Re: @ character in http login

                Gordon Burditt:
                [color=blue]
                > I did. Remember that USENET transmission is not instantaneous.
                > Also, article composition takes time. It used to be that a feed
                > that was getting articles 3 days old from the far side of the net
                > (consisting largely of UUCP feeds) was operating unusually better
                > than normal.
                >
                > Even now, I doubt that even all well-connected servers get a posted
                > article within 2 hours of when it is posted on one of them.[/color]

                And some articles simply don't arrive on some servers.

                Besides, it seems the original poster somehow misconstrued Michael's
                followup and has now confused the HTML notation &#64; with the
                percent-encoding %40.

                It is now necessary to point out that &#64; is a way of representing
                <@> *in* *HTML*, not in URLs (it means something very different in
                URLs), and that as far as the URL is concerned, <@> is still
                "unescaped" . %40 (for the third time :-) is the percent-encoding of
                <@>.

                --
                Jock

                Comment

                • Jerry Stuckle

                  #9
                  Re: @ character in http login

                  Michael B. Trausch wrote:[color=blue]
                  > Gordon Burditt wrote in <124lsguc12j3o9 5@corp.supernew s.com> on Sat April 22
                  > 2006 23:18:
                  >
                  >[color=green][color=darkred]
                  >>>I am trying to use the basic http://user:password@example.com
                  >>>form for authentication inside a script.
                  >>>
                  >>>My only problem is my username contains the @ character (its an
                  >>>email address). As result, the url seems to be parsing
                  >>>incorrectl y.
                  >>>
                  >>>Has anyone found a way around this problem?[/color]
                  >>
                  >>You may be able to use something like
                  >>http://username%40hotmail.com:password@example.com
                  >>
                  >>where @ is converted to %40 . The same approach may apply if the
                  >>password contains odd characters like @, colon, space, %, etc.
                  >>
                  >>Gordon L. Burditt[/color]
                  >
                  >
                  > FYI, you may want to read to ensure that the question hasn't been answered
                  > the same way you're about to answer it. It is bad form; the question was
                  > answered twelve minutes prior to you posting the same thing.
                  >
                  > Regards,
                  > Mike
                  >[/color]

                  And it's even worse form to criticize someone for repeating the content of YOUR
                  OWN post 12 minutes after you posted it.

                  This is not a "I got the right answer first" contest. This is about helping
                  each other.


                  --
                  =============== ===
                  Remove the "x" from my email address
                  Jerry Stuckle
                  JDS Computer Training Corp.
                  jstucklex@attgl obal.net
                  =============== ===

                  Comment

                  • Michael B. Trausch

                    #10
                    Re: @ character in http login

                    Gordon Burditt wrote in <124lvnhrq2vp25 2@corp.supernew s.com> on Sun April 23
                    2006 00:13:
                    [color=blue][color=green]
                    >>FYI, you may want to read to ensure that the question hasn't been answered
                    >>the same way you're about to answer it. It is bad form; the question was
                    >>answered twelve minutes prior to you posting the same thing.[/color]
                    >
                    > I did. Remember that USENET transmission is not instantaneous.
                    > Also, article composition takes time. It used to be that a feed
                    > that was getting articles 3 days old from the far side of the net
                    > (consisting largely of UUCP feeds) was operating unusually better
                    > than normal.
                    >
                    > Even now, I doubt that even all well-connected servers get a posted
                    > article within 2 hours of when it is posted on one of them.
                    >[/color]

                    My apologies. I didn't realize that there would've been that large of an
                    amount of lag between the servers.

                    - Mike

                    Comment

                    • simonp@nospam.com

                      #11
                      Re: @ character in http login

                      Michael B. Trausch <michael.trausc h.no.spam@comca st.net> wrote:
                      [color=blue]
                      >
                      > Very good... I didn't realize that the server would recognize it in that
                      > fashion. You could probably use urldecode() for getting the %40 out of it,
                      > did you try it that way?
                      >
                      > If you do, I'd be curious to see the result. I don't have the ambition to
                      > code that up for a test right now, since I've got other things keeping my
                      > plate rather full at the moment... <G>
                      >
                      > - Mike[/color]

                      Another solution I've discovered, that is probably more flexible
                      inside a script, is to use the Snoopy php class:

                      Download Snoopy for free. Snoopy is a PHP class that simulates a web browser. It automates the task of retrieving web page content and posting forms, for example.


                      Snoopy acts like a web browser inside the script, so username and
                      password can be set as properties of the class, and sent to the
                      server requiring basic authentication.

                      The results are then returned as an array.

                      Cheers
                      Simon

                      --
                      Stupendous Tales

                      Speculative Fiction, Pulp Dreams

                      Comment

                      • Michael B. Trausch

                        #12
                        Re: @ character in http login

                        Jerry Stuckle wrote in <KtOdnWsKY78PDt bZnZ2dnUVZ_vadn Z2d@comcast.com > on Sun
                        April 23 2006 11:50:[color=blue]
                        >
                        > And it's even worse form to criticize someone for repeating the content of
                        > YOUR OWN post 12 minutes after you posted it.
                        >
                        > This is not a "I got the right answer first" contest. This is about
                        > helping each other.
                        >[/color]

                        I agree with you on that. Now, I didn't realize that the lag was 12 whole
                        minutes -- that's atypical for many networks these days, even Usenet.
                        Often, I can post something to Usenet and find it on Google Groups within
                        five minutes of my having posted it. Thus, it didn't seem unreasonable to
                        me to prompt Gordon to check prior to posting. It would seem that he is
                        not to blame for not checking; rather, his NNTP spooling service is a bit
                        behind on getting the feeds from Usenet.

                        Looking at their web site, it could also be a slowdown caused by their
                        Usenet spam filtration software or something similar; either way, that's a
                        great deal of lag. :( It isn't the 1980s anymore. <g>

                        - Mike

                        Comment

                        • Jerry Stuckle

                          #13
                          Re: @ character in http login

                          Michael B. Trausch wrote:[color=blue]
                          > Jerry Stuckle wrote in <KtOdnWsKY78PDt bZnZ2dnUVZ_vadn Z2d@comcast.com > on Sun
                          > April 23 2006 11:50:
                          >[color=green]
                          >>And it's even worse form to criticize someone for repeating the content of
                          >>YOUR OWN post 12 minutes after you posted it.
                          >>
                          >>This is not a "I got the right answer first" contest. This is about
                          >>helping each other.
                          >>[/color]
                          >
                          >
                          > I agree with you on that. Now, I didn't realize that the lag was 12 whole
                          > minutes -- that's atypical for many networks these days, even Usenet.
                          > Often, I can post something to Usenet and find it on Google Groups within
                          > five minutes of my having posted it. Thus, it didn't seem unreasonable to
                          > me to prompt Gordon to check prior to posting. It would seem that he is
                          > not to blame for not checking; rather, his NNTP spooling service is a bit
                          > behind on getting the feeds from Usenet.
                          >
                          > Looking at their web site, it could also be a slowdown caused by their
                          > Usenet spam filtration software or something similar; either way, that's a
                          > great deal of lag. :( It isn't the 1980s anymore. <g>
                          >
                          > - Mike[/color]

                          Not atypical at all, Mike. It all depends on how often usenet servers sync with
                          each other, how many servers are between the posting one and the receiving one,
                          any network delays which can creep in, and even if a router is temporarily down
                          for maintenance.

                          12 minutes is nothing. I, too, have regularly seen delays of 2 hours or more.

                          --
                          =============== ===
                          Remove the "x" from my email address
                          Jerry Stuckle
                          JDS Computer Training Corp.
                          jstucklex@attgl obal.net
                          =============== ===

                          Comment

                          • Joshie Surber

                            #14
                            Re: @ character in http login


                            Jerry Stuckle wrote:[color=blue]
                            > Michael B. Trausch wrote:[color=green]
                            > > Jerry Stuckle wrote in <KtOdnWsKY78PDt bZnZ2dnUVZ_vadn Z2d@comcast.com > on Sun
                            > > April 23 2006 11:50:
                            > >[color=darkred]
                            > >>And it's even worse form to criticize someone for repeating the content of
                            > >>YOUR OWN post 12 minutes after you posted it.
                            > >>
                            > >>This is not a "I got the right answer first" contest. This is about
                            > >>helping each other.
                            > >>[/color]
                            > >
                            > >
                            > > I agree with you on that. Now, I didn't realize that the lag was 12 whole
                            > > minutes -- that's atypical for many networks these days, even Usenet.
                            > > Often, I can post something to Usenet and find it on Google Groups within
                            > > five minutes of my having posted it. Thus, it didn't seem unreasonable to
                            > > me to prompt Gordon to check prior to posting. It would seem that he is
                            > > not to blame for not checking; rather, his NNTP spooling service is a bit
                            > > behind on getting the feeds from Usenet.
                            > >
                            > > Looking at their web site, it could also be a slowdown caused by their
                            > > Usenet spam filtration software or something similar; either way, that's a
                            > > great deal of lag. :( It isn't the 1980s anymore. <g>
                            > >
                            > > - Mike[/color]
                            >
                            > Not atypical at all, Mike. It all depends on how often usenet servers sync with
                            > each other, how many servers are between the posting one and the receiving one,
                            > any network delays which can creep in, and even if a router is temporarily down
                            > for maintenance.
                            >
                            > 12 minutes is nothing. I, too, have regularly seen delays of 2 hours or more.
                            >
                            > --
                            > =============== ===
                            > Remove the "x" from my email address
                            > Jerry Stuckle
                            > JDS Computer Training Corp.
                            > jstucklex@attgl obal.net
                            > =============== ===[/color]

                            Just blame slow typing and everyone get along with your lives.

                            Comment

                            Working...