-const char parsers_rcs[] = "$Id: parsers.c,v 1.247 2012/07/27 17:36:06 fabiankeil Exp $";
+const char parsers_rcs[] = "$Id: parsers.c,v 1.248 2012/09/04 08:32:32 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.c,v $
}
+/*********************************************************************
+ *
+ * Function : get_expected_content_length
+ *
+ * Description : Figures out the content length from a list of headers.
+ *
+ * Parameters :
+ * 1 : headers = List of headers
+ *
+ * Returns : Number of bytes to expect
+ *
+ *********************************************************************/
+unsigned long long get_expected_content_length(struct list *headers)
+{
+ const char *content_length_header;
+ unsigned long long content_length = 0;
+
+ content_length_header = get_header_value(headers, "Content-Length:");
+ if (content_length_header != NULL)
+ {
+ if (JB_ERR_OK != get_content_length(content_length_header, &content_length))
+ {
+ log_error(LOG_LEVEL_ERROR,
+ "Failed to get the Content-Length in %s", content_length_header);
+ /* XXX: The header will be removed later on */
+ return 0;
+ }
+ }
+
+ return content_length;
+}
+
+
/*
Local Variables:
tab-width: 3
#ifndef PARSERS_H_INCLUDED
#define PARSERS_H_INCLUDED
-#define PARSERS_H_VERSION "$Id: parsers.h,v 1.50 2009/05/16 13:27:20 fabiankeil Exp $"
+#define PARSERS_H_VERSION "$Id: parsers.h,v 1.51 2011/09/04 11:10:56 fabiankeil Exp $"
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/parsers.h,v $
extern jb_err update_server_headers(struct client_state *csp);
extern void get_http_time(int time_offset, char *buf, size_t buffer_size);
extern jb_err get_destination_from_headers(const struct list *headers, struct http_request *http);
+extern unsigned long long get_expected_content_length(struct list *headers);
#ifdef FEATURE_FORCE_LOAD
extern int strclean(char *string, const char *substring);