mirror of https://github.com/moparisthebest/curl
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 connectdata *conn = (struct connectdata *)userp;
|
||||||
struct http_conn *httpc = &conn->proto.httpc;
|
struct http_conn *httpc = &conn->proto.httpc;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
CURLcode rc;
|
CURLcode result = CURLE_OK;
|
||||||
|
|
||||||
(void)h2;
|
(void)h2;
|
||||||
(void)flags;
|
(void)flags;
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
written = ((Curl_send*)httpc->send_underlying)(conn, FIRSTSOCKET,
|
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;
|
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,
|
static ssize_t http2_recv(struct connectdata *conn, int sockindex,
|
||||||
char *mem, size_t len, CURLcode *err)
|
char *mem, size_t len, CURLcode *err)
|
||||||
{
|
{
|
||||||
CURLcode rc;
|
CURLcode result = CURLE_OK;
|
||||||
ssize_t rv;
|
ssize_t rv;
|
||||||
ssize_t nread;
|
ssize_t nread;
|
||||||
struct http_conn *httpc = &conn->proto.httpc;
|
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",
|
infof(conn->data, "http2_recv: %d bytes buffer\n",
|
||||||
conn->proto.httpc.len);
|
conn->proto.httpc.len);
|
||||||
|
|
||||||
rc = 0;
|
|
||||||
nread = ((Curl_recv*)httpc->recv_underlying)(conn, FIRSTSOCKET,
|
nread = ((Curl_recv*)httpc->recv_underlying)(conn, FIRSTSOCKET,
|
||||||
httpc->inbuf, H2_BUFSIZE, &rc);
|
httpc->inbuf, H2_BUFSIZE,
|
||||||
|
&result);
|
||||||
if(rc == CURLE_AGAIN) {
|
if(result == CURLE_AGAIN) {
|
||||||
*err = rc;
|
*err = result;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(nread == -1) {
|
if(nread == -1) {
|
||||||
failf(conn->data, "Failed receiving HTTP2 data");
|
failf(conn->data, "Failed receiving HTTP2 data");
|
||||||
*err = rc;
|
*err = result;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -991,7 +990,7 @@ CURLcode Curl_http2_setup(struct connectdata *conn)
|
||||||
CURLcode Curl_http2_switched(struct connectdata *conn,
|
CURLcode Curl_http2_switched(struct connectdata *conn,
|
||||||
const char *mem, size_t nread)
|
const char *mem, size_t nread)
|
||||||
{
|
{
|
||||||
CURLcode rc;
|
CURLcode result;
|
||||||
struct http_conn *httpc = &conn->proto.httpc;
|
struct http_conn *httpc = &conn->proto.httpc;
|
||||||
int rv;
|
int rv;
|
||||||
struct SessionHandle *data = conn->data;
|
struct SessionHandle *data = conn->data;
|
||||||
|
@ -1005,10 +1004,10 @@ CURLcode Curl_http2_switched(struct connectdata *conn,
|
||||||
(conn, FIRSTSOCKET,
|
(conn, FIRSTSOCKET,
|
||||||
NGHTTP2_CLIENT_CONNECTION_PREFACE,
|
NGHTTP2_CLIENT_CONNECTION_PREFACE,
|
||||||
NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN,
|
NGHTTP2_CLIENT_CONNECTION_PREFACE_LEN,
|
||||||
&rc);
|
&result);
|
||||||
if(rc)
|
if(result)
|
||||||
/* TODO: This may get CURLE_AGAIN */
|
/* TODO: This may get CURLE_AGAIN */
|
||||||
return rc;
|
return result;
|
||||||
|
|
||||||
if(rv != 24) {
|
if(rv != 24) {
|
||||||
failf(data, "Only sent partial HTTP2 packet");
|
failf(data, "Only sent partial HTTP2 packet");
|
||||||
|
|
Loading…
Reference in New Issue