Skip to content

Add JRuby support for username and password parsing from urls #5

Open

Description

@deepfryed

What it says :)

/cc @flyerhzm

Activity

  1. flyerhzm commented on Mar 21, 2013

    @flyerhzm
    Contributor

    I currently have no idea how to parse username and password according to current http-parser.java implementation, I opened an issue to the author to see if he has any idea. a2800276/http-parser.java#5

  2. flyerhzm commented on Mar 22, 2013

    @flyerhzm
    Contributor

    @deepfryed according to a2800276/http-parser.java#5, username and password won't hit server, so I don't think http-parser-lite need to care about username and password.

  3. deepfryed commented on Mar 22, 2013

    @deepfryed
    OwnerAuthor

    Yes and no. http-parser is a simple request/response parser. So it needs to be able to parse the url and password in url to allow the application to create appropriate authorization headers if needed. e.g. in a proxy server

  4. flyerhzm commented on Mar 22, 2013

    @flyerhzm
    Contributor

    I believe http clients / browsers will automatically wrap username and password into http authorization header, here is an example

    curl http://user:passwd@localhost:9000
    
    "GET / HTTP/1.1\r\nAuthorization: Basic dXNlcjpwYXNzd2Q=\r\nUser-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 OpenSSL/0.9.8r zlib/1.2.5\r\nHost: localhost:9000\r\nAccept: */*\r\n\r\n"
    
  5. deepfryed commented on Mar 22, 2013

    @deepfryed
    OwnerAuthor

    yeah, i get it. but not needed when you proxy.

    GET https://foo:bar@example.org/hello

    You could technically use http-parser-lite in implementing a proxy server. There is a reason why the C version has it :)

  6. flyerhzm commented on Mar 22, 2013

    @flyerhzm
    Contributor

    okay, would you mind ignoring username and password for jruby, just leaving a notice on README, saying only c extension support username and password?

  7. deepfryed commented on Mar 22, 2013

    @deepfryed
    OwnerAuthor

    i'd love to have that supported in jruby as well, to keep the gotchas to minimum. is it too much work ?

  8. flyerhzm commented on Mar 24, 2013

    @flyerhzm
    Contributor

    seems not easy to implement, probably take a long time

  9. deepfryed commented on Mar 24, 2013

    @deepfryed
    OwnerAuthor

    hmm, the problem is then you have something working while using MRI and not working in JRuby. This is not an API call that can raise NotImplemented error but will fail at the parser level when parsing urls with username and password. I don't think I like that even if explicitly documented :(

    I'll see if i can hack some java code but I'm pretty busy at the moment and don't know when I can find some time to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions