Skip to content

Instantly share code, notes, and snippets.

#include "curl/curl.h"
int main(int argc, char** argv)
{
CURLM *multi = curl_multi_init();
curl_multi_setopt(multi, CURLMOPT_PIPELINING, CURLPIPE_MULTIPLEX);
curl_multi_setopt(multi, CURLMOPT_MAX_HOST_CONNECTIONS, 4);
int j, all_done = 0;
for (j = 0; j < 100 && !all_done; j++) {
* STATE: INIT => CONNECT handle 0x25b46a8; line 1346 (connection #-5000)
* Added connection 0. The cache now contains 1 members
* Trying 127.0.0.1:81...
* TCP_NODELAY set
* STATE: CONNECT => WAITCONNECT handle 0x25b46a8; line 1402 (connection #0)
* Connected to 127.0.0.1 (127.0.0.1) port 81 (#0)
* STATE: WAITCONNECT => SENDPROTOCONNECT handle 0x25b46a8; line 1522 (connection #0)
* Marked for [keep alive]: HTTP default
* STATE: SENDPROTOCONNECT => DO handle 0x25b46a8; line 1540 (connection #0)
* HTTP/2 over clean TCP
#include <string.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
#include <string.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
#include <string.h>
#include <curl/curl.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
int socket_callback(CURL *easy, /* easy handle */
curl_socket_t s, /* socket */
2019-06-24 14:35:08.221 pid: 29249 - BEGIN POST http://my.service/retrieve
2019-06-24 14:35:08.221 pid: 29249 - * STATE: INIT => CONNECT handle 0x7f72bbc40808; line 1356 (connection #-5000)
2019-06-24 14:35:08.221 pid: 29249 - * Connecting to hostname: 127.0.0.1
2019-06-24 14:35:08.221 pid: 29249 - * Connecting to port: 9211
2019-06-24 14:35:08.221 pid: 29249 - * Found bundle for host 127.0.0.1: 0x7f72b910d0c8 [can multiplex]
2019-06-24 14:35:08.221 pid: 29249 - * Re-using existing connection! (#0) with host my.service
2019-06-24 14:35:08.221 pid: 29249 - * Connected to 127.0.0.1 (127.0.0.1) port 9211 (#0)
2019-06-24 14:35:08.221 pid: 29249 - * STATE: CONNECT => DO handle 0x7f72bbc40808; line 1405 (connection #0)
2019-06-24 14:35:08.221 pid: 29249 - * http2_send len=460
2019-06-24 14:35:08.221 pid: 29249 - * h2 header: :method:POST
#include <string.h>
#include <curl/curl.h>
#include <assert.h>
#include <unistd.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
@TvdW
TvdW / test.go
Last active August 26, 2019 13:40
package main
import (
"context"
"log"
"net/http"
"time"
)
func main() {
@TvdW
TvdW / test.c
Created October 16, 2019 10:18
#include <string.h>
#include <curl/curl.h>
#include <assert.h>
#include <unistd.h>
fd_set wfds;
fd_set rfds;
struct timeval tv;
int maxfd = 0;
package main
import (
"net/http"
)
func main() {
srv := &http.Server{Addr: ":443", Handler: http.HandlerFunc(handle)}
srv.ListenAndServeTLS("fullchain.pem", "privkey.pem")
}