brianmario / streamly Goto Github PK
View Code? Open in Web Editor NEWA streaming REST client for Ruby, using libcurl
License: MIT License
A streaming REST client for Ruby, using libcurl
License: MIT License
I'm getting intermittent segfaults that I've traced back to:
Streamly::Request.new(
:method => :get,
:url => ...,
:response_body_Handler => Proc.new {...},
:response_header_handler => Proc.new { |header|
if header =~ /^Last-Modified: ([^\r\n]+)[\r\n]+$/i
found_mtime = $1
end
}).execute
puts found_mtime.inspect
Dies with:
ruby(33776,0x7fff71160c20) malloc: *** error for object 0x106468b40: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Abort trap
This makes them go away:
found_mtime = $1.to_sym.to_s
It appears that the header value is somehow getting GC'd away while it's still needed. I'm doing a lot of string handling in the :response_body_handler
(though none of it affecting the string captured from the header -- that's not used until after the request is done), so the GC is undoubtedly being invoked.
Platform: Mac OSX 10.6.4, ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
I'm still trying to distill this into a testcase, but it's fickle and intermittent. It's definitely server-dependent, probably requires Transfer-Encoding: chunked
, and possibly could involve Content-Encoding: gzip
and/or a timing variable.
Hi
How can I get HTTP basic to work with streamly?
Hi, just close this, trying Yajl-ruby instead.
OS: Linux Ubuntu 14.04 32bit (On Vagrant)
Ruby: 2.2.1
gem install streamly
Fetching: streamly-0.1.4.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing streamly:
ERROR: Failed to build gem native extension.
/home/vagrant/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20150630-10213-1j1a323.rb extconf.rb
checking for rb_thread_blocking_region()... no
checking for rb_trap_immediate in ruby.h,rubysig.h... no
checking for curl-config... yes
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling streamly.c
In file included from streamly.h:47:0,
from streamly.c:23:
/home/vagrant/.rvm/rubies/ruby-2.2.1/include/ruby-2.2.0/ruby/backward/rubysig.h:14:2: warning: #warning rubysig.h is obsolete [-Wcpp]
In file included from streamly.c:23:0:
streamly.h: In function `rb_thread_blocking_region':
streamly.h:59:3: error: `TRAP_BEG' undeclared (first use in this function)
streamly.h:59:3: note: each undeclared identifier is reported only once for each function it appears in
streamly.h:61:3: error: `TRAP_END' undeclared (first use in this function)
streamly.c: In function `each_http_header':
streamly.c:103:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
streamly.c:113:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
streamly.c: In function `rb_streamly_init':
streamly.c:250:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
streamly.c:261:5: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
make: *** [streamly.o] Error 1
make failed, exit code 2
Gem files will remain installed in /home/vagrant/.rvm/gems/ruby-2.2.1/gems/streamly-0.1.4 for inspection.
Results logged to /home/vagrant/.rvm/gems/ruby-2.2.1/extensions/x86-linux/2.2.0/streamly-0.1.4/gem_make.out
I figured I should notify you about it and see if you care / whichever :).
https://github.com/aitrus/streamly_ffi
I replaced your C Extension with an FFI layer. It benchmarks pretty favorably, so far. Then again, I haven't yet added the error checking or any of that nonsense.
Benchmarks:
Hi,
I'm writing a client for BeaconPush using Streamly and I encounter an issue with headers.
In my code, I have:
headers = { 'X-Beacon-Secret-Key' => 'Some secret key', 'foo' => 'bar' }
Streamly.post("#{base_url}/channels/#{channel}", JSON.dump(data), headers)
The request worked well but the response was:
{"status": 400, "message": "No secret key supplied. Use header 'X-Beacon-Secret-Key' to supply it."}
So I investigated and found that my custom headers were truncated:
fo: bar
Accept: */*
Content-Type: application/x-www-form-urlencoded
X-: acon-Secret-Key
Accept-Encoding: identity, deflate, gzip
Content-Length: 24
Host: api.beaconpush.com
I really like Streamly API so I hope there is a fix for that. ;)
Would be nice to have these.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.