Closed

squid proxy modified to alter some pages/urls

This project received 3 bids from talented freelancers with an average bid price of $233 USD.

Get free quotes for a project like this
Employer working
Project Budget
N/A
Total Bids
3
Project Description

I have a CentOS 5.5 machine where I run a squid proxy server, and need some help modifying squid so that it will alter certain pages/urls when being used as an http proxy. (Will also probably need some hand-holding while compiling squid and installing it over the existing squid installation.) The details for the "modified behavior" are listed in advanced details below.

## Deliverables

I have a CentOS 5.5 machine where I want to install a modified copy of the Squid proxy server, which works like normal squid except in the following cases:



- In one file (called for example /etc/squid/[url removed, login to view], but you can call it anything), have a list of lines like
<[url removed, login to view]> [[url removed, login to view]
][1]This means that if the Squid proxy receives a request from a browser to fetch a URL beginning with "<[url removed, login to view]>", Squid will *actually* replace that portion of the URL with "<[url removed, login to view]>", and fetch that page and send it back to the user. The user's browser should not receive a redirect to the [url removed, login to view] URL; instead, the browser should stay on the URL beginning with "<[url removed, login to view]>", but the actual contents will be fetched from the URL beginning with "<[url removed, login to view]>". So if the user loads
[[url removed, login to view]
][2]the contents will be fetched from
[[url removed, login to view]
][3]although the user's browser will stay on
[[url removed, login to view]

][2]- In another file (called for example /etc/squid/[url removed, login to view] ), have a list of lines in the format:

[url removed, login to view] stuff to insert goes here

This means that whenever Squid fetches any HTML page from the domain "[url removed, login to view]", it should modify the HTML content so that the text "stuff to insert goes here" is inserted either (a) right before the closing 'body' tag, if there is a closing 'body' tag on the page (do a case-insensitive search so it will find 'BODY' and 'body'), or (b) at the end of the page content, if there is no closing 'body' tag.
In those lines, the first space just signifies the end of the domain name, but any spaces after that, should be considered part of the text to be inserted, like "stuff to insert goes here".

One detail: if the URL matches one of the lines in [url removed, login to view] but it also matches one of the domains in [url removed, login to view] , then the text specified in [url removed, login to view] should *not* be inserted. So for example if the user accesses
[[url removed, login to view]
][2]and [url removed, login to view] contains the line
<[url removed, login to view]> [[url removed, login to view]
][1]and [url removed, login to view] contains the lines
[url removed, login to view] blah blah
[url removed, login to view] blah2 blah2
then the page contents should be served from
[[url removed, login to view]
][3](because of the line in [url removed, login to view]) but *nothing* should be inserted before the closing 'body' tag of the returned page, i.e. the lines in [url removed, login to view] should be ignored.

Also, I realize that if the user requests an [https://][4] URL, that Squid just proxies the CONNECT request and cannot see or modify the contents, so I realize that neither of these directives will work for [https://][4] URLs. (But the modified Squid proxy should still be able to *handle* CONNECT requests in order to fetch https:// URLs. A normal Squid proxy can do this, of course, so just don't break that functionality :) )

Here are some test cases I'm going to run to verify that the proxy works as needed:

First, put this line in [url removed, login to view]:
<[url removed, login to view]> [[url removed, login to view]

][5]and put these lines in [url removed, login to view]:
[url removed, login to view] foo
[url removed, login to view] bar

Then with your browser set to use the squid proxy:

1) Access <[url removed, login to view]> . Verify that it loads as "abc" (which is the contents of the page [url removed, login to view] ) and that the directives in [url removed, login to view] are ignored in this case, i.e. no extra text is added
2) Access <[url removed, login to view]> and verify that the string "foo" is inserted right before the closing "body" tag
3) Access <[url removed, login to view]> and verify that the string "foo" is inserted right before the closing "body" tag
4) Access <[url removed, login to view]> and verify that the string "foo" is inserted at the end of the loaded page
5) Access <[url removed, login to view]> and verify that "bar" is inserted at the end of the loaded page

I'll also need to verify all the places that the code was changed from the original squid source code, so I may need some help with instructions on (a) downloading the squid source code, (b) using some 'diff' tool to verify all the places that the code has been changed, (c) compiling the modified source to create the new modified squid. (Hopefully the output will be installed to the place that squid is normally installed to, so it will respond correctly to commands like "service squid restart" and so on.) (Also note that we cannot give out root access to the server, so I'll need *instructions* on how to compile it, etc. but I can't give out the login for someone to do it themselves.)

Thanks and I look forward to working with you!

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online