Skip to content

Instantly share code, notes, and snippets.

View kazeburo's full-sized avatar

Masahiro Nagano kazeburo

View GitHub Profile
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/labstack/echo/v4"
"github.com/labstack/echo/v4/middleware"
#!/usr/bin/perl
my $file = $ARGV[0] || "demo.log";
my $i = $ARGV[1] || 100000;
my $log = join "\t", (
"time:08/Mar/2017:14:12:40 +0900",
"status:200",
"reqtime:0.030",
"host:10.20.30.40",
"req:GET /example/path HTTP/1.1",
@kazeburo
kazeburo / main.go
Created October 18, 2021 04:41
fakeserver
package main
import (
"flag"
"fmt"
"log"
"net"
)
var header = []byte("HTTP/1.1 200 OK\r\nConnection: close\r\n\r\n")
@kazeburo
kazeburo / tcpcheck.patch
Created October 13, 2021 08:17
haproxy-healthcheck-busyloop-patch
diff --git a/src/tcpcheck.c b/src/tcpcheck.c
index aa6db673a..c633488b9 100644
--- a/src/tcpcheck.c
+++ b/src/tcpcheck.c
@@ -1594,7 +1594,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_recv(struct check *check, struct tcpcheck_r
goto stop;
}
if (!cur_read) {
- if (!(cs->flags & (CS_FL_WANT_ROOM|CS_FL_ERROR|CS_FL_EOS))) {
+ if (!(cs->flags & (CS_FL_WANT_ROOM|CS_FL_ERROR|CS_FL_EOS)) && !(cs->flags & CS_FL_EOI)) {
[Unit]
Description=http-dump-request
[Service]
PIDFile=/run/http-dump-request.pid
User=root
Group=root
ExecStart=/usr/local/bin/http-dump-request
ExecStop=/bin/kill $MAINPID
diff --git a/ngx_http_upstream_dynamic_resolve_servers.c b/ngx_http_upstream_dynamic_resolve_servers.c
index 62ba520..48ec4eb 100644
--- a/ngx_http_upstream_dynamic_resolve_servers.c
+++ b/ngx_http_upstream_dynamic_resolve_servers.c
@@ -640,27 +640,30 @@ reinit_upstream:
pool_queue = &dynamic_server->pool_queue;
- ngx_log_debug(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0,
+ ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
diff -ur nginx-1.18.0.orig/src/http/ngx_http_upstream.c nginx-1.18.0/src/http/ngx_http_upstream.c
--- nginx-1.18.0.orig/src/http/ngx_http_upstream.c 2020-04-21 23:09:01.000000000 +0900
+++ nginx-1.18.0/src/http/ngx_http_upstream.c 2020-07-30 11:28:08.000000000 +0900
@@ -192,6 +192,8 @@
ngx_http_upstream_t *u, ngx_connection_t *c);
#endif
+extern ngx_int_t ngx_http_upstream_dynamic_resolve_directive(ngx_conf_t *cf,
+ ngx_http_upstream_server_t *us, ngx_uint_t *i);
diff --git a/ngx_http_upstream_dynamic_servers.c b/ngx_http_upstream_dynamic_servers.c
index 05b2889..069b7f9 100644
--- a/ngx_http_upstream_dynamic_servers.c
+++ b/ngx_http_upstream_dynamic_servers.c
@@ -7,7 +7,17 @@
(ngx_resolver_node_t *) \
((u_char *) (n) - offsetof(ngx_resolver_node_t, node))
+typedef struct
+{
#!/usr/bin/perl
use strict;
sub netstat {
my %stats;
{
open my $fh, '<', '/proc/net/snmp' or die "$!\n";
my @keys;
while (<$fh>) {
chomp;
#!perl
use strict;
my %stats;
{
open my $fh, '<', '/proc/net/snmp' or die "$!\n";
my @keys;
while (<$fh>) {
chomp;