warcsum/warcsum.c
/* Read the http header and discard it totally */
Read the http header and discard it totally
Read the http header and discard it totally
int
process_httpheader (z_stream *z, void *vp, int header_offset)
{
  struct warcsum_struct *ws = (struct warcsum_struct*) vp;
  int read_bytes = -1;
  int return_value = 0;
  char* str;
  ssize_t read_length;
  size_t ZERO;
  FILE* member_file;
  ZERO = 0;
  member_file = fmemopen (&z->next_out[header_offset],
                          ws->effective_out - z->avail_out - header_offset,
                          "r");
  if (member_file == NULL)
    {
      fprintf (stderr, "Could not process HTTP header\n");
      return_value = -1;
    }
  else
    {
      read_length = getline (&str, &ZERO, member_file);
      if (str[read_length - 1] == '\n')
        {
          str[read_length - 1] = '\0';
        }
      while ((str != NULL && (strcmp_case_insensitive (str, "\r")
                              && strcmp_case_insensitive (str, ""))))
        {
          ZERO = 0;
          free (str);
          read_length = getline (&str, &ZERO, member_file);
          if (read_length && str[read_length - 1] == '\n')
            {
              str[read_length - 1] = '\0';
            }
        }
      free (str);
      read_bytes = ftello(member_file);
      fclose (member_file);
    }
  return return_value == -1 ? -1 : read_bytes;
}
int process_httpheader ( z_stream * z , void * vp , int header_offset ) { struct warcsum_struct * ws = ( struct warcsum_struct * ) vp ; int read_bytes = -1 ; int return_value = 0 ; char * str ; ssize_t read_length ; size_t ZERO ; FILE * member_file ; ZERO = 0 ; member_file = fmemopen ( & z -> next_out [ header_offset ] , ws -> effective_out - z -> avail_out - header_offset , " " ) ; if ( member_file == NULL ) { fprintf ( stderr , " \n " ) ; return_value = -1 ; } else { read_length = getline ( & str , & ZERO , member_file ) ; if ( str [ read_length - 1 ] == ' \n ' ) { str [ read_length - 1 ] = ' \0 ' ; } while ( ( str != NULL && ( strcmp_case_insensitive ( str , " \r " ) && strcmp_case_insensitive ( str , " " ) ) ) ) { ZERO = 0 ; free ( str ) ; read_length = getline ( & str , & ZERO , member_file ) ; if ( read_length && str [ read_length - 1 ] == ' \n ' ) { str [ read_length - 1 ] = ' \0 ' ; } } free ( str ) ; read_bytes = ftello ( member_file ) ; fclose ( member_file ) ; } return return_value == -1 ? -1 : read_bytes ; }
Read the http header and discard it totally
Read the http header and discard it totally
/* read HTTP header till first empty line and discard it */