cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: http/2 multiple post requests

From: Scott Mitchell <scott.k.mitch1_at_gmail.com>
Date: Mon, 6 Oct 2014 17:09:19 -0400

On Mon, Oct 6, 2014 at 2:22 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:

> On Mon, 6 Oct 2014, Scott Mitchell wrote:
>
> curl --http2 -k '<url 1>' -H "<headers>" -d '<post body 1>' -i -o dump1_1
>> --trace-ascii dump1_2 --next --http2 -k '<url 2>' -H "<headers>" -d '<post
>> body 2>' -i -o dump2_1 --trace-ascii dump2_2
>>
>> *Note that <url 1> and <url 2> are to the same server (same IP).
>>
>> The behaviour I am seeing is that curl creates 2 connections.
>>
>
> curl will attempt to use the same connection for both (all) requests but
> probably something makes the server or curl to close that connection and
> make a new one for the second one.
>
> Using -v could give you a hint.
>
> You are correct. Curl is sending a RST_STREAM frame indicating a
PROTOCOL_ERROR for each stream (1 and 3) in the first connection. After
the first response (stream 1) then curl is saying that it can re-use
connection 0 and then issues the second stream 3 request. Other than curl
attempting to re-try the request I don't see how this relates to the second
connection being made. I have included the application data portion of the
-v output below but are there any other debug flags that may be useful? It
would be helpful to know where a protocol error is being triggered from or
in general why it is being triggered. The server I am attempting to
communicate with is nghttp2 based and I am able to communicate with it from
a Netty based client. Do you have a curl example command that mimics the
described request scheme (2 post requests, first response is headers only,
second response is headers + data) against a test server?

* Using HTTP2
* SSLv2, Unknown (23):
} [data not shown]
* http2_send len=191
* request content-length=115
* before_frame_send() was called
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
* before_frame_send() was called
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
> POST /proxy/address HTTP/1.1
> User-Agent: curl/7.38.1-DEV
> Host: 10.0.2.2:13443
> accept: application/vnd.akamai.query
> Content-Length: 115
> Content-Type: application/x-www-form-urlencoded
>
* http2_recv: 16384 bytes buffer
* SSLv2, Unknown (23):
{ [data not shown]
* nread=15
* on_frame_recv() was called with header 4
* nghttp2_session_mem_recv() returns 15
* before_frame_send() was called
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
* http2_send len=115
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
} [data not shown]
* http2_recv: 16384 bytes buffer
* SSLv2, Unknown (23):
{ [data not shown]
* nread=9
* on_frame_recv() was called with header 4
* nghttp2_session_mem_recv() returns 9
* http2_recv: 16384 bytes buffer
* SSLv2, Unknown (23):
{ [data not shown]
* nread=67
* on_begin_headers() was called
* nghttp2_session_mem_recv() returns 67
* before_frame_send() was called
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
* on_stream_close() was called, error_code = 1
100 115 0 0 100 115 0 187 --:--:-- --:--:-- --:--:--
187
* Connection #0 to host 10.0.2.2 left intact
* Found bundle for host 10.0.2.2: 0x2073200
* Re-using existing connection! (#0) with host 10.0.2.2
* Connected to 10.0.2.2 (10.0.2.2) port 13443 (#0)
* Using HTTP2
* http2_send len=180
* request content-length=31
* before_frame_send() was called
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
> POST /sql HTTP/1.1
> User-Agent: curl/7.38.1-DEV
> Host: 10.0.2.2:13443
> accept: application/vnd.akamai.query
> Content-Length: 31
> Content-Type: application/x-www-form-urlencoded
>
* http2_send len=31
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
} [data not shown]
* http2_recv: 16384 bytes buffer
* SSLv2, Unknown (23):
{ [data not shown]
* nread=37
* on_begin_headers() was called
* nghttp2_session_mem_recv() returns 37
* before_frame_send() was called
* SSLv2, Unknown (23):
} [data not shown]
* on_frame_send() was called
* on_stream_close() was called, error_code = 1
* Connection died, retrying a fresh connect
100 31 0 0 100 31 0 592 --:--:-- --:--:-- --:--:--
592
* HTTP/2 DISCONNECT starts now
* HTTP/2 DISCONNECT done
* Closing connection 0
* SSLv2, Unknown (21):
} [data not shown]
* SSLv3, TLS alert, Client hello (1):
} [data not shown]
* Issue another request to this URL: 'https://10.0.2.2:13443/sql'
* Hostname was found in DNS cache
* Trying 10.0.2.2...

-- 
>
>  / daniel.haxx.se
> -------------------------------------------------------------------
> List admin: http://cool.haxx.se/list/listinfo/curl-users
> FAQ:        http://curl.haxx.se/docs/faq.html
> Etiquette:  http://curl.haxx.se/mail/etiquette.html
>

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-users
FAQ: http://curl.haxx.se/docs/faq.html
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2014-10-06