How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask Russell H. Your Own Question

Russell H.
Russell H., Internet and LAN
Category: Networking
Satisfied Customers: 9539
Experience:  11 years work with Internet/IP, routers, networks, servers
13568747
Type Your Networking Question Here...
Russell H. is online now
A new question is answered every 9 seconds

Simultaneously enable gzip and $STR_REPLACE in CGI in apache

Customer Question

Simultaneously enable gzip and $STR_REPLACE in CGI in apache
I have a code in my CGI script for text replacement (for example replace 'red' with 'blue')
$STR_SEARCH='red'
$STR_REPLACE='blue'
I am using the below code in .htaccess for enable replace function: (RequestHeader unset Accept-Encoding)
This work fine. But when I want to use gzip for compression, gzip does not work. If I disable the replace, gzip works fine. Please help me understand how I can enable the replace and gzip simultaneously?
(i think first we must relplace and then use gzip,because when gzip zip content, the replace will not work, but i dont know how do it)
Submitted: 11 months ago.
Category: Networking
Expert:  Russell H. replied 11 months ago.

Hi, thank you for contacting JustAnswer.com. My name is***** will do my best to provide the right answer to your question.

I agree that you cannot have content or 'strings' be searched-and-replaced while it is GZip'd.

So before the content or string is searched-and-replaced, you need it not to be in a zipped or GZip'd state.

You might need to use mod_deflate (a de-compresser or un-Zip module) before doing the search and replace, then output it from the script as GZip'd output.

Or is that how you are trying to do it already?

Customer: replied 11 months ago.
I am test different ways but not work.
Here I show to you my codes and script, please check them and test that how it will fix and then tell me.
Describe:
i use jmarshal cgi script for 'replace' .you can find it in attach nph-s9s.zip
in line 310 i use this replace
$STR_SEARCH='Regions';
$STR_REPLACE='testing';
for replace region to testing.
i test it in this site http://edition.cnn.com/
you can use this script like this:
yourdomain.com/cgi-bin/nph-s9s.cgi/en/00/http/edition.cnn.com
here replace work fine and you see that regions in menu replaced with testing.
i also attached my httpd.conf file.
in .httaccess for enable "replace" i put this code.
(RequestHeader unset Accept-Encoding)
please test it and tell me how we can do it.
thank you
Customer: replied 11 months ago.
Hi,
do u check it??
Expert:  Russell H. replied 11 months ago.

I am sorry - I find that my CGI expertise is too basic for me to help you with these files. I have looked at them and don't find anything to offer in the way of advice.

The only right thing for me to do in this sort of case, is to admit the fact - that I cannot help you further with this case - and Opt Out, opening this case to a CGI-expert Expert in this category.

This case might need a change to the Programming category also, so I will flag it as such.

I have Opted Out. Thanks for your patience.

Customer: replied 11 months ago.
any answer???
Customer: replied 11 months ago.
i need help.
why no anyone answer my question????