mod_charset_lite.c

Checkout Tools
  • last updated 6 hours ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Move mod_filter and mod_charset_lite from /experimental/ to /filters/

  1. … 17 more files in changeset.
Update copyright year to 2005 and standardize on current copyright owner line.

  1. … 522 more files in changeset.
general property cleanup

  1. … 712 more files in changeset.
Proxy requests are not converted by us. They should be cached and delivered bit-identical

fix name of The Apache Software Foundation

  1. … 361 more files in changeset.
apply Apache License, Version 2.0

  1. … 262 more files in changeset.
Removed the #if #system(bs2000) condition since it is not compiler friendly on all compilers (it breaks under Metrowerks on NetWare) but kept the patch that it contained. Validated the patch that moves opening of the xlation table from the fix-up stage to the output filter and it all seemed to work fine.

update license to 2004.

  1. … 281 more files in changeset.
Flame bait: mod_charset_lite would decide in the mime checker phase

whether a conversion was required, and would stick with that decision,

even if a later handler (like CGI script) would modify the actual

MIME type returned in the response. That was fatal when an EBCDIC

machine was going to return, say, an image/gif (because the initial

MIME type would be text/plain, and only later on be set to image/gif).

But even for "ordinary" ASCII-based machines the conversion fails

if a CGI script decides to return UTF-16 data.

At the moment the following change is #if #system(bs2000), but IMHO

it should be enabled globally: I moved the conversion decision into

the filter itself (because it is the handler which does the final

decision which MIME time is tagged on the response, and we can only

evaluate its decision after it started the output generation).

Allow translation of generated output such as mod_autoindex using charsets

other than EBCDIC.

  1. … 1 more file in changeset.
finished that boring job:

update license to 2003.

Happy New Year! ;-))

  1. … 271 more files in changeset.

Fix (safely) one minor emit [always positive, so apr_size_t cast is ok]

and introduce a win32 project for mod_charset_lite

  1. … 1 more file in changeset.
Add a filter_init function to the filters so that a filter can execute

arbitrary code before the handlers are invoked.

This resolves an issue with incorrect 304s on If-Modified-Since mod_include

requests since ap_meets_conditions() is not aware that this is a dynamic

request and it is not possible to satisfy 304 for these requests (unless

xbithack full is on, of course). When mod_include runs as a filter, it is

too late to set any flag since the handler is responsible for calling

ap_meets_conditions(), which it should do before generating any data.

If a module doesn't need to run such arbitrary code, it can just pass NULL

as the argument and all is well.

PR: 9673

Reviewed by: Ryan Bloom and others

  1. … 17 more files in changeset.
stop using APLOG_NOERRNO in calls to ap_log_[pr]error()

  1. … 33 more files in changeset.
BUCKET FREELISTS

Add an allocator-passing mechanism throughout the bucket brigades API.

From Apache's standpoint, the apr_bucket_alloc_t* used throughout a given

connection is stored in the conn_rec by the create_connection hook. That

means it's the MPM's job to optimize recycling of apr_bucket_alloc_t's --

the MPM must ensure that no two threads can ever use the same one at the

same time, for instance.

  1. … 43 more files in changeset.
Update our copyright for this year.

  1. … 260 more files in changeset.
As hinted on dev@httpd, change filter naming schemes to match our

expectations of their usage.

The reason that we should make this change now is that we have changed

the implied meaning of AP_FTYPE_HTTP_HEADER - some users of this should

be PROTOCOL while others should be CONTENT_SET. In order to clarify it,

toss all of the bogus names and force the filter writers to make sure

they understand what they are doing.

CONTENT_SET is new (horrible name - change if you have better idea), but

it indicates that it should run between RESOURCE and PROTOCOL.

mod_deflate is the ideal CONTENT_SET filter.

The changed type names are:

CONTENT is now RESOURCE.

HTTP_HEADER is now PROTOCOL. However, most filters that used HTTP_HEADER

may want CONTENT_SET. (Only things like POP and HTTP belong as PROTOCOL.)

MMN bump since all filters need to be recompiled due to filter reordering.

  1. … 16 more files in changeset.
We don't need transfer_brigade() because we already have macros to do that

for us, and faster. :)

Warning, though: transfer_brigade() was equivalent to APR_BRIGADE_CONCAT(),

and I don't think that was the right behavior for one of the two callers!

I changed that one to use APR_BRIGADE_PREPEND() since by my inspection that

looks like what it should be, but please check me on this.

some level of gcc seems to be confused about whether or not

b is used before being set; shut it up

Change ap_get_brigade prototype to remove *readbytes in favor of readbytes.

If you need the length, you should be using apr_brigade_length. This is

much more consistent. Of all the places that call ap_get_brigade, only

one (ap_http_filter) needs the length. This makes it now possible to

pass constants down without assigning them to a temporary variable first.

Also:

- Change proxy_ftp to use EXHAUSTIVE mode (didn't catch its -1 before)

- Fix buglet in mod_ssl that would cause it to return too much data in

some circumstances

  1. … 16 more files in changeset.
Input filtering prototype change: Socket blocking type should be

separate from the input filter mode type.

We also no longer look at readbytes to determine the method of

filter operation. This makes the use of filters more obvious and

allows a wider range of options for input filters modes.

To start with, the new input filter modes are:

AP_MODE_READBYTES (no more than *readbytes returned)

AP_MODE_GETLINE (old *readbytes == 0 case)

AP_MODE_EATCRLF (old AP_MODE_PEEK)

AP_MODE_SPECULATIVE (will be used in a future ap_getline rewrite)

AP_MODE_EXHAUSTIVE (old *readbytes == -1 case)

AP_MODE_INIT (special case for NNTP over SSL)

The block parameter is an apr_read_type_e: APR_BLOCK_READ, APR_NONBLOCK_READ

This also allows cleanup of mod_ssl's handling in the getline case.

Reviewed by: Ryan Bloom (concept), Greg Stein (concept)

  1. … 18 more files in changeset.

Fix a handful of AP_MODULE_DECLARE_DATA exports for .so modules.

  1. … 15 more files in changeset.
get rid of an ancient requirement that APACHE_XLATE be defined;

get rid of an ancient work-around for a problem with apr_heap_create

  1. … 1 more file in changeset.
Remove the returned-length "w" parameter from apr_bucket_heap_create()

and apr_bucket_heap_make(). It was useless, since the length is invariant

from the length passed in and from the resulting bucket's b->length. This

takes care of a long-standing issue first brought up in February and

discussed on the dev@apr list. (Issue #2 from the "Bucket API Cleanup

Issues" thread.)

See http://marc.theaimsgroup.com/?l=apr-dev&m=98324983126666&w=2

Reviewed by: Ryan Bloom (concept)

  1. … 6 more files in changeset.
Fix breakage from Brian Pane's util_filter switch to hash tables.

There were some places that were expecting what you put into frec

would be what frec->name would be. Not true anymore.

There are enough other places that were already doing the strcasecmp

that it makes more sense to just make it all strcasecmp across the

board rather than changing the UPPERCASE to lowercase.

(None of these with the exception of old_filter look to be in the

critical path anyway...)

  1. … 4 more files in changeset.
As suggested by Ryan and OtherBill, change the way that

mod_charset_lite checks to see if its filter will be

added by another module. Now, we run our insert-filter

hook really last and look at the actual filter chain.

(Note that http runs even later but it doesn't currently

do anything which would interfere.)

since the core now stores the input and output filter lists in a

different format, mod_charset_lite needs different logic to walk

through it

Remove all warnings from the input filtering stack.

  1. … 11 more files in changeset.
Back out the recent change to ap_get_brigade, to make it use indirection

again. The problem is that the amount of data read from the network,

is not necessarily the amount of data returned from the filters. It is

possible for input filters to add bytes to the data read from the network.

To fix the original bug, I just removed the line from ap_get_client_block

that decremented r->remaining, we allow the http_filter to do that for

us.

I have also removed an incorrect comment.

  1. … 13 more files in changeset.
Fix a bug in the input handling. ap_http_filter() was modifying *readbytes

which corresponded to r->remaining (in ap_get_client_block). However,

ap_get_client_block was *also* adjusting r->remaining. Net result was that

PUT (and probably POST) was broken. (at least on large inputs)

To fix it, I simply removed the indirection on "readbytes" for input

filters. There is no reason for them to return data (the brigade length is

the return length). This also simplifies a number of calls where people

needed to do &zero just to pass zero.

I also added a number of comments about operations and where things could be

improved, or are (semi) broken.

  1. … 11 more files in changeset.