• 0

Obtaining Content-Length in HTTP 1.1 Requests


Question

Hi

I'm having problems retrieving the Content-Length header from HTTP requests used by an application i'm writing. It seems some servers wanna send filesizes, and some don't.

Is there any optional arguments or something I can use in a request to force the server to send a Content-Length header.

Requests are in HTTP 1.1, using Apache under Windows XP if that helps.

I've tried explaining as easily as I can, sorry if it sounds confusing ;)

5 answers to this question

Recommended Posts

  • 0

Thanks for the replies.. really appreciated. So how do I disable chunked encoding? Most servers send 'Transfer-Encoding: chunked' in their responses without me specififing whether I want it or not.

Here's a sample of the type of request i'm sending.

GET /image.gif HTTP/1.1
HOST: www.sitenamehere.com
Connection: close

Unfortunately I don't know much about this so if someone can help me it would be greatly appreciated.

  • 0

Oh! I assumed the server was under your control. Apperently Not.

If you want to stay with HTTP/1.1 then you will have to use the HEAD verb.

HEAD /images/logo.gif HTTP/1.1
HOST: hp.msn.com
Connection: close

The server will respond with the Content-Length header.

If you use HTTP/1.0 then you will get Content-Length instead of Transfer-Encoding.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • They have a concept of a plan. How fitting.
    • As Total War turns 25, Creative Assembly is teasing a "new era" for the strategy franchise by Pulasthi Ariyasinghe Creative Assembly has now officially been making Total War games for 25 years. It was in June 2000 that the UK-based studio put forth Shogun: Total War for PC, with Electronic Arts publishing the ambitious project. With a quarter of a century now behind the series, the developer is now looking towards the "next era" of Total War. The studio will host its first-ever Total War showcase in December 2025, which is described as a "flagship video presentation unveiling what’s next for the franchise." Creative Assembly said that the showcase will have announcements for new games as well as content for existing titles, with developer commentary also happening regarding the future of the series. "We’re honoured and humbled to be one of the few video games that get the chance to celebrate such a huge milestone, and we want to thank colleagues past and present, as well as our fans for all the support," says Total War vice president Roger Collum. "2025 marks an exciting new era for the franchise as we reveal what’s next for Total War, and we can’t wait to celebrate throughout the year with everyone." Read an anniversary letter from Roger Collum regarding the studio's history, Total War beginnings, and more over here. Prior to the showcase, Creative Assembly will be hosting retrospective video interviews, developer livestreams, and more behind-the-scenes content regarding the series starting this August. There will also be multiplayer tournaments for fans, giveaways, Q&A sessions with developers, mod spotlights, and more events happening during this period. As the studio celebrates the occasion, a massive Total War historical games sale has just gone live on Steam. This has discounts of up to 75% across everything from the original Shogun: Total War to the latest entry, Total War: PHARAOH. The discounts will last until June 26.
    • ANY standard Windows PC, either desktop or laptop, can install the Copilot app, period, no NPU or Copilot+ certification required. I should know, I have it running on a 3770K (2011) Windows 11 PC and works perfectly fine. So, your laptop can definitely run it, too.
    • Just what the driving public does not need--still another very attractive and addictive distraction.
    • You think Musk fixed any of that? Wow.
  • Recent Achievements

    • One Month Later
      POR2GAL4EVER earned a badge
      One Month Later
    • One Year In
      Orpheus13 earned a badge
      One Year In
    • One Month Later
      Orpheus13 earned a badge
      One Month Later
    • Week One Done
      Orpheus13 earned a badge
      Week One Done
    • Week One Done
      serfegyed earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      539
    2. 2
      ATLien_0
      258
    3. 3
      +FloatingFatMan
      179
    4. 4
      +Edouard
      163
    5. 5
      Xenon
      118
  • Tell a friend

    Love Neowin? Tell a friend!