Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. WinHttp help with Request Headers Pls..

WinHttp help with Request Headers Pls..

Scheduled Pinned Locked Moved C / C++ / MFC
helpannouncement
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    montiee
    wrote on last edited by
    #1

    I've nearly got everything working in my bit of code but I want control over what Request headers I send. I can add Request headers via WinHttpAddRequestHeaders() but for whatever reason I cannot get rid of one Request header. I would like the "Connection: Close" header to just never exist (ie remove it completely) in the HTTP stream that I send. To this effect I thought the following bit of code would work WinHttpAddRequestHeaders(hRequest, L"Connection: Close", -1L, WINHTTP_ADDREQ_FLAG_REPLACE); I tried many variations of just "Connection" or "Connection: " etc and none of them seem to get rid of the "Connection" Request header. I think I did a decode of the error and it says the header does not exist. However when I fire up my packet capture program sure enough it's there. Any help or pointer to what I'm misunderstanding would be greatley appreciated. I trawled this site and the net and couldn't find anything. PS: I had no such problem with this using CInternetSession etc in my old version of the code but unfortunately I need control over timeouts and retries etc and these functions have had it broken so I resorted to winhttp hoping for something better. Cheers Jbem

    M 1 Reply Last reply
    0
    • M montiee

      I've nearly got everything working in my bit of code but I want control over what Request headers I send. I can add Request headers via WinHttpAddRequestHeaders() but for whatever reason I cannot get rid of one Request header. I would like the "Connection: Close" header to just never exist (ie remove it completely) in the HTTP stream that I send. To this effect I thought the following bit of code would work WinHttpAddRequestHeaders(hRequest, L"Connection: Close", -1L, WINHTTP_ADDREQ_FLAG_REPLACE); I tried many variations of just "Connection" or "Connection: " etc and none of them seem to get rid of the "Connection" Request header. I think I did a decode of the error and it says the header does not exist. However when I fire up my packet capture program sure enough it's there. Any help or pointer to what I'm misunderstanding would be greatley appreciated. I trawled this site and the net and couldn't find anything. PS: I had no such problem with this using CInternetSession etc in my old version of the code but unfortunately I need control over timeouts and retries etc and these functions have had it broken so I resorted to winhttp hoping for something better. Cheers Jbem

      M Offline
      M Offline
      montiee
      wrote on last edited by
      #2

      Meh, for the record I've convince myself that there is no way to remove the "Connection" request header in winhttp since I can remove any other header so it seems the winhttp forces this header to exist whether you like it or not. Damn stupid but what can you do. Going to port over to winiinet (3rd times a charm) which I think doesn't have this braindamaged idea that it knows better than I what I want.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups