Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Internet > HTTP (WWW)

    mod_sed 1.0.2

    Download button

    No screenshots available
    Downloads: 850  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Dominic Mitchell | More programs
    The Apache License 2.0 / FREE
    September 12th, 2010, 19:37 GMT [view history]
    ROOT / Internet / HTTP (WWW)

     Read user reviews (0)  Refer to a friend  Subscribe

    mod_sed description

    An Apache module that embeds a copy of the sed command

    mod_sed is an Apache module that embeds a copy of the sed command. This means that you can automatically filter data without having to spawn a CGI process.

    It probably doesn't have a lot of practical use, but I wrote it anyway. The main purpose was for me to learn how to write an apache module.

    BUILDING

    To build, you should just be able to type in "make". I'm still working on the portability aspects of this module, so it might not run on your system yet. All patches appreciated.

    You'll need apxs(8) to build this module, because at present, I don't understand Apache's static configuration (again, patches welcome). Either edit the Makefile to specify the location of it, or put it on the command line like this:

    % make APXS=/usr/local/sbin/apxs

    If your system doesn't have an fgetln(3) call (to test, see if "man fgetln" returns anything), you'll also have to uncomment a line in the Makefile.

    To install, "make install" should copy the mod_sed.so to your data directory and put the correct lines in your httpd.conf to enable it.

    TESTING

    This is all the documentation you get until I write some more, I'm afraid.

    You'll need: A directory or file that you want to run sed over inside Apache. In my case, this is "/usr/local/www/data/sed/". Copies of the files are in the "eg" subirectory. The httpd.conf fragment I used looked like this:

    < Directory /usr/local/www/data/sed >
    SetHandler sed-handler
    SedExtendedRegex on
    #SedProgram "s/foo/BAR/g"
    SedProgram /usr/local/www/data/sedscr
    SedPathMap /foo /usr/local/www/data/sedscr.foo
    < /Directory >


    You'll need to make sure that the directory you specify is visible from Apache. In fact, it's probably a good idea to do that /before/ installing this module...

    The important bit to activate mod_sed is the "SetHandler" line. That enables all files under that directory to be passed through mod_sed.

    The "SedExtendedRegex" line asks that sed use Enhanced Regexes instead of basic ones. If you don't know what that means, always include this line. For more details on the differences between basic regexes and extended regexes see re_format(7).

    The "SedProgram" keyword can specify either a whole sed program (like you would give on the command line with -e) or a pathname to a file containing a sed program (this is generally the preferred option). To determine between the two, mod_sed will attempt to see if a file by that name exists, otherwise it'll try and compile it as a program.

    The last command, "SedPathMap" takes two arguments: a PATH_INFO and another SedProgram argument. What it means is that when somebody requests a file:

    http://my.server/sed/index.html/foo

    The sed program in /usr/local/www/data/sedscr.foo will get run instead of the default in SedProgram. This can be very handy for serving up alternative versions of files.

    Product's homepage

    Requirements:

    · Apache

    What's New in This Release: [ read full changelog ]

    Fixed following 3 types of warnings :
    · warning: array subscript has type 'char'
    · warning: suggest parentheses around assignment used as truth value
    · warning C4018: '

      


    TAGS:

    embed sed | Apache module | filter data | Apache | sed | embedded

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM