none
VERB * HTTP/1.1 with WCF self hosted rest service RRS feed

  • Question

  • I have the requirement for enable VERB * HTTP/1.1 with WCF self-hosted Rest (XML) service.

    My service is working with VERB / HTTP/1.1 but I need to use "*" instead of "/" with wcf service and when I use OPTIONS as the verb it works fine. But I want to give same support for some Custom Verbs.

    While I am trying to consume service with python client using below request format it is working fine.

    Request

    MYVERB / HTTP/1.1 HOST: 127.0.0.1:8000 EXT: MY_APP

    and

    OPTIONS/ HTTP/1.1 HOST: 127.0.0.1:8000 EXT: MY_APP

    Response

    <?xml version="1.0" encoding="utf-8"?><MyXML status="0" info="my demo service"></MyXML>

    but while using the request format as below it is giving error with HTTP Status 400 (Bad Request)

    Request

    MYVERB * HTTP/1.1
    HOST: 127.0.0.1:8000
    EXT: MY_APP

    Response

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01// EN""http://www.w3.org/TR/html4/strict.dtd">\r\n<HTML><HEAD><TITLE>Bad Request</T ITLE>\r\n<META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii">< /HEAD>\r\n<BODY><h2>Bad Request - Invalid URL</h2>\r\n<hr><p>HTTP Error 400. The request URL is invalid.</p>\r\n</BODY></HTML>\r\n')

    Saturday, May 13, 2017 3:41 AM

All replies

  • Have you seen anywhere or any document describe this request with “*”? From my experience, I do not. And after checking http URL, there is no such definition.

    Could you share us what the purpose of “*” in URL?

    In my option, this is an invalid URL as the error indicates.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, May 15, 2017 7:11 AM
  • Thanks for the reply,

    While reading about "*" URI, it will refer directly to the server not to any particular methods. But "*" URI is only valid fro OPTIONS methods. For others the HTTP will return as "Bad Request URL". 

    My need is to form a custom verb which has the same credentials of OPTIONS verb.

    For more about OPTIONS https://tools.ietf.org/html/draft-ietf-http-options-00

    Monday, May 15, 2017 8:00 AM
  • Thanks for sharing the information.

    As my research, I think * is only supported in options.

    In addition, per to this link OPTIONS

    An OPTIONS request with an asterisk ("*") as the request-target
       (Section 5.3 of [RFC7230]) applies to the server in general rather
       than to a specific resource.  Since a server's communication options
       typically depend on the resource, the "*" request is only useful as a
       "ping" or "no-op" type of method; it does nothing beyond allowing the
       client to test the capabilities of the server

    There is no specific function with "*". If you want to ping a server, I would suggest you keep using OPTIONS.

    In addition, per to the error message when you send request with "MYVERB * HTTP/1.1", I think it is valid by client and this is client error, we could not custom this error in server side. And I think this is valid by HTTP protocol, we could not custom this behavior.

    400 Bad Request
    The server cannot or will not process the request due to an apparent client error (e.g., malformed request syntax, too large size, invalid request message framing, or deceptive request routing)


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.



    Tuesday, May 16, 2017 8:44 AM