http2 client failed to parse HTTP Upgrade response header - http2

I'm tryng to use nghttpd server to test HTTP/2.0. To start it i'm using:
nghttpd -v -d ~/Desktop/www 9000 --no-tls
In client terminal, i type:
nghttp -nvu http://127.0.0.1:9000
And i have this output in the client terminal
[ 0.000] Connected
[ 0.000] HTTP Upgrade request
GET / HTTP/1.1
host: 127.0.0.1:9000
connection: Upgrade, HTTP2-Settings
upgrade: h2c
http2-settings: AAMAAABkAAQAAP__
accept: */*
user-agent: nghttp2/1.35.1
[ERROR] Failed to parse HTTP Upgrade response header:
(HPE_INVALID_CONSTANT) invalid constant string
Some requests were not processed. total=1, processed=0
in the server terminal
IPv6: listen :::9000
IPv4: listen 0.0.0.0:9000
[id=1] [ 5.803] send SETTINGS frame <length=6, flags=0x00, stream_id=0>
(niv=1)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[id=1] [ 5.803] closed
How can i solve this?

nghttpd does not support upgrade. See this from the author. The client nghttp has no issues.
You can use nghttpx, the reverse proxy and your http2 server behind that.
$ nghttp -nvu http://nghttp2.org/
[ 1.104] Connected
[ 1.104] HTTP Upgrade request
GET / HTTP/1.1
host: nghttp2.org
connection: Upgrade, HTTP2-Settings
upgrade: h2c
http2-settings: AAMAAABkAAQAAP__
accept: */*
user-agent: nghttp2/1.30.0
[ 1.327] HTTP Upgrade response
HTTP/1.1 101 Switching Protocols
Connection: Upgrade
Upgrade: h2c
[ 1.327] HTTP Upgrade success
[ 1.327] recv SETTINGS frame <length=24, flags=0x00, stream_id=0>
(niv=4)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):1048576]
[UNKNOWN(0x08):1]
[SETTINGS_HEADER_TABLE_SIZE(0x01):8192]
[ 1.327] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 1.327] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 1.327] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[ 1.327] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[ 1.327] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[ 1.327] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[ 1.327] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[ 1.327] send PRIORITY frame <length=5, flags=0x00, stream_id=1>
(dep_stream_id=11, weight=16, exclusive=0)
[ 1.332] recv (stream_id=1) :status: 200
[ 1.332] recv (stream_id=1) date: Mon, 17 Dec 2018 01:37:07 GMT
[ 1.332] recv (stream_id=1) content-type: text/html
[ 1.332] recv (stream_id=1) last-modified: Sun, 09 Dec 2018 15:35:09 GMT
[ 1.332] recv (stream_id=1) etag: "5c0d362d-19d8"
[ 1.332] recv (stream_id=1) accept-ranges: bytes
[ 1.332] recv (stream_id=1) content-length: 6616
[ 1.332] recv (stream_id=1) x-backend-header-rtt: 0.008122
[ 1.332] recv (stream_id=1) server: nghttpx
[ 1.332] recv (stream_id=1) via: 2 nghttpx
[ 1.332] recv (stream_id=1) x-frame-options: SAMEORIGIN
[ 1.332] recv (stream_id=1) x-xss-protection: 1; mode=block
[ 1.332] recv (stream_id=1) x-content-type-options: nosniff
[ 1.332] recv HEADERS frame <length=198, flags=0x04, stream_id=1>
; END_HEADERS
(padlen=0)
; First response header
[ 1.366] recv DATA frame <length=6616, flags=0x01, stream_id=1>
; END_STREAM
[ 1.366] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])

According the answer above. i make this
http2 server
nghttpd -v -d /Desktop/www --no-tls -a 127.0.0.1 9000
reverse proxy
nghttpx -b '127.0.0.1,9000;;proto=h2' -f '127.0.0.1,9001;no-tls' -L INFO -o
http2 client
nghttp -v http://127.0.0.1:9001/index.html

Related

How to set Authorization Bearer for Google API on CURLRequest CI4?

I already got access_token and want to access Google API with the following code:
$client = \Config\Services::curlrequest();
$userAPI = "https://www.googleapis.com/oauth2/v2/userinfo";
$response = $client->request("GET", $userAPI, [
"version" => 1.1,
"http_errors" => false,
"header" => [
"Authorization" => "Bearer " . $body->access_token],
"debug" => true
]
);
but I got 400 bad requests. The log on PHP spark didn't say anything about authorization.
GET /oauth2/v2/userinfo HTTP/1.1
Host: www.googleapis.com
Accept: */*
Content-Length: 300
Content-Type: application/x-www-form-urlencoded
* upload completely sent off: 300 out of 300 bytes
* old SSL session ID is stale, removing
* HTTP 1.0, assume close after body
< HTTP/1.0 400 Bad Request
< Content-Type: text/html; charset=UTF-8
< Referrer-Policy: no-referrer
< Content-Length: 1555
< Date: Sat, 06 Feb 2021 05:48:10 GMT
<
* Closing connection 0
Did I miss something?
edit:
Typo on "header", it must be "headers". It successfully sends authorization bearer but the status code still 400 bad request.
New log:
> GET /oauth2/v2/userinfo HTTP/1.1
Host: www.googleapis.com
Accept: */*
Content-Length: 300
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer ya29.a0AfH***********************
* upload completely sent off: 300 out of 300 bytes
* old SSL session ID is stale, removing
* HTTP 1.0, assume close after body
< HTTP/1.0 400 Bad Request
< Content-Type: text/html; charset=UTF-8
< Referrer-Policy: no-referrer
< Content-Length: 1555
< Date: Sat, 06 Feb 2021 06:49:54 GMT
<
* Closing connection 0

What website supports http/2 on port 80 with no SSL?

I would like to run a wireshark on http/2 for port 80 to
1. be able to test out an http/2 client
2. follow a wireshark trace to understand the protocol better
Is there a website that supports http/2 on port 80? When I go to google, it is always changing me to https.
thanks,
Dean
The Jetty project implements a HTTP/2 server that can work with both encrypted HTTP/2 and clear-text HTTP/2.
You can easily setup locally a Jetty h2c server with support for direct HTTP/2 communication as well as support for HTTP/1.1 upgrade to HTTP/2.
I recommend you don't bomb a public server with your experiments :)
This is the server code:
public class H2C
{
public static void main(String[] args) throws Exception
{
Server server = new Server();
HttpConfiguration config = new HttpConfiguration();
HttpConnectionFactory h1 = new HttpConnectionFactory(config);
HTTP2CServerConnectionFactory h2 = new HTTP2CServerConnectionFactory(config);
ServerConnector connector = new ServerConnector(server, h1, h2);
connector.setPort(8080);
server.addConnector(connector);
server.setHandler(new AbstractHandler()
{
#Override
protected void doHandle(String target, Request baseRequest, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException
{
baseRequest.setHandled(true);
// Your code here.
}
});
server.start();
}
}
You can use a HTTP/2 client to test the server, such as nghttp, and watch the traffic via Wireshark.
Testing clear-text HTTP/2 via upgrade (using the -u flag, the -v flag is for verbosity):
$ nghttp -uv http://localhost:8080/
[ 0.000] Connected
[ 0.000] HTTP Upgrade request
GET / HTTP/1.1
host: localhost:8080
connection: Upgrade, HTTP2-Settings
upgrade: h2c
http2-settings: AAMAAABkAAQAAP__
accept: */*
user-agent: nghttp2/1.7.1
[ 0.001] HTTP Upgrade response
HTTP/1.1 101 Switching Protocols
[ 0.001] HTTP Upgrade success
[ 0.001] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[ 0.001] send PRIORITY frame <length=5, flags=0x00, stream_id=1>
(dep_stream_id=11, weight=16, exclusive=0)
[ 0.001] recv SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_HEADER_TABLE_SIZE(0x01):4096]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.001] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.002] recv (stream_id=1) :status: 200
[ 0.002] recv (stream_id=1) server: Jetty(9.4.z-SNAPSHOT)
[ 0.002] recv (stream_id=1) date: Fri, 20 May 2016 09:38:52 GMT
[ 0.002] recv HEADERS frame <length=45, flags=0x05, stream_id=1>
; END_STREAM | END_HEADERS
(padlen=0)
; First response header
[ 0.002] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])
Or testing clear-text HTTP/2 directly:
$ nghttp -v http://localhost:8080/
[ 0.000] Connected
[ 0.000] send SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[ 0.000] send PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[ 0.000] send HEADERS frame <length=38, flags=0x25, stream_id=13>
; END_STREAM | END_HEADERS | PRIORITY
(padlen=0, dep_stream_id=11, weight=16, exclusive=0)
; Open new stream
:method: GET
:path: /
:scheme: http
:authority: localhost:8080
accept: */*
accept-encoding: gzip, deflate
user-agent: nghttp2/1.7.1
[ 0.095] recv SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_HEADER_TABLE_SIZE(0x01):4096]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):65535]
[ 0.095] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.096] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[ 0.105] recv (stream_id=13) :status: 200
[ 0.105] recv (stream_id=13) server: Jetty(9.4.z-SNAPSHOT)
[ 0.105] recv (stream_id=13) date: Fri, 20 May 2016 09:39:30 GMT
[ 0.105] recv HEADERS frame <length=45, flags=0x05, stream_id=13>
; END_STREAM | END_HEADERS
(padlen=0)
; First response header
[ 0.106] send GOAWAY frame <length=8, flags=0x00, stream_id=0>
(last_stream_id=0, error_code=NO_ERROR(0x00), opaque_data(0)=[])

Why 5 PRIORITY frames are sent from HTTP2 client before it sends a HEADERS frame ? Are they necessary for a successful HTTP2 connection?

I noticed that some HTTP2 clients (Firefox and nghttp) send 5 PRIORITY frames for stream 3, 5, 7, 9, 11 after http2 protocol is agreed and before they send a HEADERS frame. I am curious why? I know the meaning of PRIORITY frames, but I don't get the point of sending it, but both Firefox and nghttp do it, so there must be some reasons.
And most importantly, those streams (stream 3, 5, 7, 9, 11) are not used after PRIORITY frames according to the log.
Output information from server for Firefox is shown as follow.
$ nghttpd -d ~/Proxy 8080 key.pem cert.pem -v
Enter PEM pass phrase:
IPv4: listen 0.0.0.0:8080
IPv6: listen :::8080
[ALPN] client offers:
* h2
* spdy/3.1
* http/1.1
SSL/TLS handshake completed
The negotiated protocol: h2
[id=1] [ 18.917] send SETTINGS frame <length=6, flags=0x00, stream_id=0>
(niv=1)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[id=1] [ 18.920] recv SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):131072]
[SETTINGS_MAX_FRAME_SIZE(0x05):16384]
[id=1] [ 18.920] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=12517377)
[id=1] [ 18.920] recv PRIORITY frame <length=5, flags=0x00, stream_id=3>
(dep_stream_id=0, weight=201, exclusive=0)
[id=1] [ 18.920] recv PRIORITY frame <length=5, flags=0x00, stream_id=5>
(dep_stream_id=0, weight=101, exclusive=0)
[id=1] [ 18.920] recv PRIORITY frame <length=5, flags=0x00, stream_id=7>
(dep_stream_id=0, weight=1, exclusive=0)
[id=1] [ 18.920] recv PRIORITY frame <length=5, flags=0x00, stream_id=9>
(dep_stream_id=7, weight=1, exclusive=0)
[id=1] [ 18.920] recv PRIORITY frame <length=5, flags=0x00, stream_id=11>
(dep_stream_id=3, weight=1, exclusive=0)
[id=1] [ 18.920] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[id=1] [ 18.926] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[id=1] [ 25.773] recv (stream_id=13) :method: GET
[id=1] [ 25.773] recv (stream_id=13) :path: /plaintext.txt
[id=1] [ 25.773] recv (stream_id=13) :authority: 127.0.0.1:8080
[id=1] [ 25.773] recv (stream_id=13) :scheme: https
[id=1] [ 25.773] recv (stream_id=13) user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:45.0) Gecko/20100101 Firefox/45.0
[id=1] [ 25.773] recv (stream_id=13) accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
[id=1] [ 25.773] recv (stream_id=13) accept-language: en-US,en;q=0.5
[id=1] [ 25.773] recv (stream_id=13) accept-encoding: gzip, deflate, br
[id=1] [ 25.773] recv (stream_id=13) if-modified-since: Wed, 27 Apr 2016 13:10:07 GMT
[id=1] [ 25.773] recv HEADERS frame <length=196, flags=0x25, stream_id=13>
; END_STREAM | END_HEADERS | PRIORITY
(padlen=0, dep_stream_id=11, weight=32, exclusive=0)
; Open new stream
[id=1] [ 25.774] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=13>
(window_size_increment=12451840)
[id=1] [ 25.774] send HEADERS frame <length=42, flags=0x05, stream_id=13>
; END_STREAM | END_HEADERS
(padlen=0)
; First response header
:status: 304
server: nghttpd nghttp2/1.8.0
date: Fri, 29 Apr 2016 08:07:25 GMT
[id=1] [ 25.774] stream_id=13 closed
But Chrome does not send them, as shown below. So they are not necessary for a successful connection?
$ nghttpd -d ~/Proxy 8080 key.pem cert.pem -v
Enter PEM pass phrase:
IPv4: listen 0.0.0.0:8080
IPv6: listen :::8080
[ALPN] client offers:
* h2
* spdy/3.1
* http/1.1
SSL/TLS handshake completed
The negotiated protocol: h2
[id=1] [ 16.069] send SETTINGS frame <length=6, flags=0x00, stream_id=0>
(niv=1)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[id=1] [ 16.083] closed
[ALPN] client offers:
* h2
* spdy/3.1
* http/1.1
SSL/TLS handshake completed
The negotiated protocol: h2
[id=2] [ 16.298] send SETTINGS frame <length=6, flags=0x00, stream_id=0>
(niv=1)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[id=2] [ 16.299] closed
[ALPN] client offers:
* h2
* spdy/3.1
* http/1.1
SSL/TLS handshake completed
The negotiated protocol: h2
[id=3] [ 16.303] send SETTINGS frame <length=6, flags=0x00, stream_id=0>
(niv=1)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):100]
[id=3] [ 16.303] recv SETTINGS frame <length=12, flags=0x00, stream_id=0>
(niv=2)
[SETTINGS_MAX_CONCURRENT_STREAMS(0x03):1000]
[SETTINGS_INITIAL_WINDOW_SIZE(0x04):6291456]
[id=3] [ 16.303] recv WINDOW_UPDATE frame <length=4, flags=0x00, stream_id=0>
(window_size_increment=15663105)
[id=3] [ 16.303] send SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[id=3] [ 16.303] recv SETTINGS frame <length=0, flags=0x01, stream_id=0>
; ACK
(niv=0)
[id=3] [ 16.311] recv (stream_id=1) :method: GET
[id=3] [ 16.311] recv (stream_id=1) :authority: 127.0.0.1:8080
[id=3] [ 16.311] recv (stream_id=1) :scheme: https
[id=3] [ 16.311] recv (stream_id=1) :path: /plaintext.txt
[id=3] [ 16.311] recv (stream_id=1) accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
[id=3] [ 16.311] recv (stream_id=1) upgrade-insecure-requests: 1
[id=3] [ 16.311] recv (stream_id=1) user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.86 Safari/537.36
[id=3] [ 16.311] recv (stream_id=1) accept-encoding: gzip, deflate, sdch
[id=3] [ 16.311] recv (stream_id=1) accept-language: en-US,en;q=0.8
[id=3] [ 16.311] recv HEADERS frame <length=238, flags=0x25, stream_id=1
....
They are not required for a successful connection.
For the rest, I'm just guessing here. Firefox is using those streams as "virtual streams". Then it makes further real streams dependent on those virtual streams. The effect should be the creation of different priority groups, without needing to specify priorities per (real) streams.

HTTP Post using Apache http client with expect-continue option to an authorized http proxy, and get 400 response

I am using apache http client v4.5 to do a HTTP POST to an authorized required http proxy server.
Because of some other dependencies, I tend to use enabled Expect-Continue handshake in the http client config.
Related code snips:
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(
new AuthScope(host, port, AuthScope.ANY_REALM),
new UsernamePasswordCredentials(username, password));
credsProvider.setCredentials(
new AuthScope(proxyHost, proxyPort,AuthScope.ANY_REALM),
new UsernamePasswordCredentials(proxyUsername, proxyPassword));
CloseableHttpClient httpclient = HttpClients.custom()
.setDefaultCredentialsProvider(credsProvider).build();
try {
HttpHost target = new HttpHost(host, port, "http");
HttpHost proxy = new HttpHost(proxyHost, proxyPort);
RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
.setExpectContinueEnabled(true)
.build();
HttpPost httppost = new HttpPost("/URI");
httppost.setConfig(config);
StringEntity reqEntity = new StringEntity(entityString,"UTF-8");
reqEntity.setContentType("application/json");
httppost.setEntity(reqEntity);
CloseableHttpResponse response = httpclient.execute(target, httppost);
try {
System.out.println(response.getStatusLine());
EntityUtils.consume(response.getEntity());
} finally {
response.close();
}
} finally {
httpclient.close();
}
As the target proxy server is required authorization, the first response from the proxy server is 407, then the proxy authorization is sent by http client as recorded in its log, but the header "Proxy-Authorization" is not included from the actual http request according to wireshark capture. As a result, 400 bad request is returned ...
Here is the apache log
http-outgoing-0 >> POST http://targetHost:targetPort/uri/ HTTP/1.1
http-outgoing-0 >> Content-Length: 217
http-outgoing-0 >> Content-Type: application/json
http-outgoing-0 >> Host: targetHost:targetPort
http-outgoing-0 >> Proxy-Connection: Keep-Alive
http-outgoing-0 >> User-Agent: Apache-HttpClient/4.5 (Java/1.7.0)
http-outgoing-0 >> Expect: 100-continue
http-outgoing-0 >> Accept-Encoding: gzip,deflate
http-outgoing-0 >> Proxy-Authorization: Basic xxxxxxx
http-outgoing-0 << HTTP/1.1 400 Bad Request
http-outgoing-0 << Server: squid/3.3.8
http-outgoing-0 << Mime-Version: 1.0
http-outgoing-0 << Date: Mon, 31 Aug 2015 02:03:28 GMT
http-outgoing-0 << Content-Type: text/html
http-outgoing-0 << Content-Length: 3166
http-outgoing-0 << X-Squid-Error: ERR_INVALID_URL 0
http-outgoing-0 << Vary: Accept-Language
http-outgoing-0 << Content-Language: en
http-outgoing-0 << X-Cache: MISS from proxyHost
http-outgoing-0 << X-Cache-Lookup: NONE from proxyHost:proxyPort
http-outgoing-0 << Via: 1.1 proxyHost (squid/3.3.8)
http-outgoing-0 << Connection: close
Here is the snapshot of wireshark capture in which "Proxy-Authorization" header is disappeared!
POST http://targetHost:targetPort/uri/ HTTP/1.1
Content-Length: 217
Content-Type: application/json
Host: targetHost:targetPort
Proxy-Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5 (Java/1.7.0)
Expect: 100-continue
Accept-Encoding: gzip,deflate
I tried without Expect-continue handshake as blow, and it works fine to get 201 response.
RequestConfig config = RequestConfig.custom()
.setProxy(proxy)
.setExpectContinueEnabled(false)
.build();
Anyone would help to understand why it fails with expect-continue on an authorized http proxy? If I really need to set expect-continue attribute, how to overcome the problem?
Thanks a lot!

websocket disconnect just after opening handshake

I would like to keep the websocket connection alive.
I am using RFC 6455 protocol as websocket protocol.
I tested this via Firefox 13 and Chrome 20.
===WEB SOCKET CLIENT===
GET / HTTP/1.1
Host: #.#.#.#:#
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:13.0) Gecko/20100101 Firefox/13.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: ko-kr,ko;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Connection: keep-alive, Upgrade
Sec-WebSocket-Version: 13
Origin: http://its.secret.com
Sec-WebSocket-Key: TbJqTlFtGocvRvk/9stMhg==
Pragma: no-cache
Cache-Control: no-cache
Upgrade: websocket
===WEB SOCKET SERVER===
HTTP/1.1 101 WebSocket Protocol Handshake
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: outIACgIETcILj0NjzA0MhwP7uc=
the newline in this websocket protocol is CR/LF.
the next is the part of websocket client source.
var host = "ws://#.#.#.#:#";
try {
Rsocket = new WebSocket(host);
Rsocket.onopen = function(msg) {
alert("Welcome - status " + this.readyState);
};
Rsocket.onmessage = function(msg) {...
};
Rsocket.onclose = function(msg) {
alert("Disconnected - status " + this.readyState);
};
}
catch (ex) {
log(ex);
}​
First, the success alert appears in the web browser.
Just after pressing OK, the disconnect alert appears.
Although pressing OK when the success alert appears, I would like the disconnect alert not to appear.

Resources