3 ms·
Hey Rails, nice Rack!
- kirubakaran 18y agoInteresting how the domain is shown here with an extra period at the beginning "Hey Rails, nice Rack! (.brainspl.at)". I am guessing it must be coz it is a bare domain (no www) and pg is working his way backwards from the first single / (or eol) and he expects at least three parts: TLD, domain name and subdomain name and puts "." between each. Update: Did a quick test. Submitted: http://127.0.0.1/this/that http://127.0.0.1/this/that Showed up as: (1.0.0.127) ! Wow that is totally not what I expected.
- raghus 18y agoThat caught my eye too kirubakaran. When I submit http://127.0.0.1:3000 http://127.0.0.1:3000, I got "0.1:3000" I submitted http://localhost:3000 http://localhost:3000 and ended up with ".localhost:3000" Going with http://192.168.1.104:3000 http://192.168.1.104:3000, I ended up with "1.104:3000" When I go with a bare http://127.0.0.1 http://127.0.0.1, I also get the unexpected "1.0.0.127"
- kirubakaran 18y agoI am wondering what code could have this effect. Off topic: I just signed up for FeedFlix. Looks really cool! Great job! (update: submitted it to yc news)
- raghus 18y agoActually, someone suggested I look at the source code rather than submit a ton of URLs and try to reverse-engineer the logic by looking at the results. Here's the relevant code fron news.arc: (defmemo sitename (url) (let toks (parse-site url) (if (isa (saferead (car toks)) 'int) (tostring (prall toks "" ".")) (let (t1 t2 t3 . rest) toks (if (or (mem t1 multi-tld-countries) (and t3 (mem t2 long-domains))) (string t3 "." t2 "." t1) (string t2 "." t1)))))) ; Minor bug: can have both google.at and google.co.at. Same for jp. (= multi-tld-countries* '("uk" "jp" "au" "in" "ph" "tr" "za" "my" "nz" "br" "mx" "th" "sg" "id" "pk" "eg" "il" "at")) (= long-domains* '("blogspot" "wordpress" "livejournal" "blogs" "typepad" "weebly" "blog-city" "com"))
- kirubakaran 18y agoThanks. I was being lazy too :)
- nreece 18y agoIt (also) seems to occur if the TLD is not 3 characters (i.e. 2 chars - .at in this case).
- kirubakaran 18y agoI didn't notice that. Good point.