CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2005
    Posts
    20

    Replacing HTTP headers with LSP

    Hi !
    I need to replace some fields in the http header in all (http) traffic passing through my PC. I decided to do it via LSP.
    The header I want to edit is in the WSPSend function of my LSP.
    Here is the func declaration :

    int WSPAPI WSPSend (
    SOCKET s,
    LPWSABUF lpBuffers,
    DWORD dwBufferCount,
    LPDWORD lpNumberOfBytesSent,
    DWORD dwFlags,
    LPWSAOVERLAPPED lpOverlapped,
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
    LPWSATHREADID lpThreadId,
    LPINT lpErrno
    )

    The data I want to edit is in lpBuffers. The trick is that I don't know how many buffers (dwBufferCount) there can be and who is setting this value. In most cases it's set to 1. It means that we write lpBuffers[0].buf to get to the needed buffer.
    When I try JUST to replace let's say the address in HOST field of the http header to the address with the same quantity of letters, then it's OK. Now, let I want to replace the address from 'www.yahoo.com' to 'www.microsoft.com', what should I do ? First I thought I have to free the old buffer (lpBuffers[0].buf) and set to new one, but when I do so, my IE crashes. So maybe I have to alloc new buffer and set its address to lpBuffers[1].buf and its length to lpBuffers[1].len ? Then who will free it ? Do I have to do that or the system ? If this is fault way to solve my task, then how can I do it all ?

  2. #2
    Join Date
    Oct 2005
    Posts
    1

    Re: Replacing HTTP headers with LSP

    Quote Originally Posted by Tomek.Sergey
    Hi !
    I need to replace some fields in the http header in all (http) traffic passing through my PC. I decided to do it via LSP.
    The header I want to edit is in the WSPSend function of my LSP.
    Here is the func declaration :

    int WSPAPI WSPSend (
    SOCKET s,
    LPWSABUF lpBuffers,
    DWORD dwBufferCount,
    LPDWORD lpNumberOfBytesSent,
    DWORD dwFlags,
    LPWSAOVERLAPPED lpOverlapped,
    LPWSAOVERLAPPED_COMPLETION_ROUTINE lpCompletionRoutine,
    LPWSATHREADID lpThreadId,
    LPINT lpErrno
    )

    The data I want to edit is in lpBuffers. The trick is that I don't know how many buffers (dwBufferCount) there can be and who is setting this value. In most cases it's set to 1. It means that we write lpBuffers[0].buf to get to the needed buffer.
    When I try JUST to replace let's say the address in HOST field of the http header to the address with the same quantity of letters, then it's OK. Now, let I want to replace the address from 'www.yahoo.com' to 'www.microsoft.com', what should I do ? First I thought I have to free the old buffer (lpBuffers[0].buf) and set to new one, but when I do so, my IE crashes. So maybe I have to alloc new buffer and set its address to lpBuffers[1].buf and its length to lpBuffers[1].len ? Then who will free it ? Do I have to do that or the system ? If this is fault way to solve my task, then how can I do it all ?
    Hi Tomkey,
    I just wonder had you got any resolution on your problem.
    I am having the same problem.

  3. #3
    Join Date
    Nov 2002
    Location
    California
    Posts
    4,556

    Re: Replacing HTTP headers with LSP

    I think he might have found his answer in the news://alt.winsock.programming newsgroup. It might have been a different person, but the questions and the timing of them are similar:

    "LSP - changing outgoing data" at http://groups.google.com/group/alt.w...2c7629569be66/

    "Opera, IE and Mozilla as the clients for LSP" at http://groups.google.com/group/alt.w...d6f015b30a2fe/

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured