Proxy in perl

Discussion in 'Perl Misc' started by secSwami, Oct 1, 2008.

  1. secSwami

    secSwami Guest

    Hi,

    I am trying to write up a proxy client in perl. I have finished part
    of it where the script listens on port 7070 and when you configure
    your browser to use that port, it will get the webpage just fine but I
    see that if the page has calls out to other servers for images etc,
    the request half heartedly fails and I just get the web page minus the
    content that is hosted on some other website. Can someone shine some
    light if and how I can have the proxy app fetch those urls too?

    Thanks
    secSwami, Oct 1, 2008
    #1
    1. Advertising

  2. secSwami

    Tim Greer Guest

    secSwami wrote:

    > Hi,
    >
    > I am trying to write up a proxy client in perl. I have finished part
    > of it where the script listens on port 7070 and when you configure
    > your browser to use that port, it will get the webpage just fine but I
    > see that if the page has calls out to other servers for images etc,
    > the request half heartedly fails and I just get the web page minus the
    > content that is hosted on some other website. Can someone shine some
    > light if and how I can have the proxy app fetch those urls too?
    >
    > Thanks


    It's hard to say without knowing the script you use or how it works. It
    could just be displaying the content via the script on the "proxy
    server" with the HTML/text and wants to just call the images normally,
    as if they are also on that same server, at their expected relative or
    absolute paths. You'd probably want to have the script prepend the
    domain and appropriate path, as it would be seen on the server it's
    fetching the content from (assuming they don't prevent that (especially
    by blocking invalid refers -- not that those can't be bypassed)). You
    could fetch the images, at least temporarily, too, depending on how you
    want it to work.
    --
    Tim Greer, CEO/Founder/CTO, BurlyHost.com, Inc.
    Shared Hosting, Reseller Hosting, Dedicated & Semi-Dedicated servers
    and Custom Hosting. 24/7 support, 30 day guarantee, secure servers.
    Industry's most experienced staff! -- Web Hosting With Muscle!
    Tim Greer, Oct 1, 2008
    #2
    1. Advertising

  3. On Wed, 1 Oct 2008 00:30:18 -0700 (PDT),
    secSwami <> wrote:
    > Hi,
    >
    > I am trying to write up a proxy client in perl. I have finished part
    > of it where the script listens on port 7070 and when you configure
    > your browser to use that port, it will get the webpage just fine but I
    > see that if the page has calls out to other servers for images etc,
    > the request half heartedly fails and I just get the web page minus the
    > content that is hosted on some other website. Can someone shine some
    > light if and how I can have the proxy app fetch those urls too?


    The proxy shouldn't have to parse the HTML returned from a server to get
    the references in that HTML as well (I am assuming you're talking about
    a HTTP proxy here, and you're fetching HTML pages?).

    The browser gets a document, lets say it's a HTML document, from a
    server. Once it has the document, the original HTTP transaction is
    over. It then parses that document for display. Any contained objects
    that need to be displayed get fetched in a separate transaction. So, if
    there's a <img src=.../> link in the HTML, the browser will create a
    separate HTTP GET request for that. The proxy would see that second
    request separate from the original GET request that fetched the HTML
    document.

    If you know this, and you really should before you write a proxy server,
    I apologise, but it doesn't seem clear to me from what you wrote that
    you do know. If you don't know, and you're doing this to learn about all
    this, i suggest you read up on the relevant RFCs

    It's a bit hard to say what you mean by "calls out to other servers" and
    "the request half heartedly fails".

    HTTP allows for multiple requests to be sent over the same TCP/IP
    connection, but they would still be separate, serialised, and all
    constructed by the user agent, not an intermediate proxy.

    You do know that there are modules available to create HTTP proxy
    servers?

    http://search.cpan.org/search?query=proxy

    Martien
    --
    |
    Martien Verbruggen | Never hire a poor lawyer. Never buy from a
    | rich salesperson.
    |
    Martien Verbruggen, Oct 1, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. vidy5300
    Replies:
    0
    Views:
    863
    vidy5300
    Jun 7, 2004
  2. Replies:
    0
    Views:
    1,642
  3. Karsten Wutzke
    Replies:
    1
    Views:
    876
    Steven Simpson
    Aug 20, 2007
  4. Klein Stéphane
    Replies:
    3
    Views:
    592
    Steve Holden
    Dec 20, 2009
  5. Alejandro Molina

    Proxy and non Proxy configurations

    Alejandro Molina, Jul 15, 2004, in forum: ASP .Net Security
    Replies:
    0
    Views:
    148
    Alejandro Molina
    Jul 15, 2004
Loading...

Share This Page