AlexanderMac / http-z

Parse/build HTTP message to/from model
MIT License
17 stars 6 forks source link

Add RTSP protocol and methods #34

Closed murillo128 closed 4 years ago

murillo128 commented 4 years ago

This PR adds the 'RTSP/1.0' protocol and common RTSP methods to be able to support rtsp requests and responses.

AlexanderMac commented 4 years ago

Hi, Thank you for the PR, but I don't want to add support for an exotic (specific) protocol in the library.

murillo128 commented 4 years ago

can you elaborate? RTSP is an IETF standard protocol with same semantics as HTTP

https://tools.ietf.org/html/rfc2326

AlexanderMac commented 4 years ago

The library was created to support only HTTP protocol. RTSP is similar to HTTP, but it includes specific methods: pause, play, etc. Need to validate that method is supported by HTTP or RTSP, or by both in the parser. But I don't want to add a new layer of complexity in the library.

murillo128 commented 4 years ago

First of all, thanks for your project and responding this issue, but I will insist in trying to get this in ;)

I can fork the project and use it for my needs, but I believe it is better to collaborate so we can both benefit from common efforts.

Regarding http methos, you are still missing a lot ones registered at IANA: https://www.iana.org/assignments/http-methods/http-methods.xhtml

IMHO it is a bad idea to to semantic checks on the parser, and I think it would be better to just implement the ABNF for the extension-method and just the layer above the parser verify that the method is allowed or not for the resource:


       Method         = "OPTIONS"                ; Section 9.2
                      | "GET"                    ; Section 9.3
                      | "HEAD"                   ; Section 9.4
                      | "POST"                   ; Section 9.5
                      | "PUT"                    ; Section 9.6
                      | "DELETE"                 ; Section 9.7
                      | "TRACE"                  ; Section 9.8
                      | "CONNECT"                ; Section 9.9
                      | extension-method
       extension-method = token

       token          = 1*<any CHAR except CTLs or separators>
       separators     = "(" | ")" | "<" | ">" | "@"
                      | "," | ";" | ":" | "\" | <">
                      | "/" | "[" | "]" | "?" | "="
                      | "{" | "}" | SP | HT

Regarding adding the rtsp as protocol and url, you already have ftp

Anyway, if you are still not ok with it, I will just fork it and not bother you anymore.

AlexanderMac commented 4 years ago

Regarding http methos, you are still missing a lot ones registered at IANA:

Yes, I know about missing methods, and going to add them soon.

What about adding support for rtsp protocol, I still think that this is not a good idea, at least for now. Anyway, you're welcome to fork the repo and add support for rtsp protocol :). Maybe in the future we'll merge our repos.