Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 507

For code that acts as a HTTP client or server.

1 vote
1 answer
29 views

WebServer HTTP Response Header

When adding header data to the response. We accept what the user is telling us and do no conversion of the data. But: The Response object (and its stream) is going to handle the encoding/ transport. S …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
20 views

Interface Design for HTTP parsing / response

This is my first "real" attempt at decoding an HTTP request on the server side. This is the interface I think should be sufficient. … name=ryan#234' std::string_view origin(); // 'http://localhost:53' std::string_view protocol(); // 'http:' std::string_view username(); // 'user' …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
1 view

WebServer HTTP parsing The Header (for the Request Object)

This class keep tracks of the HTTP headers that are being read from the incoming request. Few special cases. …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
2 views

WebServer HTTP parsing The Body

The StreamInput class is used to wrap an existing std::iostream. It is either provided a body length or the encoding type (transport-encoding: chunked). It will then allow the user to read data from t …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
8 views

WebServer HTTP parsing Request

/1.0", Version::HTTP1_0}, {"HTTP/1.1", Version::HTTP1_1}, {"HTTP/ … 2", Version::HTTP2}, {"HTTP/3", Version::HTTP3} }; auto find …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
4 views

WebServer HTTP Response Object

The Response object is how the user sends an HTTP reponse back from the server. This object is provided to them via the Pynt interface. … You can simple write the body of the HTTP response object to this stream. …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
4 views

WebServer HTTP Pynt Request/Response framework

This proivdes an implementation of Pynt for the HTTP protocol. This proves that handling of the incoming HTTP message and the outgoing HTTP response. … the HTTP body for the outgoing response. …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
1 view

WebServer HTTP Response Output Stream

Handles streaming of the response body. In construction you either pass a content-length value and the stream will allow you to send that many bites before cutting you off. Or you can pass the transfe …
Loki Astari's user avatar
  • 96.6k
0 votes
0 answers
8 views

HTTPHandler: Using lambdas to server specific paths

request.getUrl().query()); addPathMatch(var, matches); actions[actionId](request, response); }); } Hello World We can now simplify the Hello World handler to: // Processes HTTP … ThorsAnvil::Nisse::NisseHTTP::HTTPHandler http; http.addPath("/HW-Length{Who}.html", [](ThorsAnvil::Nisse::NisseHTTP::Request& request, ThorsAnvil::Nisse::NisseHTTP::Response& response) { …
Loki Astari's user avatar
  • 96.6k
5 votes
2 answers
195 views

C++ Socket Part-3

This is the HTTP version. … = '\n' || strcmp(version, "HTTP/1.1") ! …
Loki Astari's user avatar
  • 96.6k
0 votes
2 answers
286 views

C++ Socket Part-4

Full Source: https://github.com/Loki-Astari/Examples/tree/master/Version4 First Article: http://lokiastari.com/posts/SocketProtocols/ This code replaces the hand written socket code with a libcurl wrapper … ) const {return Post;} void sendMessage(std::string const& urlPath, std::string const& message) { std::stringstream url; response.clear(); url << "http
Loki Astari's user avatar
  • 96.6k
14 votes
1 answer
2k views

Stream that opens an HTTP GET and then acts like a normal C++ istream

} return bytes; } friend size_t headFunc(char* ptr, size_t size, size_t nmemb, void* userdata) { if (strncmp(ptr, "HTTP … } }; } } #endif It was inspired by this gist: https://gist.github.com/Loki-Astari/8201956 Which uses an early version of this code and my JSON library to easily make REST calls to an HTTP
Loki Astari's user avatar
  • 96.6k
8 votes
1 answer
7k views

Simple Multi-Threaded Web Server

Need a way to test a web crawler. Threw together this web server that will replay previously saved pages from a real web server. Headers #include <stdexcept> #include <memory> #include <map> #include …
Loki Astari's user avatar
  • 96.6k
11 votes
1 answer
466 views

HTTP Stream Part 2 A stream that opens an HTTP GET and then acts like a normal C++ istream

ifndef THORSANVIL_STREAM_THOR_STREAM_H #define THORSANVIL_STREAM_THOR_STREAM_H // Note "ThorsSimpleStream.h" is up fro review in a seprate question // https://codereview.stackexchange.com/questions/38402/http-stream-a-stream-that-opens-an-http-get-and-then-acts-like-a-normal-c-istr … curl_multi_cleanup(multi); } // Interface to add/remove http requests. …
Loki Astari's user avatar
  • 96.6k