Skip to content

Instantly share code, notes, and snippets.

@hannesg
hannesg / README.md
Last active June 23, 2016 13:16
http request with chunked body

HTTP Request with Chunked Body

What does it do

  • server.go is a simple http server that reads the entire request body and returns it to the client.
  • client.go tries to send a http request with a chunked request body containing two bytes "ab". The request is send in two tcp frames.

Running the example

#!/usr/bin/env ruby
def online?
num = 0
flag_regexp = /R[A-Z]*\n$/m
IO.popen("ifconfig -s").each do |line|
num = num + 1
# ignore first line
next if num == 1
# ignore lo
next if line[0,2] == 'lo'
class User
include Splash::Document
end
users = Scope.new(User, {:query=>{'posts'=>{'$gt'=> 10 }}}) # <- users now behaves very similiar to User, except that it only finds users with >= 10 posts
users2 = User.query({'posts'=>{'$gt'=> 10 }}) # <- shorthand for the above
users3 = users.query('tags'=>'cool guy') # <- scopes are stackable. users3 now finds all users with >= 10 posts and tag 'cool guy'
@hannesg
hannesg / gist_experiment.rb
Created November 21, 2010 16:53
waiting.rb
def using_gist
maybe?
nice!
end