This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-09-27
Channels
- # beginners (86)
- # calva (1)
- # cider (21)
- # clj-kondo (2)
- # clojure (31)
- # clojure-europe (3)
- # clojure-italy (7)
- # clojure-nl (7)
- # clojure-spec (15)
- # clojure-uk (70)
- # clojurescript (4)
- # clojutre (31)
- # code-reviews (6)
- # cursive (10)
- # datomic (8)
- # duct (3)
- # emacs (2)
- # fulcro (34)
- # funcool (3)
- # jackdaw (2)
- # jobs (10)
- # jvm (2)
- # kaocha (1)
- # off-topic (21)
- # pathom (11)
- # re-frame (10)
- # reagent (4)
- # schema (1)
- # shadow-cljs (72)
- # sql (1)
- # tools-deps (3)
- # vim (9)
- # xtdb (4)
what's a good way to consume everything currently in an input stream and return a string, while leaving the input stream open?
The Java Reader class has a ready method that returns true if the next read of a single character is guaranteed not to block. You could call that in a loop, append'ing characters read to a StringBuilder, and when ready returns false, call toString on the StringBuilder: https://docs.oracle.com/javase/8/docs/api/java/io/Reader.html#ready-- https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html#append-char-
hi wonderful clojure people,,, i was wondering, what version of java do you use locally and in live when you deploy? having a debate internally about all this
for example, do we feel openjdk 11's TLS support doesnt generally inhibit dev
what are you using @ghadi?
It varies by project. 8 or 11 for production purposes. Develop against 13 & trunk for work on Clojure itself
were the ones where it wasnt possible based on internal or external factors to your codebase?
for instance, we had one service where we couldn't go to 11 based on a http clojar we were using not being up to speed with openjdk 11 tls
yawww
external, some things we're not touching as we're considering rewriting...and some things have dependencies that are so old that we thought - best leave alone for now, and rewrite later...perhaps 🙂
found a prev convo on this from august t7th
Possibly impossible question, does anyone know off-hand how to grab the remote address of a get
request in aleph
? I've been reading all morning and can't seem to find a sane way to do this, the idea would be to have it returned in the response map. I'm open to using a different library as well.
@case sounds like the GET
url is something your program would have to know about to make the request. You could just merge it into the response, right?
@denik sorry, my question wasn't formed very well. I want the final ipv4/v6 of the request. I have the URL, yes, but I don't want to sideband another DNS resolution to get the A record, which may not be the final one, since there could be a redirect on the HTTP server there.
@case In Ring, there's :remote-addr
but if you're behind a load balancer, you may need to check headers, such as X-Forwarded-For
. I suspect that depends on the HTTP server adapter in use, so I don't know if that's any help with aleph
...
Thanks @seancorfield, this is also for a client request, not a server accepting a connection.
Ah, so you want to resolve the domain name used in a get
back to an IP address?
Correct, that would be ideal. I know Netty is doing it behind the scenes, just no clear way to propagate the value.
@case And this approach is not suitable?
user=> (map #(.getHostAddress %) (java.net.InetAddress/getAllByName ""))
("204.79.197.200" "13.107.21.200" "2620:1ec:c11:0:0:0:0:200")
user=>
(the JVM caches DNS resolution, I believe, so if you've already reached out to a server via its domain name, the above should be low cost?)