Skip to content

Instantly share code, notes, and snippets.

Roger Pack rdp

Block or report user

Report or block rdp

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fix 84841.diff
iff --git a/spec/std/openssl/ssl/socket_spec.cr b/spec/std/openssl/ssl/socket_spec.cr
index 1b6675327..9ba587f1f 100644
--- a/spec/std/openssl/ssl/socket_spec.cr
+++ b/spec/std/openssl/ssl/socket_spec.cr
@@ -20,6 +20,27 @@ describe OpenSSL::SSL::Socket do
end
end
+ it "accepts clients that don't read anything and close the connection" do
+ tcp_server = TCPServer.new(0)
@rdp
rdp / server.cr
Last active Dec 4, 2019 — forked from jgaskins/server.cr
Serve a sample JSON payload in Crystal
View server.cr
require "http"
require "uuid"
require "uuid/json"
class App
include HTTP::Handler
def call(context)
Fiber.yield # Simulate getting data from the DB
response_payload.to_json context.response
View faster_http.patch
diff --git a/src/http/request.cr b/src/http/request.cr
index f942c33f3..ade289eb1 100644
--- a/src/http/request.cr
+++ b/src/http/request.cr
@@ -110,7 +110,7 @@ class HTTP::Request
request = new line.method, line.resource, headers, body, line.http_version, internal: nil
if io.responds_to?(:remote_address)
- request.remote_address = io.remote_address.try &.to_s
+ #request.remote_address = io.remote_address.try &.to_s
View use_libevent_dns.cr
require "socket" # works with 0.31.1 FWIW
struct Socket::Addrinfo
class DnsRequestCbArg
getter value : Int32 | Pointer(LibC::Addrinfo) | Nil
@fiber : Fiber
def initialize
@fiber = Fiber.current
View gist:2ebd7fbed16dd5e2bb0ff5151b3b644b
require "socket"
struct Socket::Addrinfo
class DnsRequestCbArg
getter value : Int32 | Pointer(LibC::Addrinfo) | Nil
@fiber : Fiber
def initialize
@fiber = Fiber.current
View gist:918af45b0ad68cd9bf2e0dc54cad5638
diff --git a/src/debug/dwarf/line_numbers.cr b/src/debug/dwarf/line_numbers.cr
index b4a11139b..790748d88 100644
--- a/src/debug/dwarf/line_numbers.cr
+++ b/src/debug/dwarf/line_numbers.cr
@@ -284,7 +284,9 @@ module Debug
operation_advance = adjusted_opcode // sequence.line_range
increment_address_and_op_index(operation_advance)
registers.line &+= sequence.line_base + (adjusted_opcode % sequence.line_range)
- register_to_matrix(sequence, registers)
+ if (registers.is_stmt || (registers.line.to_i > 0 && registers.column.to_i > 0))
View gist:9e954c12905ed5a16bfae78a200894cb
diff --git a/src/debug/dwarf/line_numbers.cr b/src/debug/dwarf/line_numbers.cr
index b4a11139b..ebbfebbaa 100644
--- a/src/debug/dwarf/line_numbers.cr
+++ b/src/debug/dwarf/line_numbers.cr
@@ -284,7 +284,9 @@ module Debug
operation_advance = adjusted_opcode // sequence.line_range
increment_address_and_op_index(operation_advance)
registers.line &+= sequence.line_base + (adjusted_opcode % sequence.line_range)
- register_to_matrix(sequence, registers)
+ if (registers.is_stmt)
View gist:cde091f6eeb6d1d5daf9384c457d5113
Linux:
Using compiled compiler at `.build/crystal'
["src/crystal/main.cr:47:14 in 'main'",
"src/unicode/data.cr:1554:7 in 'casefold_ranges'",
"_start",
"???"]
View spork_crystal
~/kemal_server$ cat wait_file.sh
#!/bin/bash
echo "waiting for $1" >> spork.log
date +"%T.%3N" >> spork.log
rm -f $1 # in case leftover
while [ ! -f "$1" ]; do sleep 0.1; done
echo "found $1" >> spork.log
date +"%T.%3N" >> spork.log
joshua@joshua-Latitude-E6230:~/kemal_server$ cat kemal_spork.cr
View try_openssl_rand.diff
diff --git a/src/crystal/system/random.cr b/src/crystal/system/random.cr
index e03cc6ca6..745d0300d 100644
--- a/src/crystal/system/random.cr
+++ b/src/crystal/system/random.cr
@@ -11,7 +11,7 @@ module Crystal::System::Random
end
{% if flag?(:linux) %}
- require "./unix/getrandom"
+ require "./unix/urandom"
You can’t perform that action at this time.