logo       

current parsers.c,1.118,1.119: msg#00068

web.privoxy.cvs

Subject: current parsers.c,1.118,1.119

Update of /cvsroot/ijbswa/current
In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv1777

Modified Files:
parsers.c
Log Message:
In server_content_type():
- Don't require leading white space when detecting image content types.
- Change '... not replaced ...' message to sound less crazy if the text
type actually is 'text/plain'.
- Mark the 'text/plain == binary data' assumption for removal.
- Remove a bunch of trailing white space.


Index: parsers.c
===================================================================
RCS file: /cvsroot/ijbswa/current/parsers.c,v
retrieving revision 1.118
retrieving revision 1.119
diff -u -d -r1.118 -r1.119
--- parsers.c 28 Dec 2007 16:56:35 -0000 1.118
+++ parsers.c 28 Dec 2007 18:32:51 -0000 1.119
@@ -44,6 +44,14 @@
*
* Revisions :
* $Log$
+ * Revision 1.119 2007/12/28 18:32:51 fabiankeil
+ * In server_content_type():
+ * - Don't require leading white space when detecting image content types.
+ * - Change '... not replaced ...' message to sound less crazy if the text
+ * type actually is 'text/plain'.
+ * - Mark the 'text/plain == binary data' assumption for removal.
+ * - Remove a bunch of trailing white space.
+ *
* Revision 1.118 2007/12/28 16:56:35 fabiankeil
* Minor server_content_disposition() changes:
* - Don't regenerate the header name all lower-case.
@@ -2178,17 +2186,22 @@

if (!(csp->content_type & CT_TABOO))
{
- if ((strstr(*header, " text/") && !strstr(*header, "plain"))
+ /*
+ * XXX: The assumption that text/plain is a sign of
+ * binary data seems to be somewhat unreasonable nowadays
+ * and should be dropped after 3.0.8 is out.
+ */
+ if ((strstr(*header, "text/") && !strstr(*header, "plain"))
|| strstr(*header, "xml")
|| strstr(*header, "application/x-javascript"))
{
csp->content_type |= CT_TEXT;
}
- else if (strstr(*header, " image/gif"))
+ else if (strstr(*header, "image/gif"))
{
csp->content_type |= CT_GIF;
}
- else if (strstr(*header, " image/jpeg"))
+ else if (strstr(*header, "image/jpeg"))
{
csp->content_type |= CT_JPEG;
}
@@ -2196,21 +2209,21 @@

/*
* Are we messing with the content type?
- */
+ */
if (csp->action->flags & ACTION_CONTENT_TYPE_OVERWRITE)
- {
+ {
/*
* Make sure the user doesn't accidently
* change the content type of binary documents.
- */
+ */
if ((csp->content_type & CT_TEXT) || (csp->action->flags &
ACTION_FORCE_TEXT_MODE))
- {
+ {
freez(*header);
*header = strdup("Content-Type: ");
string_append(header,
csp->action->string[ACTION_STRING_CONTENT_TYPE]);

if (header == NULL)
- {
+ {
log_error(LOG_LEVEL_HEADER, "Insufficient memory to replace
Content-Type!");
return JB_ERR_MEMORY;
}
@@ -2218,10 +2231,11 @@
}
else
{
- log_error(LOG_LEVEL_HEADER, "%s not replaced. It doesn't look like
text. "
- "Enable force-text-mode if you know what you're doing.", *header);

+ log_error(LOG_LEVEL_HEADER, "%s not replaced. "
+ "It doesn't look like a content type that should be filtered. "
+ "Enable force-text-mode if you know what you're doing.", *header);
}
- }
+ }

return JB_ERR_OK;
}


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise