• 0

C web proxy not showing images


Question

I programmed a web proxy in C and the pages seem to load fine. The only problem is images don't load up. I see all the requests for the images and see the data transmitted. When the messages are written to the browser, they don't show up. Anyone have an idea why this would be? What I'm confused on is do images have to be handled differently than the regular html text?

I'm reading everything from the web server(eg Google) into a char buffer of 2048 and write to the browser. This loops until there is nothing more to read. Like I said, the webproxy shows that there is information transferred, but I just get the red x.

Link to comment
https://www.neowin.net/forum/topic/397509-c-web-proxy-not-showing-images/
Share on other sites

8 answers to this question

Recommended Posts

  • 0

Is the proxy sending the HTTP headers correctly?

While browsers usually display HTML pages properly if the headers aren't there, they can't display images if the headers aren't there...

I learnt this while I was creating a small webserver. Browsers only started displaying images when I implented the "sendheaders" function. HTML on the other hand was always displayed properly, even without headers.

  • 0
  anog said:
Is the proxy sending the HTTP headers correctly?

While browsers usually display HTML pages properly if the headers aren't there, they can't display images if the headers aren't there...

I learnt this while I was creating a small webserver. Browsers only started displaying images when I implented the "sendheaders" function. HTML on the other hand was always displayed properly, even without headers.

586806184[/snapback]

So I need to forward the entire request, including headers? I figured that just the GET request with the file and protocol was enough. I didn't think that I needed to include the entire header. Let me give this a try. Thanks for the explaination.

  • 0

Still no luck getting the image to load. I just don't see how I can transfer the image data correctly with a character buffer. Does anyone have an idea how I can handle this data correctly? The information that is being passed to the browser is the same information when you open an image in notepad, garbled text and symbols. Any suggestions?

  • 0
  minhaferzz said:
Still no luck getting the image to load.  I just don't see how I can transfer the image data correctly with a character buffer.  Does anyone have an idea how I can handle this data correctly?  The information that is being passed to the browser is the same information when you open an image in notepad, garbled text and symbols.  Any suggestions?

586809572[/snapback]

Be careful with your buffer, because it contains binary data if you use it for transferring images. Thus a string function like strlen() for example will likely not work --at least not all the time. You may want to consider an array of bytes instead.

The easy way to resolve your problem is to sniff on the network traffic with and without your proxy and then compare the results for the same requests, then you should be able to tell what is different when the proxy is enabled and it should be trivial to fix.

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

    • No registered users viewing this page.
  • Posts

    • Indiana Jones and the Great Circle: The Order of Giants DLC launches this September by Pulasthi Ariyasinghe The Xbox Games Showcase gave a look at the next Indiana Jones adventure today. MachineGames showed up with a trailer for the first DLC pack coming to Indiana Jones and the Great Circle: The Order of Giants. Set in Italy, the fresh story will introduce new locations, puzzles, enemies and more. Watch the reveal trailer above. This Indy journey will be taking place during the main campaign and dive deeper into the tribe of giants, Nephilim Order, that players see in the base game. The story will kick off with Indiana Jones offering help to a young priest named Father Ricci, who is attempting to track down a mysterious artifact. The resulting journey expands into this separate storyline that takes the player beyond Vatican City to explore Rome's streets and the crypts beneath it. “One of the most satisfying parts of developing Indiana Jones and the Great Circle was the opportunity to create the Nephilim Order, the secret society of giants formed by descendants of fallen angels working to atone for their ancestral sins,” says Production Director John Jennings. “That story spans thousands of years and this DLC has given us the opportunity to develop further upon their lore and look at other aspects not covered in the initial story campaign. There’s something new and unexpected to tell here for fans of the game, and we can’t wait for people to be able to play it for themselves.” The Indiana Jones and the Great Circle: The Order of Giants DLC will be releasing on September 4, 2025. It will be available on PC, Xbox Series X|S, and PlayStation 5. Premium Edition, Premium Upgrade, Collector’s Edition, and Collector’s Bundle owners will be receiving the DLC for no extra charge at launch.
    • Could we have a desktop version of this lightweight bloat free Windows 11?
    • So they admit that Windows 11 is slow and bloated. Good to know!
    • Real handheld Xbox hardware was canceled, this is just a PC with a screen and controller built-in.
    • Amazon Deal: JBL BAR 1000 7.1.4, BAR 700 5.1 Dolby Atmos wireless subwoofer soundbars by Sayan Sen If you are in the market for an audio system and are after smaller bookshelf speakers delivering highly accurate sound, then take a look at KEF and Polk Audio's Q Concerto Meta and Reserve R200 speakers, respectively, as both of them are up for sale at their lowest ever prices. However, if you are more into shaking your house, which is not possible without a subwoofer, then Samsung has its Q900F, Q800F, and Q600F soundbar systems with wireless subwoofers at the lowest prices. These are the latest 2025 models, and you can take a look at them in this article here. JBL BAR 1000 For those looking for additional options, JBL's BAR 1000 and Bar 700 are also available. The former has hit its lowest ever price too, while the latter is back to its cheapest (purchase links down below). JBL claims that its BAR 1000 model goes as low as 33Hz which is crucial for movie-watching or even some genres of music. The 10-inch subwoofer is rated at 300 watts of RMS power. The total power output of the system is 880 watts at THD (total harmonic distortion) of 1%. JBL BAR 1000 rear view Unlike the 7.1.4 JBL BAR 1000, the BAR 700 is a 5.1 system which means it lacks true Dolby Atmos, but it should still provide an Atmos-like experience. DTS:X is also not supported. The BAR 700 is rated at 620 watts. It is good to see some power ratings, as companies like Samsung, Sonos, Bose, and more tend not to mention them all too often nowadays. Interestingly, both the BAR systems have similarly-specced subwoofers so if bass is what you are looking for and do not care about the Atmos experience so much, you can opt for the BAR 700 too. Get them at the links below: JBL Bar 1000: 7.1.4-Channel soundbar with Detachable Surround Speakers, MultiBeam™, True Dolby Atmos®, and DTS:X®, Black: $799.95 (Shipped and Sold by Amazon US) JBL Bar 700: 5.1-Channel soundbar with Detachable Surround Speakers and Dolby Atmos®, Black: $549.95 (Amazon US) + you also get free 90-day Amazon Music 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.
  • Recent Achievements

    • Dedicated
      Epaminombas earned a badge
      Dedicated
    • Veteran
      Yonah went up a rank
      Veteran
    • First Post
      viraltui earned a badge
      First Post
    • Reacting Well
      viraltui earned a badge
      Reacting Well
    • Week One Done
      LunaFerret earned a badge
      Week One Done
  • Popular Contributors

    1. 1
      +primortal
      475
    2. 2
      +FloatingFatMan
      264
    3. 3
      ATLien_0
      236
    4. 4
      snowy owl
      228
    5. 5
      Edouard
      174
  • Tell a friend

    Love Neowin? Tell a friend!