Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/xp_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ int xp_is_invalid();
int xp_get_invalid_line();
const char* xp_get_value(const char *name);
char* xp_get_cdata(void);
int xp_get_content_length(const char *P_buffer);

#ifdef __cplusplus
}
Expand Down
3 changes: 2 additions & 1 deletion src/scenario.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,8 @@ scenario::scenario(char * filename, int deflt)
int removed_clrf = 0;
char * msg = clean_cdata(ptr, &removed_clrf);

L_content_length = xp_get_content_length(msg);
char* cl_str = get_header(msg, "Content-Length:", true);
L_content_length = (cl_str && *cl_str) ? atoi(cl_str) : -1;
switch (L_content_length) {
case -1 :
// the msg does not contain content-length field
Expand Down
40 changes: 0 additions & 40 deletions src/xp_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -596,43 +596,3 @@ char* xp_get_cdata(void)
buffer[end-ptr] = 0;
return buffer;
}

int xp_get_content_length(const char *P_buffer)
{
const char *L_ctl_hdr;
int L_content_length = -1;
unsigned char short_form;

short_form = 0;

L_ctl_hdr = strstr(P_buffer, "\nContent-Length:");
if (!L_ctl_hdr) {
L_ctl_hdr = strstr(P_buffer, "\nContent-length:");
}
if (!L_ctl_hdr) {
L_ctl_hdr = strstr(P_buffer, "\ncontent-Length:");
}
if (!L_ctl_hdr) {
L_ctl_hdr = strstr(P_buffer, "\ncontent-length:");
}
if (!L_ctl_hdr) {
L_ctl_hdr = strstr(P_buffer, "\nCONTENT-LENGTH:");
}
if (!L_ctl_hdr) {
L_ctl_hdr = strstr(P_buffer, "\nl:");
short_form = 1;
}

if (L_ctl_hdr) {
if (short_form) {
L_ctl_hdr += 3;
} else {
L_ctl_hdr += 16;
}
while (isspace(*L_ctl_hdr))
L_ctl_hdr++;
sscanf(L_ctl_hdr, "%d", &L_content_length);
}
/* L_content_length = -1 the message does not contain content-length */
return (L_content_length);
}
Loading