Received: (qmail 21606 invoked by uid 2012); 30 Jun 1999 19:42:52 -0000 Message-Id: <19990630194252.21605.qmail@hyperreal.org> Date: 30 Jun 1999 19:42:52 -0000 From: Niklas Edmundsson Reply-To: nikke@acc.umu.se To: apbugs@hyperreal.org Subject: Optimization: Only correct spelling if no Referer X-Send-Pr-Version: 3.2 >Number: 4677 >Category: mod_speling >Synopsis: Optimization: Only correct spelling if no Referer >Confidential: no >Severity: non-critical >Priority: medium >Responsible: apache >State: open >Class: change-request >Submitter-Id: apache >Arrival-Date: Wed Jun 30 12:50:01 PDT 1999 >Last-Modified: Fri Oct 8 16:50:01 PDT 1999 >Originator: nikke@acc.umu.se >Organization: apache >Release: 1.3.6 >Environment: All (we use Linux 2.2.10, AIX 4.3.2, Solaris 2.* ...). >Description: We are using mod_speling, and are pleased with it's function when users type the URL manually (usually no referer in the request). However, when users are making pages containing for example incorrect URL's to pictures mod_speling corrects this, which is nice but wastes resources on our www-server. These requests usually has a referer (the faulty page). We would like an option to not spell-correct requests with a referer, something like "CheckSpellingWithReferer Off/On". Although we could probably hack mod_speling.c to achieve this it would probably not be the optimal solution (and would probably not meet your coding-standards either). However, if no one has the time to fix this but is able to provide hints on how to implement it and comments on an eventual patch we could probably produce some working code :-) >How-To-Repeat: >Fix: >Audit-Trail: From: Niklas Edmundsson To: apbugs@hyperreal.org, apache-bugdb@apache.org Cc: Magnus Jonsson Subject: Re: mod_speling/4677: Patch: Only correct spelling if no Referer Date: Sat, 9 Oct 1999 01:49:13 +0200 (CEST) This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. Send mail to mime@docserver.cac.washington.edu for more info. ---276672139-1103900354-939426553=:5589 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Attached is a patch for mod_speling.c in apache 1.3.6 and 1.3.9 that introduces a config-option to only check the spelling of an URL when there is no Referer-header, ie only when the user has entered the URL manually. This makes it possible to have mod_speling enabled on a production-server without having users that have pages with misspelled URL's causing the server to fix the spelling very often (which can be very annoying if you have your users' home-directories mounted via nfs). It introduces the option CheckSpellingWithReferer (which defaults to on for no change in the default behaviour) which, when set to off, disables the check when there is no Referer-header. We have used this patch on our production-server running Apache 1.3.6 for a while now, it works for us :-) All credits for this patch should go to Magnus Jonsson . With hopes of getting this included in the main Apache distribution. /Nikke - SysAdmin at the Academic Computer Club, Umeå University, Sweden -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Niklas Edmundsson, Admin @ {acc,hpc2n,ing}.umu.se | nikke@ing.umu.se --------------------------------------------------------------------------- Printers do it without wrinkling the sheets. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= ---276672139-1103900354-939426553=:5589 Content-Type: TEXT/PLAIN; charset=US-ASCII; name="apache-1.3-mod_speling.patch" Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: LS0tIC4uLy4uLy4uLy4uL2Rpc3Qvc3JjL21vZHVsZXMvc3RhbmRhcmQvbW9k X3NwZWxpbmcuYwlNb24gSmFuIDI1IDE5OjEyOjQxIDE5OTkNCisrKyBtb2Rf c3BlbGluZy5jCVNhdCBPY3QgIDkgMDE6NDQ6MTQgMTk5OQ0KQEAgLTg3LDYg Kzg3LDcgQEANCiANCiB0eXBlZGVmIHN0cnVjdCB7DQogICAgIGludCBlbmFi bGVkOw0KKyAgICBpbnQgY2hlY2tzcGVsbGluZ3dpdGhyZWZlcmVyOw0KIH0g c3Bjb25maWc7DQogDQogLyoNCkBAIC0xMDMsNiArMTA0LDcgQEANCiAgICAg c3Bjb25maWcgKmNmZyA9IGFwX3BjYWxsb2MocCwgc2l6ZW9mKHNwY29uZmln KSk7DQogDQogICAgIGNmZy0+ZW5hYmxlZCA9IDA7DQorICAgIGNmZy0+Y2hl Y2tzcGVsbGluZ3dpdGhyZWZlcmVyID0gMT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cmV0 dXJuIE5VTEw7DQorfQ0KKw0KKw0KIHN0YXRpYyBpbnQgY2hlY2tfc3BlbGlu ZyhyZXF1ZXN0X3JlYyAqcikNCiB7DQogICAgIHNwY29uZmlnICpjZmc7DQpA QCAtMjQzLDYgKzI2MiwxMSBAQA0KICAgICAgICAgcmV0dXJuIERFQ0xJTkVE Ow0KICAgICB9DQogDQorICAgIC8qIElmIENoZWNrU3BlbGxpbmdXaXRoUmVm ZXJlciBpcyBvZmYsIGNoZWNrIGZvciAiUmVmZXJlciIgKi8NCisgICAgaWYg KCFjZmctPmNoZWNrc3BlbGxpbmd3aXRocmVmZXJlciAmJiBsb29rdXBfaGVh ZGVyKHIsICJSZWZlcmVyIikpIHsNCisgICAgICAgIHJldHVybiBERUNMSU5F RDsNCisgICAgfQ0KKw0KICAgICAvKiBXZSd2ZSBhbHJlYWR5IGdvdCBhIGZp bGUgb2Ygc29tZSBraW5kIG9yIGFub3RoZXIgKi8NCiAgICAgaWYgKHItPnBy b3h5cmVxIHx8IChyLT5maW5mby5zdF9tb2RlICE9IDApKSB7DQogICAgICAg ICByZXR1cm4gREVDTElORUQ7DQo= ---276672139-1103900354-939426553=:5589-- >Unformatted: [In order for any reply to be added to the PR database, you need] [to include in the Cc line and make sure the] [subject line starts with the report component and number, with ] [or without any 'Re:' prefixes (such as "general/1098:" or ] ["Re: general/1098:"). If the subject doesn't match this ] [pattern, your message will be misfiled and ignored. The ] ["apbugs" address is not added to the Cc line of messages from ] [the database automatically because of the potential for mail ] [loops. If you do not include this Cc, your reply may be ig- ] [nored unless you are responding to an explicit request from a ] [developer. Reply only with text; DO NOT SEND ATTACHMENTS! ]