http2: Use 'CURLcode result' for curl result codes
This commit is contained in:
parent
4d2c539b6c
commit
96d3c9363f
29
lib/http2.c
29
lib/http2.c
@ -162,15 +162,15 @@ static ssize_t send_callback(nghttp2_session *h2,
|
||||
struct connectdata *conn = (struct connectdata *)userp;
|
||||
struct http_conn *httpc = &conn->proto.httpc;
|
||||
ssize_t written;
|
||||
CURLcode rc;
|
||||
CURLcode result = CURLE_OK;
|
||||
|
||||
(void)h2;
|
||||
(void)flags;
|
||||
|
||||
rc = 0;
|
||||
written = ((Curl_send*)httpc->send_underlying)(conn, FIRSTSOCKET,
|
||||
data, length, &rc);
|
||||
data, length, &result);
|
||||
|
||||
if(rc == CURLE_AGAIN) {
|
||||
if(result == CURLE_AGAIN) {
|
||||
return NGHTTP2_ERR_WOULDBLOCK;
|
||||
}
|
||||
|
||||
@ -677,7 +677,7 @@ CURLcode Curl_http2_request_upgrade(Curl_send_buffer *req,
|
||||
static ssize_t http2_recv(struct connectdata *conn, int sockindex,
|
||||
char *mem, size_t len, CURLcode *err)
|
||||
{
|
||||
CURLcode rc;
|
||||
CURLcode result = CURLE_OK;
|
||||
ssize_t rv;
|
||||
ssize_t nread;
|
||||
struct http_conn *httpc = &conn->proto.httpc;
|
||||
@ -728,18 +728,17 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
|
||||
infof(conn->data, "http2_recv: %d bytes buffer\n",
|
||||
conn->proto.httpc.len);
|
||||
|
||||
rc = 0;
|
||||
nread = ((Curl_recv*)httpc->recv_underlying)(conn, FIRSTSOCKET,
|
||||
httpc->inbuf, H2_BUFSIZE, &rc);
|
||||
|
||||
if(rc == CURLE_AGAIN) {
|
||||
*err = rc;
|
||||
httpc->inbuf, H2_BUFSIZE,
|
||||
&result);
|
||||
if(result == CURLE_AGAIN) {
|
||||
*err = result;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(nread == -1) {
|
||||
failf(conn->data, "Failed receiving HTTP2 data");
|
||||
*err = rc;
|
||||
*err = result;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -991,7 +990,7 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
|
||||
CURLcode Curl_http2_switched(struct connectdata *conn,
|
||||
const char *mem, size_t nread)
|
||||
{
|
||||
CURLcode rc;
|
||||
CURLcode result;
|
||||
struct http_conn *httpc = &conn->proto.httpc;
|
||||
int rv;
|
||||
struct SessionHandle *data = conn->data;
|
||||
@ -1005,10 +1004,10 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
|
||||
(conn, FIRSTSOCKET,
|
||||
NGHTTP2_CLIENT_CONNECTION_PREFACE,
|
||||
NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN,
|
||||
&rc);
|
||||
if(rc)
|
||||
&result);
|
||||
if(result)
|
||||
/* TODO: This may get CURLE_AGAIN */
|
||||
return rc;
|
||||
return result;
|
||||
|
||||
if(rv != 24) {
|
||||
failf(data, "Only sent partial HTTP2 packet");
|
||||
|
Loading…
x
Reference in New Issue
Block a user