--- check_http.c 2007-03-06 14:45:57.000000000 -0800 +++ - 2007-05-04 11:00:35.226089000 -0700 @@ -110,7 +110,7 @@ int http_opt_headers_count = 0; int onredirect = STATE_OK; int use_ssl = FALSE; -int verbose = FALSE; +int verbose = TRUE; int sd; int min_page_len = 0; int max_page_len = 0; @@ -751,6 +751,17 @@ char *header; char *page; char *auth; +/* Patched by T.P -- binary data */ + char bindata[MAX_INPUT_BUFFER]; + int bindatalen = 0; + int bindatafound = 0; + int bufpos=0; + int mybuflen=0; + char *pointer = http_post_data; + unsigned long ascii = 0; + char code[3] = {0}; + char *end = NULL; +/* End patch */ int http_status; int i = 0; size_t pagesize = 0; @@ -800,14 +811,42 @@ /* either send http POST data */ if (http_post_data) { +/* Patched by T.P -- binary data */ + while (*pointer) { + if (*pointer == '%') { + /* Interpret the next two hex chars -- no error checking */ + memcpy(code,++pointer,2); + ascii = strtoul(code,&end,16); + bindata[bindatalen] = (char)ascii; + pointer += 2; + } else if (*pointer == '\\') { + /* Skip the escape char -- no error checking */ + pointer++; + bindata[bindatalen++] = *pointer++; + } else { + /* Just copy the char */ + bindata[bindatalen] = *pointer++; + } + bindatalen++; + } + /* Truncate the original string at the shorter length for future use */ + http_post_data[bindatalen] = (char)0; +/* End patch */ if (http_content_type) { asprintf (&buf, "%sContent-Type: %s\r\n", buf, http_content_type); } else { asprintf (&buf, "%sContent-Type: application/x-www-form-urlencoded\r\n", buf); } +/* Patched by T.P -- binary data */ + /* original line asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, (int)strlen (http_post_data)); + */ + asprintf (&buf, "%sContent-Length: %i\r\n\r\n", buf, bindatalen); + /* Print the original (ascii, truncated) string to fill space */ asprintf (&buf, "%s%s%s", buf, http_post_data, CRLF); + bufpos = strlen(buf) - bindatalen - 2; +/* End patch */ } else { /* or just a newline so the server knows we're done with the request */ @@ -815,13 +854,29 @@ } if (verbose) printf ("%s\n", buf); - my_send (buf, strlen (buf)); +/* Patched by T.P -- binary data */ + if (bindatalen) { + mybuflen = strlen(buf); + /* Overwrite it with the (possibly) binary data */ + for (i=0;i 0) { + /* Original lines buffer[i] = '\0'; asprintf (&full_page, "%s%s", full_page, buffer); + */ + memcpy(pointer+pagesize,buffer,i); +/* End patch */ pagesize += i; if (no_body && document_headers_done (full_page)) {