JoeDog / siege

Siege is an http load tester and benchmarking utility
GNU General Public License v3.0
5.95k stars 385 forks source link

Add support for PATCH request method #79

Open mirfilip opened 8 years ago

mirfilip commented 8 years ago

Hi, I wanted to test my API using many concurrent PATCH requests. If I understand correctly, there is no support for PATCH.

Moreover, when I do:

$ siege -c=3 --delay=3 --content-type="application/json" 'http://localhost/myApi PATCH {"foo": "bar"}'

siege starts and performs GET requests looking like:

HTTP/1.1 200     0.46 secs:    1606 bytes ==> GET myApi%20PATCH%20%7B%22foo%22:%22bar%22%22%7D

I'd expect to get an error if the method is not supported, just as it's done for unsupported protocol.

JoeDog commented 8 years ago

Siege was first written in 1999 and as a result it has a few assumptions left in the code. This is one of them. Can you direct me to a resource details PATCH requests? I'll try to add them (and make it clear when something is not supported)

On Fri, Sep 16, 2016 at 3:41 AM, Mirosław Filip notifications@github.com wrote:

Hi, I wanted to test my API using many concurrent PATCH requests. If I understand correctly, there is no support for PATCH https://github.com/JoeDog/siege/blob/RELEASE_4-0-2-MAY-20-2016/src/url.h#L43 .

Moreover, when I do:

$ siege -c=3 --delay=3 --content-type="application/json" 'http://localhost/myApi PATCH {"foo": "bar"}'

siege starts and performs GET requests looking like:

HTTP/1.1 200 0.46 secs: 1606 bytes ==> GET myApi%20PATCH%20%7B%22foo%22:%22bar%22%22%7D

I'd expect to get an error if the method is not supported, just as it's done for unsupported protocol.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/JoeDog/siege/issues/79, or mute the thread https://github.com/notifications/unsubscribe-auth/AFMT5gMpXJajKdPWIsAbQxhmv1O77rRaks5qqkgsgaJpZM4J-q-m .

mirfilip commented 8 years ago

@JoeDog I'm not sure what level of info you ask for. The RFC is probably a detailed one, yet short and easy to grasp.

You caught me by surprise with that question, to be honest. I was sure, having written that tool, you had to be familiar with different methods. When you say it was written in 1999, the perspective is different as the PATCH was added to HTTP in 1997, at least the rfc was published then.

I dived into the code check how you handle http requests, having first thought you use external tool/library to mess with HTTP calls but now I see you use socket_write and built the whole thing on your own. Ok. From that perspective, patch requests are not different than post (what you send to the socket (payload) looks similar to post).