mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-29 08:11:58 +00:00
Perform HTTP keep-alive
This commit is contained in:
parent
adcdeb36b0
commit
40867266bf
@ -286,7 +286,8 @@ static int on_headers_complete(http_parser *parser)
|
|||||||
assert(t->cred);
|
assert(t->cred);
|
||||||
|
|
||||||
/* Successfully acquired a credential. */
|
/* Successfully acquired a credential. */
|
||||||
return t->parse_error = PARSE_ERROR_REPLAY;
|
t->parse_error = PARSE_ERROR_REPLAY;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -324,7 +325,8 @@ static int on_headers_complete(http_parser *parser)
|
|||||||
t->connected = 0;
|
t->connected = 0;
|
||||||
s->redirect_count++;
|
s->redirect_count++;
|
||||||
|
|
||||||
return t->parse_error = PARSE_ERROR_REPLAY;
|
t->parse_error = PARSE_ERROR_REPLAY;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for a 200 HTTP status code. */
|
/* Check for a 200 HTTP status code. */
|
||||||
@ -382,6 +384,13 @@ static int on_body_fill_buffer(http_parser *parser, const char *str, size_t len)
|
|||||||
parser_context *ctx = (parser_context *) parser->data;
|
parser_context *ctx = (parser_context *) parser->data;
|
||||||
http_subtransport *t = ctx->t;
|
http_subtransport *t = ctx->t;
|
||||||
|
|
||||||
|
/* If our goal is to replay the request (either an auth failure or
|
||||||
|
* a redirect) then don't bother buffering since we're ignoring the
|
||||||
|
* content anyway.
|
||||||
|
*/
|
||||||
|
if (t->parse_error == PARSE_ERROR_REPLAY)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (ctx->buf_size < len) {
|
if (ctx->buf_size < len) {
|
||||||
giterr_set(GITERR_NET, "Can't fit data in the buffer");
|
giterr_set(GITERR_NET, "Can't fit data in the buffer");
|
||||||
return t->parse_error = PARSE_ERROR_GENERIC;
|
return t->parse_error = PARSE_ERROR_GENERIC;
|
||||||
@ -456,7 +465,7 @@ static int http_connect(http_subtransport *t)
|
|||||||
|
|
||||||
if (t->connected &&
|
if (t->connected &&
|
||||||
http_should_keep_alive(&t->parser) &&
|
http_should_keep_alive(&t->parser) &&
|
||||||
http_body_is_final(&t->parser))
|
t->parse_finished)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (t->socket.socket)
|
if (t->socket.socket)
|
||||||
|
Loading…
Reference in New Issue
Block a user