Results 1 to 9 of 9

Thread: How to make a proxy server?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #4
    Join Date
    May 2009
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to make a proxy server?

    Hi, it's me again.

    So now I'm using QTcpServer. For every new connection, I use a QHttp to send request, and write the response back to the socket (please tell me if this is stupid; I just thought it would be easier to apply filter).

    Everything works fine, except for the Transfer-Encoding: chunked response. All browsers will immediately close the socket after one chunk and act as "page can not be displayed".

    I googled and wiki-ed the definition of chunked encoding, did some test, and finally found out that what QHttp::readAll() return is no longer chunked.

    Then I tried removing the Transfer-Encoding header before writing. That works, but leads to another problem: by the definition of chunked encoding, the message-sender is allowed to "append" headers after the message body (so-called "trailer"). So if I remove the Transfer-Encoding header, the trailer will be lost (or treated as improper message, depending on how QHttp handle; I haven't tested that yet).

    I can re-chunk the message by "repair"ing the size-line of each chunk, but still, I'll have to determine where's the trailer part and avoid counting their length. Since the size-line is already removed by QHttp, I can't think of anything except the colon and space as the identifier of trailer. But there's always chance that the message body contains a colon and space.

    So can anyone please tell me how to deal with the chunked encoding transfer? Many thanks.
    Last edited by Passerby; 6th June 2009 at 08:16.
    Nightmare be with us

Similar Threads

  1. Replies: 3
    Last Post: 29th November 2009, 20:24
  2. Replies: 0
    Last Post: 22nd February 2009, 13:15
  3. QHttp proxy problem
    By andre.rigon in forum Qt Programming
    Replies: 2
    Last Post: 28th September 2008, 21:19
  4. Window OS make distclean && qmake && make one line
    By patrik08 in forum General Programming
    Replies: 4
    Last Post: 22nd March 2007, 10:43
  5. Compiling with Qmake/Make
    By VireX in forum Newbie
    Replies: 25
    Last Post: 22nd February 2007, 05:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.