Merge lp:~1-infe-w/gearmand/gearmand into lp:gearmand

Proposed by palik on 2015-09-15
Status: Needs review
Proposed branch: lp:~1-infe-w/gearmand/gearmand
Merge into: lp:gearmand
Diff against target: 84 lines (+16/-8)
3 files modified
docs/Makefile (+3/-0)
libgearman-server/plugins/protocol/http/protocol.cc (+8/-6)
libgearman-server/plugins/queue/libmemcached/queue.cc (+5/-2)
To merge this branch: bzr merge lp:~1-infe-w/gearmand/gearmand
Reviewer Review Type Date Requested Status
Tangent Trunk 2015-09-15 Pending
Review via email: mp+271083@code.launchpad.net

Description of the change

HTTP POST result without content.
Same as
https://code.launchpad.net/~1-infe-w/gearmand/1.0/+merge/244981

To post a comment you must log in.
lp:~1-infe-w/gearmand/gearmand updated on 2015-09-15
911. By palik on 2015-09-15

bad request line, or bad http method kills gearmand

palik (1-infe-w) wrote :

gearmand can be killed by unknown HTTP method or malicious request

#1348865
r911

Unmerged revisions

911. By palik on 2015-09-15

bad request line, or bad http method kills gearmand

910. By palik on 2015-09-15

bug fix: HTTP Request yields Response with empty content

909. By palik on 2015-05-29

LibmemcachedQueue::done mecache_delete returns MEMCACHED_NOTFOUND; callback_loader dangerous unique_size assertion

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'docs/Makefile'
2--- docs/Makefile 2014-02-16 02:15:49 +0000
3+++ docs/Makefile 2015-09-15 13:29:21 +0000
4@@ -198,3 +198,6 @@
5 $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
6 @echo
7 @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
8+
9+install:
10+
11
12=== modified file 'libgearman-server/plugins/protocol/http/protocol.cc'
13--- libgearman-server/plugins/protocol/http/protocol.cc 2013-07-07 00:16:26 +0000
14+++ libgearman-server/plugins/protocol/http/protocol.cc 2015-09-15 13:29:21 +0000
15@@ -157,6 +157,9 @@
16 case GEARMAN_COMMAND_WORK_FAIL:
17 case GEARMAN_COMMAND_ECHO_RES:
18 case GEARMAN_COMMAND_WORK_COMPLETE:
19+ {
20+ ret_ptr = GEARMAND_SUCCESS;
21+ }
22 break;
23
24 case GEARMAN_COMMAND_JOB_CREATED:
25@@ -215,14 +218,13 @@
26 "HTTP/1.0 200 OK\r\n"
27 "X-Gearman-Job-Handle: %.*s\r\n"
28 "X-Gearman-Command: %s\r\n"
29- "Content-Length: %d\r\n"
30+ "Content-Length: %" PRIu64 "\r\n"
31 "Server: Gearman/" PACKAGE_VERSION "\r\n"
32- "\r\n%.*s",
33+ "\r\n",
34 packet->command == GEARMAN_COMMAND_JOB_CREATED ? int(packet->arg_size[0]) : int(packet->arg_size[0] - 1),
35 (const char *)packet->arg[0], // Job handle
36 gearman_strcommand(packet->command),
37- int(content.size()), // Content-length
38- int(content.size()), &content[0]);
39+ (uint64_t)packet->data_size); // Content-length
40 }
41 else
42 {
43@@ -294,7 +296,7 @@
44 {
45 gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad request line: %.*s", (uint32_t)request_size, request);
46 set_response(gearmand::protocol::httpd::HTTP_NOT_FOUND);
47- ret_ptr= GEARMAND_SUCCESS;
48+ ret_ptr= GEARMAND_INVALID_PACKET;
49 return 0;
50 }
51
52@@ -330,7 +332,7 @@
53 {
54 gearmand_log_error(GEARMAN_DEFAULT_LOG_PARAM, "bad method: %.*s", (uint32_t)method_size, method_str);
55 set_response(gearmand::protocol::httpd::HTTP_METHOD_NOT_ALLOWED);
56- ret_ptr= GEARMAND_SUCCESS;
57+ ret_ptr= GEARMAND_INVALID_PACKET;
58 return 0;
59 }
60 }
61
62=== modified file 'libgearman-server/plugins/queue/libmemcached/queue.cc'
63--- libgearman-server/plugins/queue/libmemcached/queue.cc 2013-05-12 01:03:50 +0000
64+++ libgearman-server/plugins/queue/libmemcached/queue.cc 2015-09-15 13:29:21 +0000
65@@ -243,7 +243,10 @@
66 memcached_return rc= memcached_delete(memc_, (const char *)key, key_length, 0);
67 if (rc != MEMCACHED_SUCCESS)
68 {
69- return gearmand_gerror(memcached_last_error_message(memc_), GEARMAND_QUEUE_ERROR);
70+ if(rc != MEMCACHED_NOTFOUND)
71+ {
72+ return gearmand_gerror(memcached_strerror(memc_, rc), GEARMAND_QUEUE_ERROR);
73+ }
74 }
75
76 return GEARMAND_SUCCESS;
77@@ -313,7 +316,7 @@
78 size_t unique_size= strlen(unique);
79
80 assert(unique);
81- assert(unique_size);
82+ //assert(unique_size);
83 assert(function);
84 assert(function_len);
85

Subscribers

People subscribed via source and target branches

to all changes: