Click here to Skip to main content
14,698,679 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi!
I'm trying to get response from a server. At the moment, it returns this:
https://pastebin.com/raw/1K8iZT74


However, I don't want the full response with server header.
I only wan't the "Hello world!" part to be returned.
How do I approach this ? Any ideas ?

My Code so far:
https://pastebin.com/raw/LTuJ4fP5

Thank you!

What I have tried:

Tried changing the request.
I really don't have much idea how to approach this the correct way :(
Posted
Updated 23-Jun-17 8:44am

The response headers are part of the HTTP specification. You don't modify the response; instead, you parse it according to the specification.

Google has plenty of hits for "C++ parse http response" - for example: tinyhttp - A minimal HTTP response parser[^]
   
Maybe this will clarify the working of HTTP GET: HTTP Made Really Easy[^]
You can use this for testing: Hurl.it - Make HTTP requests[^]
   
Look.
I just need to get simple response without the server header. That's all Im trying to achieve with winsock.

It's not about the request. It's about parsing the response correctly (leaving out the server header in my case).
   
Comments
Richard Deeming 23-Jun-17 13:54pm
   
1) This is not an answer to your question. Do not post comments as "solutions".

2) I already gave you a link to a library which will let you parse the response correctly.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900