hedgehogrider
hedgehogrider

Reputation: 1208

Implementation of HTTP in C++

I'm working on a project in which I need to implement http from scratch; I have to put files together from packets rather than using a pre-built file grabber like wget or cURL. Are there any simple frameworks (cross platform or unix) for working with packets? Anyone have any examples of GET or PUT methods they've implemented themselves at the packet level?

Upvotes: 1

Views: 2440

Answers (3)

Ghita
Ghita

Reputation: 4505

You should try and use POCO HttpClient/HttpServer class from http://pocoproject.org/ HttpClient should support POST/GET methods that you need for client side.

Upvotes: 0

John Humphreys
John Humphreys

Reputation: 39354

The points about the OSI layers everyone else is making aside...

You can serialize trivially with standard C++, or you can use archive/ASIO and similar mechanisms from the BOOST libraries.

Rather than point you to one place, I'd' suggest you read this question and its various answers through on stack overflow:

Serialize and send a data structure using Boost?

It covers your options pretty well and gives good resources to give you a happy grounding so you can make a more informed decision based on what you'll be doing.

Upvotes: 2

Steve Jessop
Steve Jessop

Reputation: 279455

HTTP isn't implemented at the packet level, it's implemented on top of a TCP socket, which presents itself as a stream.

HTTP/1.1 is defined by RFC2616, although there are plenty of implementation tricks and traps that aren't obvious from the specification.

Upvotes: 3

Related Questions