Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
deepfryed opened this issue Mar 21, 2013 · 9 comments
Open

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

deepfryed opened this issue Mar 21, 2013 · 9 comments

Comments

@deepfryed
Copy link
Owner

What it says :)

/cc @flyerhzm

@flyerhzm
Copy link
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

@flyerhzm
Copy link
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.

@deepfryed
Copy link
Owner Author

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

@flyerhzm
Copy link
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"

@deepfryed
Copy link
Owner Author

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

GET https://foo:[email protected]/hello

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

@flyerhzm
Copy link
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?

@deepfryed
Copy link
Owner Author

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

@flyerhzm
Copy link
Contributor

seems not easy to implement, probably take a long time

@deepfryed
Copy link
Owner Author

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants