Code Monkey home page Code Monkey logo

mruby-http's Introduction

mruby-http's People

Contributors

bauzer avatar bovi avatar kyab avatar masuidrive avatar matsumotory avatar mattn avatar ompugao avatar pyama86 avatar sugy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mruby-http's Issues

warning: 'mrb_http_object_headers_set_item' defined but not used

I get the following warning when compiling mruby-http:

/home/mruby/code/mruby/build/mrbgems/mruby-http/src/mrb_http.c:47:35: warning: unused variable 'http_url_type' [-Wunused-const-variable]
static const struct mrb_data_type http_url_type = {

/home/mruby/code/mruby/build/mrbgems/mruby-http/src/mrb_http.c:490:1: warning: 'mrb_http_object_headers_set_item' defined but not used [-Wunused-function]
 mrb_http_object_headers_set_item(mrb_state *mrb, mrb_value self)

Repeated header field

When the response headers have a repeated field (2 or more times) only the value for the last repeated field is set. This is because of a hash (in ruby) cannot have a repeated key (header field). there's any work arround?,

Thanks!.

HTTP::URL::decode memory corruption

Hi!

Thanks for the module!

I found that HTTP::URL::decode has some bugs that will cause memory corruption

around line 588

while (_pstr) {
if (_pstr == '%') {
if (pstr[1] && pstr[2]) {

  1. assumes pstr is null-terminated. This is incorrect
  2. ptr[1] and pstr[2] may go past end.

In both cases it may overflow the destination buffer.

Take a look at
https://code.google.com/p/stringencoders/source/browse/trunk/src/modp_burl.c
around line 220

for a safe way of doing this.

I'll try and make a patch later today.

nickg

HTTP::Parser#parse_response has a bug or specification?

Hi, @mattn
mruby-http is very useful. I have a question.

Ruby code
res_text1 = "HTTP/1.1 301 Moved Permanently\r\nServer: nginx\r\nDate: Sun, 11 May 2014 15:16:39 GMT\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: 0\r\nConnection: keep-alive\r\nX-Pingback: http://blog.matsumoto-r.jp/xmlrpc.php\r\nLocation: http://blog.matsumoto-r.jp/\r\n\r\n"

res_text2 = "HTTP/1.1 301 Moved Permanently\r\nServer: nginx\r\nDate: Sun, 11 May 2014 15:16:39 GMT\r\nContent-Type: text/html; charset=UTF-8\r\nContent-Length: 0\r\nConnection: keep-alive\r\nX-Pingback: http://blog.matsumoto-r.jp/xmlrpc.php\r\nLocation: http://blog.matsumoto-r.jp/\r\n\r\nbody\n"

res_text3 = "HTTP/1.1 200 OK\r\nDate: Sun, 11 May 2014 15:23:44 GMT\r\nServer: Apache/2.4.7 (Ubuntu)\r\nLast-Modified: Sun, 11 May 2014 08:13:49 GMT\r\nETag: \"e-4f91b691fc8b7\"\r\nAccept-Ranges: bytes\r\nContent-Length: 14\r\nContent-Type: text/html\r\n\r\nupstream dayo\n"

p HTTP::Parser.new.parse_response res_text1
p HTTP::Parser.new.parse_response res_text2
p HTTP::Parser.new.parse_response res_text3
Result
[[email protected]_64:~/DEV/mruby]$ ./bin/mruby http.rb 
#<HTTP::Response:0x15051a0 method="GET", body=nil, headers={}>
#<HTTP::Response:0x1504ea0 method="GET", body="body\n", headers={}>
#<HTTP::Response:0x1504c30 method="DELETE", headers={"Date"=>"Sun, 11 May 2014 15:23:44 GMT", "Server"=>"Apache/2.4.7 (Ubuntu)", "Last-Modified"=>"Sun, 11 May 2014 08:13:49 GMT", "ETag"=>"\"e-4f91b691fc8b7\"", "Accept-Ranges"=>"bytes", "Content-Length"=>"14", "Content-Type"=>"text/html"}, body="upstream dayo\n", status_code=200, content_length=0>

Is this a specification or bug of mruby-http? At least, content_length=0 is wrong.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.