?
Solved

HTTP request

Posted on 2006-04-13
7
Medium Priority
?
240 Views
Last Modified: 2010-04-01
Hello. I'm downloading a webpage with winsoc. I just wonder how to format the HTTP request so it does not send this:

HTTP/1.0 200 OK
Date: Thu, 13 Apr 2006 11:52:01 GMT
Server: Apache/1.3.27 (Unix)
Cache-Control: max-age=900
Expires: Thu, 13 Apr 2006 12:07:01 GMT
Last-Modified: Thu, 13 Apr 2006 11:51:23 GMT
ETag: "2b400e-214fd-443e3b3b"
Accept-Ranges: bytes
Content-Length: 136445
Content-Type: text/html; charset=iso-8859-1
X-Cache: HIT from www.vg.no
Age: 561
X-Cache: HIT from www.vg.no
Connection: close

//
// Format the HTTP request
//
sprintf(szBuffer, "GET %s HTTP/1.1\nHost: %s\n\n", lpFileName, lpServerName);

//GET /index.html HTTP/1.1
//Host: www.vg.no
0
Comment
Question by:m-jansen
  • 4
  • 2
7 Comments
 
LVL 2

Expert Comment

by:rahul_r_jadhav
ID: 16444971
I think you need
GET index.html HTTP/1.1

0
 
LVL 2

Expert Comment

by:rahul_r_jadhav
ID: 16444984
i mean instead of sending

//GET /index.html HTTP/1.1
//Host: www.vg.no

just send
GET index.html HTTP/1.1
0
 
LVL 2

Expert Comment

by:rahul_r_jadhav
ID: 16445039
I didnt write code but connected to 80 port of www.vg.no using telnet
and sent
GET /index.html HTTP/1.1
it worked...
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:m-jansen
ID: 16445088
But it still sends all the stuff about date, server and etc. I only want the content of the html file. How to only get only that? Do I need to parse what I get to exclude it or is it some kind of mechanism to control it?
0
 
LVL 5

Accepted Solution

by:
B1-66ER earned 500 total points
ID: 16445420
Hi m-jansen.

HTTP specification does not provide command, which will return only html page content. All http responses always contain HTTP headers.
What you need, is to parse response, till you get \n\r symbol, after it begins your html content.
0
 
LVL 2

Expert Comment

by:rahul_r_jadhav
ID: 16445452
yep... you need to parse it!!
0
 

Author Comment

by:m-jansen
ID: 16445513
thank you
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question