Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should parse PATCH method #13

Open
ghost opened this issue Jan 26, 2012 · 1 comment
Open

Should parse PATCH method #13

ghost opened this issue Jan 26, 2012 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 26, 2012

Given the following code I get a Parser::Error, same with GET / HTTP/0.9.

req = ""
req << "PATCH / HTTP/1.1\r\n"
req << "Host: 127.0.0.1:4567\r\n"
req << "Transfer-Encoding: chunked\r\n"
req << "\r\n"
req << "9\r\n"
req << "name=zack\r\n"
req << "0\r\n"
req << "\r\n"

require "http/parser"

parser = HTTP::Parser.new
parser.on_headers_complete = proc do
  p parser.http_method
  p parser.request_url
  p parser.headers
end
parser.on_body = proc do |chunk|
  p chunk
end
parser.on_message_complete = proc do
  puts "finished!"
end

parser << req
@ghost
Copy link
Author

ghost commented Oct 28, 2013

There's a pending PR upstream in nodejs/http-parser#158 that enables the handling of non-standard HTTP methods.

I removed HTTP/0.9 from the title, don't need that anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants