gearman with http,get,how with workload?

Asked by jiaofuyou on 2014-07-24

curl --get ""

it is error

how with workload?

Question information

English Edit question
Gearman Edit question
No assignee Edit question
Last query:
Last reply:

This question was reopened

chjgcn (chjgcn) said : #1

You can send the content below(not contain first and last empty line) to server via socket write:

POST reverse HTTP/1.1
Content-Length: 5
X-Gearman-Unique: 63ee68c3c51343c93f88afb9343fcfe7
X-Gearman-Priority: high


and then read response from server via socket read.

jiaofuyou (jiaofuyou) said : #2

only POST method, GET method?

chjgcn (chjgcn) said : #3

Maybe it does not support at this time. You can modify the code of protocol "HTTP" to support appendding workload behind function name and "?" like a url.

jiaofuyou (jiaofuyou) said : #4


chjgcn (chjgcn) said : #5

I have submit a patch file in
After patching, you can use GET method like:
    curl --get --header 'X-Gearman-Unique: 111111' ''
But I do not know why there is no output after execution of this command.

jiaofuyou (jiaofuyou) said : #6

"But I do not know why there is no output after execution of this command."

Yes, your gearmand-1.1.12.patch have some problem

Now, gearman http POST reture is also NULL

gearman log:

  DEBUG 2014-08-11 04:49:21.416779 [ 2 ] Sending HTTP response: Content-length:0 data_size:8 gearmand_command_t:WORK_COMPLETE response:OK -> libgearman-server/plugins/protocol/http/

data_size:8 //it is OK
Content-length:0 //it is Error

chjgcn (chjgcn) said : #7

What is the version of gearmand you use with my patch file?
My patch file is based on version 1.1.12 .

jiaofuyou (jiaofuyou) said : #8

YES´╝îI use is 1.1.12

is my wrong, youe patch no problem

but gearmand1.1.12 self is have problem

      else if (method() == gearmand::protocol::httpd::POST)
        pack_size= (size_t)snprintf((char *)send_buffer, send_buffer_size,
                                    "HTTP/1.0 200 OK\r\n"
                                    "X-Gearman-Job-Handle: %.*s\r\n"
                                    "X-Gearman-Command: %s\r\n"
// "Content-Length: %d\r\n"
                                    "Server: Gearman/" PACKAGE_VERSION "\r\n"
                                    packet->command == GEARMAN_COMMAND_JOB_CREATED ? int(packet->arg_size[0]) : int(packet->arg_size[0] - 1),
                                    (const char *)packet->arg[0], // Job handle
// int(content.size()), //<email address hidden>,2014.08.11 because return is 0, so Comment
                                    int(content.size()), &content[0]);

here :
header: Content-Length , result is 0
so, "why there is no output after execution of this command."

chjgcn (chjgcn) said : #9

I find out the reason of no output after execution. In my patch file, when the job is created, the message of 'JOB_CREATED' is sent out from server to client with header 'Content-Length: 0' ; but before patching, this kind of messages are ignored, and server waits for those kinds of messages of 'WORK_DATA' or 'WORK_COMPLETE' from worker.
So my patch will make the response from server to client into more than one part, first one is 'JOB_CREATED', later ones are 'WORK_DATA' if worker sends something back to server while job is running, last one is 'WORK_COMPLETE' if worker returns something back to server when job is completed.
I do not know this change is right or wrong, as I writed in

jiaofuyou (jiaofuyou) said : #10

specialty reply, thanks

chjgcn (chjgcn) said : #11

I have posted a newer patch file in
and the protocol 'HTTP' will work perfectly,

Can you help with this problem?

Provide an answer of your own, or ask jiaofuyou for more information if necessary.

To post a message you must log in.