chesterpolo / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

How to get request data for PUT request? #180

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
======================================
As stated in issue number #39, I am trying to implement a REST service.
Handling the MG_NEW_REQUEST and calling mg_read as suggested in resolution to 
the issue # 39 does not work. See below for more details

What is the expected output? What do you see instead?
======================================
calling mg_read should return request data for PUT request

What version of the product are you using? On what operating system?
======================================
version 2.10

Please provide any additional information below.
======================================

This is what I tried as suggested in issue # 39?

myEventHandler(...)
{
...
if( !strcmp(ri->request_method, "PUT") )
   mg_read(conn, buf, 1024);
...
}

This does not work as the code inside mg_read skips everything for non-POST 
request. So it PUT doesn't work for PUT.

  if (strcmp(conn->request_info.request_method, "POST") == 0 &&
      conn->consumed_content < conn->content_len) {

Original issue reported on code.google.com by amolta...@gmail.com on 23 Sep 2010 at 5:05

GoogleCodeExporter commented 9 years ago
Actually, I don't see any reason for mg_read to check the request method.  
Servers are allowed to implement custom request methods, and these can be 
accessed with AJAX from the client.

Original comment by arnout.v...@gmail.com on 4 Nov 2010 at 9:00

GoogleCodeExporter commented 9 years ago
Patch please!

Original comment by valenok on 29 Nov 2010 at 1:50

GoogleCodeExporter commented 9 years ago
Of course!  It's in ad422fcd77 of the 
https://arnoutvandecappelle-multiplereads.googlecode.com/hg/ repository.

Original comment by arnout.v...@gmail.com on 29 Nov 2010 at 3:36

GoogleCodeExporter commented 9 years ago
Submitted, thank you.

Original comment by valenok on 29 Nov 2010 at 4:59

GoogleCodeExporter commented 9 years ago
Hi Arnout, looking at the number of useful changes you've contributed so far, I 
am granting you commit access. Please check that it works. Thank you.

Original comment by valenok on 29 Nov 2010 at 5:07