in reply to Re^3: Http connection manipulations
in thread Http connection manipulations

Unfortunately squid is unable solve this, but he's doing his part with roundrobin. My task now is to implement sockets manipulation or to find a new way to make clients to follow redirects.

Replies are listed 'Best First'.
Re^5: Http connection manipulations
by flexvault (Monsignor) on Jan 11, 2012 at 22:16 UTC

    kazak,

    Sorry if I can't follow what you're trying to do, but I would like to help you. Maybe answers to a few questions would help all of us understand your problem:

    • Are you on the same server as squid?
    • Are you setting up a socket connection with the client, and then relaying that to the squid server via a separate connection? or
    • Do you have an API to squid that you can query/respond? or
    • Are you being called by squid as part of some error recover process?

    My problem of understanding your problem is that you seem to between the client and squid, so why can't you ask squid for the redirect and return the response to the client! Or does the response need to go to an entirely different squid structure?

    Sometimes, explaining the problem to others in more detail, will lead you to a better solution, and that's what PM is all about!

    Keep explaining!

    "Well done is better than well said." - Benjamin Franklin

      Thanks, for your attention at first place.

      Yes. Clients are connecting to the port on external address, port:15000 (HTTP::Proxy custom script) and squid listens 127.0.0.1:3128

      Yes. My custom proxy relaying connections to squid. HTTP::Proxy made for listening responses from squid and if response URL contains "/sorry/" custom proxy redirects client to it's initial destination, client should repeat his last failed request once more (but client can't) and squid roundrobins it to another parent proxy server

      No. I'm affraid I have no skills for doing something with Squid. But if it's possible it would be just great

      Yes. You allmost right custom http::proxy evaluates responses from the squid and tries to repeat initial request, but only if it's failed

        Since the client is connected to you on 'port:15000', you could return the "where to go" by using the following in your code:

        . . . my $where = "..."; ## $where is the URL of the new destinat +ion print "Content-type: text/html\r\n\r\n"; print '<HTML>'; print '<HEAD>'; print '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=http://' . $wh +ere . '">'; print '</HEAD>'; print "</HTML>";

        What the code does, is tell the clients browser to redirect to the new URL. You need to initialize '$where' with the new destination

        Good Luck

        "Well done is better than well said." - Benjamin Franklin