Skip to content
Snippets Groups Projects
Commit 6404896d authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa Committed by Steve Holme
Browse files

http2: Compile with latest nghttp2

Now nghttp2_submit_request returns assigned stream ID, we don't have
to check stream ID using before_stream_send_callback.  The
adjust_priority_callback was removed.
parent fa083980
No related branches found
No related tags found
No related merge requests found
...@@ -270,15 +270,9 @@ static int before_frame_send(nghttp2_session *session, ...@@ -270,15 +270,9 @@ static int before_frame_send(nghttp2_session *session,
void *userp) void *userp)
{ {
struct connectdata *conn = (struct connectdata *)userp; struct connectdata *conn = (struct connectdata *)userp;
struct http_conn *c = &conn->proto.httpc;
(void)session; (void)session;
(void)frame; (void)frame;
infof(conn->data, "before_frame_send() was called\n"); infof(conn->data, "before_frame_send() was called\n");
if(frame->hd.type == NGHTTP2_HEADERS &&
frame->headers.cat == NGHTTP2_HCAT_REQUEST) {
/* Get stream ID of our request */
c->stream_id = frame->hd.stream_id;
}
return 0; return 0;
} }
static int on_frame_send(nghttp2_session *session, static int on_frame_send(nghttp2_session *session,
...@@ -400,7 +394,6 @@ static const nghttp2_session_callbacks callbacks = { ...@@ -400,7 +394,6 @@ static const nghttp2_session_callbacks callbacks = {
on_header /* nghttp2_on_header_callback */ on_header /* nghttp2_on_header_callback */
#if NGHTTP2_VERSION_NUM >= 0x000400 #if NGHTTP2_VERSION_NUM >= 0x000400
, NULL /* nghttp2_select_padding_callback */ , NULL /* nghttp2_select_padding_callback */
, NULL /* nghttp2_adjust_priority_callback */
#endif #endif
}; };
...@@ -639,6 +632,8 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex, ...@@ -639,6 +632,8 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
char *hdbuf = (char*)mem; char *hdbuf = (char*)mem;
char *end; char *end;
nghttp2_data_provider data_prd; nghttp2_data_provider data_prd;
int32_t stream_id;
(void)sockindex; (void)sockindex;
infof(conn->data, "http2_send len=%zu\n", len); infof(conn->data, "http2_send len=%zu\n", len);
...@@ -744,20 +739,23 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex, ...@@ -744,20 +739,23 @@ static ssize_t http2_send(struct connectdata *conn, int sockindex,
case HTTPREQ_PUT: case HTTPREQ_PUT:
data_prd.read_callback = data_source_read_callback; data_prd.read_callback = data_source_read_callback;
data_prd.source.ptr = NULL; data_prd.source.ptr = NULL;
rv = nghttp2_submit_request(httpc->h2, NULL, nva, nheader, &data_prd, stream_id = nghttp2_submit_request(httpc->h2, NULL, nva, nheader,
NULL); &data_prd, NULL);
break; break;
default: default:
rv = nghttp2_submit_request(httpc->h2, NULL, nva, nheader, NULL, NULL); stream_id = nghttp2_submit_request(httpc->h2, NULL, nva, nheader,
NULL, NULL);
} }
Curl_safefree(nva); Curl_safefree(nva);
if(rv != 0) { if(stream_id < 0) {
*err = CURLE_SEND_ERROR; *err = CURLE_SEND_ERROR;
return -1; return -1;
} }
httpc->stream_id = stream_id;
rv = nghttp2_session_send(httpc->h2); rv = nghttp2_session_send(httpc->h2);
if(rv != 0) { if(rv != 0) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment