aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/http.c42
1 files changed, 20 insertions, 22 deletions
diff --git a/lib/http.c b/lib/http.c
index 42947749e..16c03b123 100644
--- a/lib/http.c
+++ b/lib/http.c
@@ -104,7 +104,7 @@
* be sent in one go.
*/
static CURLcode
- add_buffer(send_buffer *in, void *inptr, size_t size);
+ add_buffer(send_buffer *in, const void *inptr, size_t size);
/*
* add_buffer_init() returns a fine buffer struct
@@ -148,7 +148,7 @@ size_t add_buffer_send(int sockfd, struct connectdata *conn, send_buffer *in)
* add_bufferf() builds a buffer from the formatted input
*/
static
-CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
+CURLcode add_bufferf(send_buffer *in, const char *fmt, ...)
{
CURLcode result = CURLE_OUT_OF_MEMORY;
char *s;
@@ -168,32 +168,30 @@ CURLcode add_bufferf(send_buffer *in, char *fmt, ...)
* add_buffer() appends a memory chunk to the existing one
*/
static
-CURLcode add_buffer(send_buffer *in, void *inptr, size_t size)
+CURLcode add_buffer(send_buffer *in, const void *inptr, size_t size)
{
char *new_rb;
int new_size;
- if(size > 0) {
- if(!in->buffer ||
- ((in->size_used + size) > (in->size_max - 1))) {
- new_size = (in->size_used+size)*2;
- if(in->buffer)
- /* we have a buffer, enlarge the existing one */
- new_rb = (char *)realloc(in->buffer, new_size);
- else
- /* create a new buffer */
- new_rb = (char *)malloc(new_size);
+ if(!in->buffer ||
+ ((in->size_used + size) > (in->size_max - 1))) {
+ new_size = (in->size_used+size)*2;
+ if(in->buffer)
+ /* we have a buffer, enlarge the existing one */
+ new_rb = (char *)realloc(in->buffer, new_size);
+ else
+ /* create a new buffer */
+ new_rb = (char *)malloc(new_size);
- if(!new_rb)
- return CURLE_OUT_OF_MEMORY;
+ if(!new_rb)
+ return CURLE_OUT_OF_MEMORY;
- in->buffer = new_rb;
- in->size_max = new_size;
- }
- memcpy(&in->buffer[in->size_used], inptr, size);
-
- in->size_used += size;
+ in->buffer = new_rb;
+ in->size_max = new_size;
}
+ memcpy(&in->buffer[in->size_used], inptr, size);
+
+ in->size_used += size;
return CURLE_OK;
}
@@ -240,7 +238,7 @@ int GetLine(int sockfd, char *buf, struct connectdata *conn)
* This function checks the linked list of custom HTTP headers for a particular
* header (prefix).
*/
-bool static checkheaders(struct UrlData *data, char *thisheader)
+static bool checkheaders(struct UrlData *data, const char *thisheader)
{
struct curl_slist *head;
size_t thislen = strlen(thisheader);