#19 Support for HTTP PUT and DELETE

closed
upnp (15)
5
2012-02-26
2011-02-06
Chandra
No

Hi,

Currently the HTTP client API doesn't support issuing PUT and DELETE requests. These methods are an important part of REST based APIs, and can be added to pupnp's HTTP implementation with little memory and performance overhead. The patch is attached. Please note that it builds on top of the patch submitted for tracker 3173431.

Best,
Chandra

Discussion

    • assigned_to: nobody --> mroberto
    • labels: 899806 --> upnp
     
  • Hi Chandra,

    The same issue regarding LinkedList applies here. Lets discuss it to get to a solution.

    Also, the name you used, e.g. "*Generic", does not sound good, as the method is not able to really create any kind of message. I'd rather use something like "*PutOrPost", since this is more what is happening.

    And finally, I would like to congratulate you for the care you took both in code and in documentation of the library in your patches, I will be very pleased to commit them as soon as we solve the LinkedList issue.

    Regards,
    Marcelo.

     
  • Chandra
    Chandra
    2011-02-06

    Hi Marcelo,

    I initially called it PutOrPost, but renamed to 'Generic' with the intention of making a flexible HTTP Connection API (i.e. a generic Open/Write/Close method for all HTTP methods). I put that on hold, due to time-constraints, but left the naming to reflect the intention. However, if you'd like I can rename the methods back to "PutOrPost". Please let me know.

    Cheers,
    Chandra

     
  • Hi Chandra,

    If you think that later it is going to be used for all http methods, then it is better to leave it with its final name, Generic.

    Since it will become part of the public API, changing it later would be problematic because it would break code.

    Regards,
    Marcelo.

     
  • Chandra
    Chandra
    2011-02-07

    Hi Marcelo,

    Sounds good. Just to clarify however, I was under the impression the methods in httpreadwrite.h were not public API, is this not true?

    Best,
    Chandra

     
  • Chandra
    Chandra
    2011-02-07

    Hi Marcelo,

    I reorganized the changes to match my original intentions. This results in a lot more differences, but hopefully the implementation and the resulting API is much cleaner. Additionally I also made the change to use 'UpnpString' instead of 'LinkedList for specifying the headers. The resulting diff is now a single patch so the other tracker can be closed.

    The updated patch is attached to this tracker. Please let me know if further changes are needed.

    Cheers,
    Chandra

     
  • Hi Chandra,

    I am very sorry for the delay, please excuse me.

    I had problems compiling your patch, it seems that it may be lacking a file:

    src/genlib/net/http/httpreadwrite.c: In function ‘copy_msg_headers’:
    src/genlib/net/http/httpreadwrite.c:188:1: error: expected expression before ‘/’ token
    src/genlib/net/http/httpreadwrite.c:184:45: warning: unused parameter ‘msgHeaders’
    src/genlib/net/http/httpreadwrite.c:185:46: warning: unused parameter ‘headers’
    src/genlib/net/http/httpreadwrite.c: In function ‘http_SendMessage’:
    src/genlib/net/http/httpreadwrite.c:496:15: warning: conversion to ‘int’ from ‘size_t’ may alter its value
    src/genlib/net/http/httpreadwrite.c:520:7: warning: conversion to ‘int’ from ‘size_t’ may alter its value
    src/genlib/net/http/httpreadwrite.c:527:6: warning: conversion to ‘int’ from ‘size_t’ may alter its value
    src/genlib/net/http/httpreadwrite.c:550:5: warning: conversion to ‘int’ from ‘size_t’ may alter its value
    src/genlib/net/http/httpreadwrite.c: In function ‘http_OpenHttpConnection’:
    src/genlib/net/http/httpreadwrite.c:1042:69: warning: unused parameter ‘timeout’
    src/genlib/net/http/httpreadwrite.c: In function ‘http_MakeHttpRequest’:
    src/genlib/net/http/httpreadwrite.c:1111:3: error: expected expression before ‘/’ token
    src/genlib/net/http/httpreadwrite.c: In function ‘http_WriteHttpRequest’:
    src/genlib/net/http/httpreadwrite.c:1163:3: warning: conversion to ‘int’ from ‘size_t’ may alter its value
    src/genlib/net/http/httpreadwrite.c: In function ‘http_EndHttpRequest’:
    src/genlib/net/http/httpreadwrite.c:1188:3: warning: conversion to ‘int’ from ‘size_t’ may alter its value

    Is it possible for you to generate a new patch against the latest git repository?

    Regards,
    Marcelo.

     
  • Hi again Chandra,

    Never mind, I have posted the wrong error messages.

    After a manual merge I have succeeded including your changes, I will commit them soon.

    Regards,
    Marcelo.

     
    • status: open --> closed