• 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

    • Garmin Dash Cam X310: 4K dash cam on sale at lowest price for $334.99 by Paul Hill Dash cam footage can be vital for drivers who get into accidents as it can be used to help with insurance claims if you’re involved in an accident, outside of that, it can be used for filming your trips or recording freak events such as asteroids burning up in the atmosphere. If you’re still without one, or looking to upgrade, take a moment to read about the Garmin Dash Cam X310 which has been reduced by 16% from $399.99 to $334.99. To briefly touch on the features before we get started, the X310 is a compact 4K Ultra HD touchscreen dash cam with a 140-degree field of view, ensuring it captures everything. There’s also a built-in Clarity Polarizer to reduce glare from the windshield and it features automatic recording. The main attraction of the Garmin Dash Cam X310 is undoubtedly the 4K Ultra HD video which will capture fine details, and the 140-degree field of view that ensures it doesn’t miss anything important. Coupled with this, the Clarity Polarizer helps to reduce glare from the windshield so that your video footage is better. It also includes HDR which improves the night vision. Aside from having a touchscreen, the X310 comes with voice control allowing you to save video and audio hands-free, meaning you can focus on driving. It supports multiple languages - English, German, French, Spanish, Italian, and Swedish. Other features include built-in GPS for recording the location, date, and time of incidents; parking guard and live view for security while parked (required a paid Vault subscription); and its compact design which allows it to sit “virtually unnoticed” on the windshield. Please note that the product description says some jurisdictions may restrict the use of dashcams, so check your local laws before buying. If you are looking for a high-resolution dash cam with voice control and advanced parking surveillance (paid subscription), the X310 could be for you. The main downside of this product is that it’s still at a premium price point, despite it being at its lowest price on Amazon. If you don’t mind this, it could definitely be a great choice for you. Garmin Dash Cam X310: $334.99 (Amazon US) / MSRP $399.99 This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
    • I have a Motorola B12, and it's been working pretty solidly for a year now. 
    • yes, which is especially funny considering you no longer have an option to turn them off, so how could this matter to anyone? It would be pretty evil if they waited until after Windows 10 EOL to renew the certs, but based on these dates, it looks like that wouldn't be possible, so no worries that I can see.
  • Recent Achievements

    • Week One Done
      Marites earned a badge
      Week One Done
    • One Year In
      runge100 earned a badge
      One Year In
    • One Month Later
      runge100 earned a badge
      One Month Later
    • One Month Later
      jfam earned a badge
      One Month Later
    • First Post
      TheRingmaster earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      575
    2. 2
      ATLien_0
      179
    3. 3
      +FloatingFatMan
      179
    4. 4
      Michael Scrip
      133
    5. 5
      Xenon
      120
  • Tell a friend

    Love Neowin? Tell a friend!