SessionHandle: the protocol specific pointer is now a void *

All protocol handler structs are now opaque (void *) in the
SessionHandle struct and moved in the request-specific sub-struct
'SingleRequest'. The intension is to keep the protocol specific
knowledge in their own dedicated source files [protocol].c etc.

There's some "leakage" where this policy is violated, to be addressed at
a later point in time.
This commit is contained in:
Daniel Stenberg 2013-08-05 10:32:08 +02:00
parent 4ad8e142da
commit e79535bc5e
16 changed files with 140 additions and 143 deletions

View file

@ -810,9 +810,10 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
/* HTTP pollution, this should be written nicer to become more
protocol agnostic. */
int fillcount;
struct HTTP *http = data->req.protop;
if((k->exp100 == EXP100_SENDING_REQUEST) &&
(data->state.proto.http->sending == HTTPSEND_BODY)) {
(http->sending == HTTPSEND_BODY)) {
/* If this call is to send body data, we must take some action:
We have sent off the full HTTP 1.1 request, and we shall now
go into the Expect: 100 state and await such a header */
@ -827,7 +828,7 @@ static CURLcode readwrite_upload(struct SessionHandle *data,
}
if(conn->handler->protocol&(CURLPROTO_HTTP|CURLPROTO_RTSP)) {
if(data->state.proto.http->sending == HTTPSEND_REQUEST)
if(http->sending == HTTPSEND_REQUEST)
/* We're sending the HTTP request headers, not the data.
Remember that so we don't change the line endings. */
sending_http_headers = TRUE;
@ -1852,7 +1853,7 @@ CURLcode Curl_retry_request(struct connectdata *conn,
data->req.headerbytecount == 0) &&
conn->bits.reuse &&
!data->set.opt_no_body &&
data->set.rtspreq != RTSPREQ_RECEIVE)) {
data->set.rtspreq != RTSPREQ_RECEIVE)) {
/* We got no data, we attempted to re-use a connection and yet we want a
"body". This might happen if the connection was left alive when we were
done using it before, but that was closed when we wanted to read from
@ -1870,9 +1871,11 @@ CURLcode Curl_retry_request(struct connectdata *conn,
transferred! */
if((conn->handler->protocol&CURLPROTO_HTTP) &&
data->state.proto.http->writebytecount)
return Curl_readrewind(conn);
if(conn->handler->protocol&CURLPROTO_HTTP) {
struct HTTP *http = data->req.protop;
if(http->writebytecount)
return Curl_readrewind(conn);
}
}
return CURLE_OK;
}
@ -1930,6 +1933,7 @@ Curl_setup_transfer(
k->keepon |= KEEP_RECV;
if(conn->writesockfd != CURL_SOCKET_BAD) {
struct HTTP *http = data->req.protop;
/* HTTP 1.1 magic:
Even if we require a 100-return code before uploading data, we might
@ -1940,7 +1944,8 @@ Curl_setup_transfer(
state info where we wait for the 100-return code
*/
if((data->state.expect100header) &&
(data->state.proto.http->sending == HTTPSEND_BODY)) {
(conn->handler->protocol&CURLPROTO_HTTP) &&
(http->sending == HTTPSEND_BODY)) {
/* wait with write until we either got 100-continue or a timeout */
k->exp100 = EXP100_AWAITING_CONTINUE;
k->start100 = Curl_tvnow();