Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #34765
| From | Roedy Green <inquiry@mindprod.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: SSL anomalies |
| Date | 2016-07-06 01:14 -0700 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <jvepnb1573n016id8eaobf8767u18lqfg5@4ax.com> (permalink) |
| References | <pi1nnblbhka12mc73meto1mn7jqqigs31u@4ax.com> <nlho7o$a4s$1@gioia.aioe.org> <g5vonb14ju6n37e2p30kfadk21cvraaco7@4ax.com> |
On Tue, 05 Jul 2016 20:36:35 -0700, Roedy Green <inquiry@mindprod.com>
wrote:
>
>could I please see the code you are using?
Here is what I am doing
final HttpURLConnection urlc = ( HttpURLConnection )
url.openConnection();
// if this is https: urlc will be a
sun.net.www.protocol.https.DelegateHttpsURLConnection object
urlc.setAllowUserInteraction( false );
urlc.setDoInput( true );
urlc.setDoOutput( false );// nothing beyond original
request
urlc.setUseCaches( false );
urlc.setRequestMethod( "GET" ); // <-- vhere we decide
GET, HEAD, POST ectc.
setStandardProperties( urlc );
return connectAndProcessResponse( encoding, urlc );
protected void setStandardProperties( URLConnection urlc )
{
urlc.setConnectTimeout( connectTimeout );
urlc.setReadTimeout( readTimeout );
if ( userAgent != null )
{
urlc.setRequestProperty( "User-Agent", userAgent );
// "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101
Firefox/47.00";
}
if ( urlc instanceof HttpURLConnection )
{
// setFollowRedirects sets default for class.
( ( HttpURLConnection ) urlc ).setInstanceFollowRedirects(
followRedirects ); // true
}
if ( referer != null )
{
// note HTTP spells referrer incorrectly.
urlc.setRequestProperty( "Referer", referer );
}
for ( int i = 0; i < requestProperties.length; i += 2 )
{
urlc.setRequestProperty( requestProperties[ i ],
requestProperties[ i + 1 ] );
}
urlc.setRequestProperty( "Accept", acceptProperty );
// "application/octet-stream," +
"application/x-java-jnlp-file," +
"application/x-java-serialized-object," +
"application/xhtml+xml,"
+
"application/xml," +
"application/zip," +
"image/gif," +
"image/jpeg," +
"image/png," +
"text/css," +
"text/html," +
"text/plain," +
"text/x-java-source," +
"text/xml," +
"*;q=.2,*/*;q=.2";
urlc.setRequestProperty( "Accept-Charset", acceptCharset );
// "iso-8859-1,utf-8,utf-16;q=0.7,*;q=0.3";
// no deflate, could be added later if we can find code to
handle it.
urlc.setRequestProperty( "Accept-Encoding", acceptEncoding );
//"gzip,x-gzip,identity";
// relaxed, prefer English
final Locale locale = Locale.getDefault();
// e.g. en-CA,en;q=0.9
urlc.setRequestProperty( "Accept-Language",
locale.toString().replace( '_', '-' ) + "," +
locale.getLanguage() + ";q=0.9" );
}// /method
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
SSL anomalies Roedy Green <inquiry@mindprod.com> - 2016-07-05 03:12 -0700
Re: SSL anomalies Arne Vajhøj <arne@vajhoej.dk> - 2016-07-05 21:51 -0400
Re: SSL anomalies Roedy Green <inquiry@mindprod.com> - 2016-07-05 20:36 -0700
Re: SSL anomalies Roedy Green <inquiry@mindprod.com> - 2016-07-06 01:14 -0700
Re: SSL anomalies Arne Vajhøj <arne@vajhoej.dk> - 2016-07-06 22:42 -0400
Re: SSL anomalies Roedy Green <inquiry@mindprod.com> - 2016-07-12 08:02 -0700
Re: SSL anomalies Arne Vajhøj <arne@vajhoej.dk> - 2016-07-12 22:11 -0400
csiph-web