+
+ bytes_to_copy = ctask->bytes_in_buffer;
+
+ if (ctask->parse_content == GNUNET_YES)
+ {
+
+ GNUNET_log ( GNUNET_ERROR_TYPE_DEBUG,
+ "MHD: We need to parse the HTML %s\n", ctask->buffer_ptr);
+
+ nomatch = regexec ( &re_dotplus, ctask->buffer_ptr, RE_N_MATCHES, m, 0);
+
+ if (!nomatch)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "MHD RE: Match\n");
+
+ GNUNET_assert (m[1].rm_so != -1);
+
+ hostptr = ctask->buffer_ptr+m[1].rm_so;
+
+ if (m[0].rm_so > 0)
+ {
+ bytes_to_copy = m[0].rm_so;
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Copying %d bytes.\n", m[0].rm_so);
+
+
+ }
+ else
+ {
+ if (ctask->is_postprocessing == GNUNET_YES)
+ {
+
+ /*Done?*/
+ if ( 0 == strcmp (ctask->pp_buf, "") )
+ return 0;
+
+ ctask->is_postprocessing = GNUNET_NO;
+
+ ctask->bytes_in_buffer -= m[0].rm_eo;//(m[1].rm_eo-m[1].rm_so);
+ ctask->buffer_ptr += m[0].rm_eo;//(m[1].rm_eo-m[1].rm_so);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Skipping next %d bytes in buffer\n", m[0].rm_eo);
+
+ if ( strlen (ctask->pp_buf) <= max )
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Copying postprocessed %s.\n", ctask->pp_buf);
+ memcpy ( buf, ctask->pp_buf, strlen (ctask->pp_buf) );
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Done %s.\n", buf);
+ ctask->is_postprocessing = GNUNET_NO;
+ return strlen (ctask->pp_buf);
+ }
+
+ return 0;
+ }
+
+ memset (ctask->pp_buf, 0, sizeof(ctask->pp_buf));
+ memcpy (ctask->pp_buf, hostptr, (m[1].rm_eo-m[1].rm_so));
+
+ ctask->is_postprocessing = GNUNET_YES;
+
+ postprocess_name(ctask, NULL);
+ //ctask->pp_task = GNUNET_SCHEDULER_add_now (&postprocess_name, ctask);
+
+ return 0;
+ }
+ }