[En-Nut-Discussion] REST server

Harald Kipp harald.kipp at egnite.de
Thu Sep 26 17:48:18 CEST 2013


Hi Markus,

On 26.09.2013 15:15, markus.forrer at gmx.ch wrote:
> I'd like to use the MicroHTTP library to realize a REST server since REST is based on HTTP. Instead of MediaType I'll use a specific request handler to create and send the REST answer. I only need the MicroHTTP library for parsing the HTTP headers.
> 
> The client sends the following data (splittet in two separate TCP packets, recorded by Wireshark). Between the two TCP packet it's required, that the MicroHTTP sends 'HTTP/1.1 100 Continue'. Is it possible to realize this functionality with MicroHTTP?

Not easy to answer off the top of my head. But interesting.


> TCP packet 1 from client:
> 
> POST /restdata/item1 HTTP/1.1
> Accept: text/xml
> Host: ???
> Content-Length: ???

That length is the length of packet 1, I guess.


> Expect: 100-continue

There is no content-type header, right?


> Response from server:
> 
> HTTP/1.1 100 Continue
>  
> 
> TCP packet 2 from client:
> 
> <Root>
> <DataField1>xyz</DataField1>
> <DataField2>123</DataField2>
> <DataField3>abc</DataField3>
> </Root>

I assume here, that the server is smart enough and knows from the
content, how much data he can expect from the client.

Probably a CGI function must be used to handle the POST, but I need a
bit more time to check the details. I do not have any real world
experience with REST. Would it make sense for me to install any simple
REST client for testing (Linux or Windows)?

Regards,

Harald



More information about the En-Nut-Discussion mailing list