-#if defined(USE_IMAGE_LIST)
- return block_imageurl_using_imagelist(http, csp);
-#else
- /* Don't know - assume HTML */
- return 0;
-#endif
-}
-#endif /* defined(DETECT_MSIE_IMAGES) || defined(USE_IMAGE_LIST) */
-
-
-#ifdef USE_IMAGE_LIST
-/*********************************************************************
- *
- * Function : block_imageurl
- *
- * Description : Test if a URL is in the imagelist.
- *
- * Parameters :
- * 1 : http = URL to check.
- * 2 : csp = Current client state (buffers, headers, etc...)
- *
- * Returns : True (nonzero) if URL is in image list, false (0)
- * otherwise
- *
- *********************************************************************/
-int block_imageurl_using_imagelist(struct http_request *http, struct client_state *csp)
-{
- struct file_list *fl;
- struct block_spec *b;
- struct url_spec url[1];
-
- if (((fl = csp->ilist) == NULL) || ((b = fl->f) == NULL))
- {
- return(0);
- }
-
- *url = dsplit(http->host);
-
- /* if splitting the domain fails, punt */
- if (url->dbuf == NULL) return(0);
-
- for (b = b->next; b ; b = b->next)
- {
-
- if ((b->url->port == 0) || (b->url->port == http->port))
- {
- /* port matches, check domain */
- if ((b->url->domain[0] == '\0') || (domaincmp(b->url, url) == 0))
- {
- /* domain matches, check path */
- if ((b->url->path == NULL) ||
-#ifdef REGEX
- (regexec(b->url->preg, http->path, 0, NULL, 0) == 0)
-#else
- (strncmp(b->url->path, http->path, b->url->pathlen) == 0)
-#endif
- )
- {
- /* Matches */
- freez(url->dbuf);
- freez(url->dvec);
-
- if (b->reject == 0) return(0);
-
- return(1);
- }
- }
- }
- }
- freez(url->dbuf);
- freez(url->dvec);
- return(0);
-
-}
-#endif /* def USE_IMAGE_LIST */
-
-
-#ifdef PCRS
-/*********************************************************************
- *
- * Function : re_process_buffer
- *
- * Description : Apply all jobs from the joblist (aka. Perl regexp's) to
- * the text buffer that's been accumulated in csp->iob->buf.
- * Then, write the modified buffer out to the client
- * (Maybe this should happen from jcc.c via flush_socket
- * for better readability).
- *
- * Parameters :
- * 1 : csp = Current client state (buffers, headers, etc...)
- *
- * Returns : N/A
- *
- *********************************************************************/
-void re_process_buffer(struct client_state *csp)
-{
- int hits=0;
- int size = csp->iob->eod - csp->iob->cur;
- char *old=csp->iob->cur, *new = NULL;
- pcrs_job *job, *joblist;
-
- struct file_list *fl;
- struct re_filterfile_spec *b;
-
- /* Sanity first ;-) */
- if (size <= 0)
- {
- return;
- }
-
- if ( ( NULL == (fl = csp->rlist) ) || ( NULL == (b = fl->f) ) )
- {
- log_error(LOG_LEVEL_ERROR, "Unable to get current state of regexp filtering.");
- return;
- }
-
- joblist = b->joblist;
-
-
- log_error(LOG_LEVEL_RE_FILTER, "re_filtering %s%s (size %d) ...",
- csp->http->hostport, csp->http->path, size);
-
- /* Apply all jobs from the joblist */
- for (job = joblist; NULL != job; job = job->next)
- {
- hits += pcrs_exec_substitution(job, old, size, &new, &size);
- if (old != csp->iob->cur) free(old);
- old=new;
- }
-
- log_error(LOG_LEVEL_RE_FILTER, " produced %d hits (new size %d).", hits, size);
-
- if (write_socket(csp->cfd, old, size) != size)
- {
- log_error(LOG_LEVEL_ERROR, "write to client failed.");
- }
-
- /* fwiw, reset the iob */
- IOB_RESET(csp);
- freez(new);
- return;
-