mirror of
https://github.com/curl/curl.git
synced 2026-08-04 14:56:19 +03:00
misc: remove strlen for Curl_checkheaders + Curl_checkProxyheaders
Closes #8409
This commit is contained in:
parent
3738de3bd1
commit
9bc3cebc92
11 changed files with 80 additions and 63 deletions
25
lib/rtsp.c
25
lib/rtsp.c
|
|
@ -340,7 +340,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
}
|
||||
|
||||
/* Transport Header for SETUP requests */
|
||||
p_transport = Curl_checkheaders(data, "Transport");
|
||||
p_transport = Curl_checkheaders(data, STRCONST("Transport"));
|
||||
if(rtspreq == RTSPREQ_SETUP && !p_transport) {
|
||||
/* New Transport: setting? */
|
||||
if(data->set.str[STRING_RTSP_TRANSPORT]) {
|
||||
|
|
@ -364,11 +364,11 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
/* Accept Headers for DESCRIBE requests */
|
||||
if(rtspreq == RTSPREQ_DESCRIBE) {
|
||||
/* Accept Header */
|
||||
p_accept = Curl_checkheaders(data, "Accept")?
|
||||
p_accept = Curl_checkheaders(data, STRCONST("Accept"))?
|
||||
NULL:"Accept: application/sdp\r\n";
|
||||
|
||||
/* Accept-Encoding header */
|
||||
if(!Curl_checkheaders(data, "Accept-Encoding") &&
|
||||
if(!Curl_checkheaders(data, STRCONST("Accept-Encoding")) &&
|
||||
data->set.str[STRING_ENCODING]) {
|
||||
Curl_safefree(data->state.aptr.accept_encoding);
|
||||
data->state.aptr.accept_encoding =
|
||||
|
|
@ -385,11 +385,12 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
it might have been used in the proxy connect, but if we have got a header
|
||||
with the user-agent string specified, we erase the previously made string
|
||||
here. */
|
||||
if(Curl_checkheaders(data, "User-Agent") && data->state.aptr.uagent) {
|
||||
if(Curl_checkheaders(data, STRCONST("User-Agent")) &&
|
||||
data->state.aptr.uagent) {
|
||||
Curl_safefree(data->state.aptr.uagent);
|
||||
data->state.aptr.uagent = NULL;
|
||||
}
|
||||
else if(!Curl_checkheaders(data, "User-Agent") &&
|
||||
else if(!Curl_checkheaders(data, STRCONST("User-Agent")) &&
|
||||
data->set.str[STRING_USERAGENT]) {
|
||||
p_uagent = data->state.aptr.uagent;
|
||||
}
|
||||
|
|
@ -405,7 +406,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
|
||||
/* Referrer */
|
||||
Curl_safefree(data->state.aptr.ref);
|
||||
if(data->state.referer && !Curl_checkheaders(data, "Referer"))
|
||||
if(data->state.referer && !Curl_checkheaders(data, STRCONST("Referer")))
|
||||
data->state.aptr.ref = aprintf("Referer: %s\r\n", data->state.referer);
|
||||
else
|
||||
data->state.aptr.ref = NULL;
|
||||
|
|
@ -422,7 +423,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
(rtspreq & (RTSPREQ_PLAY | RTSPREQ_PAUSE | RTSPREQ_RECORD))) {
|
||||
|
||||
/* Check to see if there is a range set in the custom headers */
|
||||
if(!Curl_checkheaders(data, "Range") && data->state.range) {
|
||||
if(!Curl_checkheaders(data, STRCONST("Range")) && data->state.range) {
|
||||
Curl_safefree(data->state.aptr.rangeline);
|
||||
data->state.aptr.rangeline = aprintf("Range: %s\r\n", data->state.range);
|
||||
p_range = data->state.aptr.rangeline;
|
||||
|
|
@ -432,11 +433,11 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
/*
|
||||
* Sanity check the custom headers
|
||||
*/
|
||||
if(Curl_checkheaders(data, "CSeq")) {
|
||||
if(Curl_checkheaders(data, STRCONST("CSeq"))) {
|
||||
failf(data, "CSeq cannot be set as a custom header.");
|
||||
return CURLE_RTSP_CSEQ_ERROR;
|
||||
}
|
||||
if(Curl_checkheaders(data, "Session")) {
|
||||
if(Curl_checkheaders(data, STRCONST("Session"))) {
|
||||
failf(data, "Session ID cannot be set as a custom header.");
|
||||
return CURLE_BAD_FUNCTION_ARGUMENT;
|
||||
}
|
||||
|
|
@ -523,7 +524,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
if(putsize > 0 || postsize > 0) {
|
||||
/* As stated in the http comments, it is probably not wise to
|
||||
* actually set a custom Content-Length in the headers */
|
||||
if(!Curl_checkheaders(data, "Content-Length")) {
|
||||
if(!Curl_checkheaders(data, STRCONST("Content-Length"))) {
|
||||
result =
|
||||
Curl_dyn_addf(&req_buffer,
|
||||
"Content-Length: %" CURL_FORMAT_CURL_OFF_T"\r\n",
|
||||
|
|
@ -534,7 +535,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
|
||||
if(rtspreq == RTSPREQ_SET_PARAMETER ||
|
||||
rtspreq == RTSPREQ_GET_PARAMETER) {
|
||||
if(!Curl_checkheaders(data, "Content-Type")) {
|
||||
if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
|
||||
result = Curl_dyn_addn(&req_buffer,
|
||||
STRCONST("Content-Type: "
|
||||
"text/parameters\r\n"));
|
||||
|
|
@ -544,7 +545,7 @@ static CURLcode rtsp_do(struct Curl_easy *data, bool *done)
|
|||
}
|
||||
|
||||
if(rtspreq == RTSPREQ_ANNOUNCE) {
|
||||
if(!Curl_checkheaders(data, "Content-Type")) {
|
||||
if(!Curl_checkheaders(data, STRCONST("Content-Type"))) {
|
||||
result = Curl_dyn_addn(&req_buffer,
|
||||
STRCONST("Content-Type: "
|
||||
"application/sdp\r\n"));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue