if(!pq)
return CURLE_OUT_OF_MEMORY;
}
- result = Curl_http_output_auth(conn, method,
+ result = Curl_http_output_auth(conn, method, httpreq,
(pq ? pq : data->state.up.path), FALSE);
free(pq);
if(result)
CURLcode
Curl_http_output_auth(struct connectdata *conn,
const char *request,
+ Curl_HttpReq httpreq,
const char *path,
bool proxytunnel) /* TRUE if this is the request setting
up the proxy tunnel */
else
authhost->done = TRUE;
+ if(((authhost->multipass && !authhost->done) ||
+ (authproxy->multipass && !authproxy->done)) &&
+ (httpreq != HTTPREQ_GET) &&
+ (httpreq != HTTPREQ_HEAD)) {
+ /* Auth is required and we are not authenticated yet. Make a PUT or POST
+ with content-length zero as a "probe". */
+ conn->bits.authneg = TRUE;
+ }
+ else
+ conn->bits.authneg = FALSE;
+
return result;
}
if(data->set.opt_no_body)
request = "HEAD";
else {
- DEBUGASSERT((httpreq > HTTPREQ_NONE) && (httpreq < HTTPREQ_LAST));
+ DEBUGASSERT((httpreq >= HTTPREQ_GET) && (httpreq <= HTTPREQ_HEAD));
switch(httpreq) {
case HTTPREQ_POST:
case HTTPREQ_POST_FORM:
if(!pq)
return CURLE_OUT_OF_MEMORY;
}
- result = Curl_http_output_auth(conn, request,
+ result = Curl_http_output_auth(conn, request, httpreq,
(pq ? pq : data->state.up.path), FALSE);
free(pq);
if(result)
return result;
}
- if(((data->state.authhost.multipass && !data->state.authhost.done)
- || (data->state.authproxy.multipass && !data->state.authproxy.done)) &&
- (httpreq != HTTPREQ_GET) &&
- (httpreq != HTTPREQ_HEAD)) {
- /* Auth is required and we are not authenticated yet. Make a PUT or POST
- with content-length zero as a "probe". */
- conn->bits.authneg = TRUE;
- }
- else
- conn->bits.authneg = FALSE;
-
Curl_safefree(data->state.aptr.ref);
if(data->change.referer && !Curl_checkheaders(conn, "Referer")) {
data->state.aptr.ref = aprintf("Referer: %s\r\n", data->change.referer);
#include "curl_setup.h"
typedef enum {
- HTTPREQ_NONE, /* first in list */
HTTPREQ_GET,
HTTPREQ_POST,
HTTPREQ_POST_FORM, /* we make a difference internally */
HTTPREQ_POST_MIME, /* we make a difference internally */
HTTPREQ_PUT,
- HTTPREQ_HEAD,
- HTTPREQ_LAST /* last in list */
+ HTTPREQ_HEAD
} Curl_HttpReq;
#ifndef CURL_DISABLE_HTTP
*
* @param conn all information about the current connection
* @param request pointer to the request keyword
+ * @param httpreq is the request type
* @param path pointer to the requested path
* @param proxytunnel boolean if this is the request setting up a "proxy
* tunnel"
CURLcode
Curl_http_output_auth(struct connectdata *conn,
const char *request,
+ Curl_HttpReq httpreq,
const char *path,
bool proxytunnel); /* TRUE if this is the request setting
up the proxy tunnel */
return result;
/* Setup the proxy-authorization header, if any */
- result = Curl_http_output_auth(conn, "CONNECT", hostheader, TRUE);
+ result = Curl_http_output_auth(conn, "CONNECT", HTTPREQ_GET,
+ hostheader, TRUE);
if(!result) {
const char *proxyconn = "";
result = CURLE_OUT_OF_MEMORY;
}
/* Setup the proxy-authorization header, if any */
- result = Curl_http_output_auth(conn, "CONNECT", hostheader, TRUE);
+ result = Curl_http_output_auth(conn, "CONNECT", HTTPREQ_GET,
+ hostheader, TRUE);
if(result)
goto error;
Curl_safefree(hostheader);
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
}
/* setup the authentication headers */
- result = Curl_http_output_auth(conn, p_request, p_stream_uri, FALSE);
+ result = Curl_http_output_auth(conn, p_request, HTTPREQ_GET,
+ p_stream_uri, FALSE);
if(result)
return result;