CQHTTP 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b5d66b4056bcf2687ab4f674d53158541c129e0
4
- data.tar.gz: 9ab26ffd1617116613f237c77d29d5b87168f77a
3
+ metadata.gz: 34092cf41ddd4500166cafc96a00929708ab0d89
4
+ data.tar.gz: d6538739475e11d87afcf59dc361f405f9807948
5
5
  SHA512:
6
- metadata.gz: c876bdb54bfcebdbb634af5f728ca6aa3cb440d533db0e24ad0d16afb61eaa74e22c8956e9c2cc421a4b8d3e9d476d3039fab729d53ebfc37768b3949533ab5d
7
- data.tar.gz: 1e3048a9d669e03a53446742b03ab03f4773e9feebaaeb824d99f05ca577e73fe47aeb4ea601c0b9fb21449e8a8930e49af0020b8c6f7ae3dd673de19173b71a
6
+ metadata.gz: 34f14a7abc215e479faa50ff820395dcb8e43431a185ba594d87504866f303e6353954b1abd0c28b13e0580e3a2c28ae1c774be722928bfcac0b6147aa636ead
7
+ data.tar.gz: de9111bd89b230a8f2d0f675f8b180acf79108ba3ff0573ad0e37ec1a892ac718313c871e72201969a0ad867c1b9e2e15af65b51fa1d209ede8ae3503880719c
@@ -71,6 +71,7 @@ module CQHTTP
71
71
  def self.coolq_error(json)
72
72
  case json['retcode'].to_i
73
73
  when 0 then return json
74
+ when 1 then return json
74
75
  when 100 then raise '参数错误'
75
76
  when 102 then raise '没有权限'
76
77
  end
@@ -15,17 +15,23 @@ module CQHTTP
15
15
  def run
16
16
  loop do
17
17
  socket = @server.accept
18
+ accept socket
19
+ end
20
+ end
18
21
 
19
- head socket
22
+ def accept(socket)
23
+ head socket
20
24
 
21
- socket.print "HTTP/1.1 204\r\nContent-Type: application/json\r\n\r\n"
22
- data = socket.gets
23
- @json = JSON.parse data
25
+ socket.print "HTTP/1.1 204\r\n" \
26
+ "Content-Type: application/json\r\n" \
27
+ "Connection: Close\r\n\r\n"
28
+ data = socket.gets
29
+ puts data
30
+ @json = JSON.parse data
24
31
 
25
- @event_method.each { |func| func.call self }
32
+ @event_method.each { |func| func.call self }
26
33
 
27
- socket.close
28
- end
34
+ socket.close
29
35
  end
30
36
 
31
37
  private
@@ -1,3 +1,3 @@
1
1
  module CQHTTP
2
- VERSION = '2.2.1'.freeze
2
+ VERSION = '2.2.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: CQHTTP
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - 71e6fd52
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-10-31 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler