Skip to content

Instantly share code, notes, and snippets.

@dcsobral
Created August 14, 2012 22:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcsobral/3353398 to your computer and use it in GitHub Desktop.
Save dcsobral/3353398 to your computer and use it in GitHub Desktop.
Proxy problems
dcs@shadowfax:~/github/example-sbt-project$ cat ~/bin/sbt
#!/bin/sh
if test -f ~/.sbtconfig; then
. ~/.sbtconfig
fi
#java -Xmx512M -noverify -javaagent:/home/dcs/ZeroTurnaround/JRebel/jrebel.jar -jar `dirname $0`/sbt-launch.jar "$@"
java \
-XX:+CMSClassUnloadingEnabled -XX:+UseParallelGC -Xss1m -XX:MaxPermSize=512m -Xmx1536M \
-jar `dirname $0`/sbt-launch.jar "$@"
# -Dhttp.auth.preference=ntlm -Dhttp.auth.ntlm.domain=domain \
# -Dhttp.proxyUser=me -Dhttp.proxyPassword=password \
# -Dhttps.proxyUser=me -Dhttps.proxyPassword=password \
# -Dhttp.proxyHost=proxy.domain -Dhttps.proxyHost=proxy.domain -Dhttp.proxyPort=3128 -Dhttps.proxyPort=3128 \
dcs@shadowfax:~/github/example-sbt-project$ sbt console
[info] Loading global plugins from /home/dcs/.sbt/plugins/project
[info] Loading global plugins from /home/dcs/.sbt/plugins
[info] Set current project to default-d537c8 (in build file:/home/dcs/github/example-sbt-project/)
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scalax.io._
import scalax.io._
scala> Resource.fromURL("http://www.scala-lang.org")
res0: scalax.io.managed.InputStreamResource[java.io.InputStream] = InputStreamResource(http://www.scala-lang.org)
scala> res0.slurpString
res1: java.lang.String =
"<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Scala Programming Language</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="alternate" type="application/rss+xml" title="Front page feed" href="/rss.xml" />
<link rel="shortcut icon" href="/sites/default/files/favicon.gif" type="image/x-icon" />
<link rel="alternate" type="application/rss+xml" title="The Scala Language (Featured News Only)" href="/featured/rss.xml" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modul...
scala> :q
[success] Total time: 37 s, completed Aug 14, 2012 6:58:01 PM
dcs@shadowfax:~/github/example-sbt-project$ vim ~/bin/sbt
dcs@shadowfax:~/github/example-sbt-project$ cat ~/bin/sbt
#!/bin/sh
if test -f ~/.sbtconfig; then
. ~/.sbtconfig
fi
#java -Xmx512M -noverify -javaagent:/home/dcs/ZeroTurnaround/JRebel/jrebel.jar -jar `dirname $0`/sbt-launch.jar "$@"
java \
-Dhttp.auth.preference=ntlm -Dhttp.auth.ntlm.domain=domain \
-Dhttp.proxyUser=me -Dhttp.proxyPassword=password \
-Dhttps.proxyUser=me -Dhttps.proxyPassword=password \
-Dhttp.proxyHost=proxy.domain -Dhttps.proxyHost=proxy.domain -Dhttp.proxyPort=3128 -Dhttps.proxyPort=3128 \
-XX:+CMSClassUnloadingEnabled -XX:+UseParallelGC -Xss1m -XX:MaxPermSize=512m -Xmx1536M \
-jar `dirname $0`/sbt-launch.jar "$@"
# -Dhttp.auth.preference=ntlm -Dhttp.auth.ntlm.domain=domain \
# -Dhttp.proxyUser=me -Dhttp.proxyPassword=password \
# -Dhttps.proxyUser=me -Dhttps.proxyPassword=password \
# -Dhttp.proxyHost=proxy.domain -Dhttps.proxyHost=proxy.domain -Dhttp.proxyPort=3128 -Dhttps.proxyPort=3128 \
dcs@shadowfax:~/github/example-sbt-project$ sbt console
[info] Loading global plugins from /home/dcs/.sbt/plugins/project
[info] Loading global plugins from /home/dcs/.sbt/plugins
[info] Set current project to default-d537c8 (in build file:/home/dcs/github/example-sbt-project/)
[info] Starting scala interpreter...
[info]
Welcome to Scala version 2.9.2 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_26).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scalax.io._
import scalax.io._
scala> Resource.fromURL("http://www.scala-lang.org")
res0: scalax.io.managed.InputStreamResource[java.io.InputStream] = InputStreamResource(http://www.scala-lang.org)
scala> res0.slurpString
java.io.IOException: Server returned HTTP response code: 407 for URL: http://www.scala-lang.org
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at java.net.URL.openStream(URL.java:1010)
at scalax.io.Resource$$anonfun$fromURL$1.apply(Resource.scala:521)
at scalax.io.Resource$$anonfun$fromURL$1.apply(Resource.scala:521)
at scalax.io.managed.InputStreamResource.nResource$2(InputStreamResource.scala:46)
at scalax.io.managed.InputStreamResource$$anonfun$readableByteChannel$1.apply(InputStreamResource.scala:48)
at scalax.io.managed.InputStreamResource$$anonfun$readableByteChannel$1.apply(InputStreamResource.scala:48)
at scalax.io.managed.ReadableByteChannelResource.open(ReadableByteChannelResource.scala:23)
at scalax.io.managed.ReadableByteChannelResource$$anonfun$bytes$1.apply(ReadableByteChannelResource.scala:41)
at scalax.io.managed.ReadableByteChannelResource$$anonfun$bytes$1.apply(ReadableByteChannelResource.scala:41)
at scalax.io.traversable.ByteResourceTraversable.iterator(ByteResourceTraversable.scala:29)
at scalax.io.traversable.ByteResourceTraversable$$anonfun$toArray$1.apply(ByteResourceTraversable.scala:50)
at scalax.io.traversable.ByteResourceTraversable$$anonfun$toArray$1.apply(ByteResourceTraversable.scala:50)
at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110)
at scala.util.control.Exception$Catch$$anonfun$either$1.apply(Exception.scala:110)
at scala.util.control.Exception$Catch.apply(Exception.scala:88)
at scala.util.control.Exception$Catch.either(Exception.scala:110)
at scalax.io.CloseableIterator$.withIterator(CloseableIterator.scala:103)
at scalax.io.traversable.ByteResourceTraversable.toArray(ByteResourceTraversable.scala:50)
at scalax.io.Input$class.byteArray(Input.scala:81)
at scalax.io.managed.InputStreamResource.byteArray(InputStreamResource.scala:14)
at scalax.io.Input$class.slurpString(Input.scala:136)
at scalax.io.managed.InputStreamResource.slurpString(InputStreamResource.scala:14)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment