Skip to content
Snippets Groups Projects
  1. Jul 03, 2014
    • Richard Mudgett's avatar
      HTTP: Add persistent connection support. · dbec5e0d
      Richard Mudgett authored
      Persistent HTTP connection support is needed due to the increased usage of
      the Asterisk core HTTP transport and the frequency at which REST API calls
      are going to be issued.
      
      * Add http.conf session_keep_alive option to enable persistent
      connections.
      
      * Parse and discard optional chunked body extension information and
      trailing request headers.
      
      * Increased the maximum application/json and
      application/x-www-form-urlencoded body size allowed to 4k.  The previous
      1k was kind of small.
      
      * Removed a couple inlined versions of ast_http_manid_from_vars() by
      calling the function.  manager.c:generic_http_callback() and
      res_http_post.c:http_post_callback()
      
      * Add missing va_end() in ast_ari_response_error().
      
      * Eliminated unnecessary RAII_VAR() use in http.c:auth_create().
      
      ASTERISK-23552 #close
      Reported by: Scott Griepentrog
      
      Review: https://reviewboard.asterisk.org/r/3691/
      ........
      
      Merged revisions 417880 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417901 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      dbec5e0d
  2. Jun 26, 2014
    • Matthew Jordan's avatar
      res_http_websocket: Close websocket correctly and use careful fwrite · 365ae752
      Matthew Jordan authored
      When a client takes a long time to process information received from Asterisk,
      a write operation using fwrite may fail to write all information. This causes
      the underlying file stream to be in an unknown state, such that the socket
      must be disconnected. Unfortunately, there are two problems with this in
      Asterisk's existing websocket code:
      1. Periodically, during the read loop, Asterisk must write to the connected
         websocket to respond to pings. As such, Asterisk maintains a reference to
         the session during the loop. When ast_http_websocket_write fails, it may
         cause the session to decrement its ref count, but this in and of itself
         does not break the read loop. The read loop's write, on the other hand,
         does not break the loop if it fails. This causes the socket to get in a
         'stuck' state, preventing the client from reconnecting to the server.
      2. More importantly, however, is that the fwrite in ast_http_websocket_write
         fails with a large volume of data when the client takes awhile to process
         the information. When it does fail, it fails writing only a portion of
         the bytes. With some debugging, it was shown that this was failing in a
         similar fashion to ASTERISK-12767. Switching this over to ast_careful_fwrite
         with a long enough timeout solved the problem.
      
      Note that this version of the patch, unlike r417310 in Asterisk 11, exposes
      configuration options beyond just chan_sip's sip.conf. Configuration options
      to configure the write timeout have also been added to pjsip.conf and ari.conf.
      
      #ASTERISK-23917 #close
      Reported by: Matt Jordan
      
      Review: https://reviewboard.asterisk.org/r/3624/
      ........
      
      Merged revisions 417310 from http://svn.asterisk.org/svn/asterisk/branches/11
      ........
      
      Merged revisions 417311 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@417317 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      365ae752
  3. Jun 16, 2014
    • Kevin Harwell's avatar
      res_http_websocket: read/write string fixup · bd0aa4fb
      Kevin Harwell authored
      There was a problem when reading a string from the websocket. It assumed the
      received data had a null terminator and tried to write the data to an ast_str.
      This of course could/would read past the end of the given buffer while
      writing the data to the internal buffer of ast_str. Modified the the code to
      correctly place a null terminator on the result string.
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416394 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      bd0aa4fb
  4. Jun 12, 2014
    • Richard Mudgett's avatar
      AST-2014-007: Fix DOS by consuming the number of allowed HTTP connections. · 4ca5745d
      Richard Mudgett authored
      Simply establishing a TCP connection and never sending anything to the
      configured HTTP port in http.conf will tie up a HTTP connection.  Since
      there is a maximum number of open HTTP sessions allowed at a time you can
      block legitimate connections.
      
      A similar problem exists if a HTTP request is started but never finished.
      
      * Added http.conf session_inactivity timer option to close HTTP
      connections that aren't doing anything.  Defaults to 30000 ms.
      
      * Removed the undocumented manager.conf block-sockets option.  It
      interferes with TCP/TLS inactivity timeouts.
      
      * AMI and SIP TLS connections now have better authentication timeout
      protection.  Though I didn't remove the bizzare TLS timeout polling code
      from chan_sip.
      
      * chan_sip can now handle SSL certificate renegotiations in the middle of
      a session.  It couldn't do that before because the socket was non-blocking
      and the SSL calls were not restarted as documented by the OpenSSL
      documentation.
      
      * Fixed an off nominal leak of the ssl struct in
      handle_tcptls_connection() if the FILE stream failed to open and the SSL
      certificate negotiations failed.
      
      The patch creates a custom FILE stream handler to give the created FILE
      streams inactivity timeout and timeout after a specific moment in time
      capability.  This approach eliminates the need for code using the FILE
      stream to be redesigned to deal with the timeouts.
      
      This patch indirectly fixes most of ASTERISK-18345 by fixing the usage of
      the SSL_read/SSL_write operations.
      
      ASTERISK-23673 #close
      Reported by: Richard Mudgett
      ........
      
      Merged revisions 415841 from http://svn.asterisk.org/svn/asterisk/branches/1.8
      ........
      
      Merged revisions 415854 from http://svn.asterisk.org/svn/asterisk/branches/11
      ........
      
      Merged revisions 415896 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415907 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      4ca5745d
  5. Jun 05, 2014
    • Kevin Harwell's avatar
      res_http_websocket: Create a websocket client · e763d704
      Kevin Harwell authored
      Added a websocket server client in Asterisk. Asterisk has a websocket server,
      but not a client. The ability to have Asterisk be able to connect to a websocket
      server can potentially be useful for future work (for instance this could allow
      ARI to connect back to some external system, although more work would be needed
      in order to incorporate that).
      
      Also a couple of things to note - proxy connection support has not been
      implemented and there is limited http response code handling (basically, it is
      connect or not).
      
      Also added an initial new URI handling mechanism to core.  Internet type URI's
      are parsed into a data structure that contains pointers to the various parts of
      the URI.
      
      (closes issue ASTERISK-23742)
      Reported by: Kevin Harwell
      Review: https://reviewboard.asterisk.org/r/3541/
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@415223 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      e763d704
  6. May 09, 2014
  7. Apr 30, 2014
  8. Mar 05, 2014
  9. Sep 13, 2013
  10. Aug 30, 2013
    • David M. Lee's avatar
      optional_api: Fix linking problems between modules that export global symbols · 9bed50db
      David M. Lee authored
      With the new work in Asterisk 12, there are some uses of the
      optional_api that are prone to failure. The details are rather involved,
      and captured on [the wiki][1].
      
      This patch addresses the issue by removing almost all of the magic from
      the optional API implementation. Instead of relying on weak symbol
      resolution, a new optional_api.c module was added to Asterisk core.
      
      For modules providing an optional API, the pointer to the implementation
      function is registered with the core. For modules that use an optional
      API, a pointer to a stub function, along with a optional_ref function
      pointer are registered with the core. The optional_ref function pointers
      is set to the implementation function when it's provided, or the stub
      function when it's now.
      
      Since the implementation no longer relies on magic, it is now supported
      on all platforms. In the spirit of choice, an OPTIONAL_API flag was
      added, so we can disable the optional_api if needed (maybe it's buggy on
      some bizarre platform I haven't tested on)
      
      The AST_OPTIONAL_API*() macros themselves remained unchanged, so
      existing code could remain unchanged. But to help with debugging the
      optional_api, the patch limits the #include of optional API's to just
      the modules using the API. This also reduces resource waste maintaining
      optional_ref pointers that aren't used.
      
      Other changes made as a part of this patch:
       * The stubs for http_websocket that wrap system calls set errno to
         ENOSYS.
      
       * res_http_websocket now properly increments module use count.
      
       * In loader.c, the while() wrappers around dlclose() were removed. The
         while(!dlclose()) is actually an anti-pattern, which can lead to
         infinite loops if the module you're attempting to unload exports a
         symbol that was directly linked to.
      
       * The special handling of nonoptreq on systems without weak symbol
         support was removed, since we no longer rely on weak symbols for
         optional_api.
      
       [1]: https://wiki.asterisk.org/wiki/x/wACUAQ
      
      (closes issue ASTERISK-22296)
      Reported by: Matt Jordan
      Review: https://reviewboard.asterisk.org/r/2797/
      ........
      
      Merged revisions 397989 from http://svn.asterisk.org/svn/asterisk/branches/12
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@397990 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      9bed50db
  11. Jul 18, 2013
  12. Jul 16, 2013
  13. Jul 03, 2013
    • David M. Lee's avatar
      Shuffle RESTful URL's around. · dcf03554
      David M. Lee authored
      This patch moves the RESTful URL's around to more appropriate
      locations for release.
      
      The /stasis URL's are moved to /ari, since Asterisk REST Interface was
      a more appropriate name than Stasis-HTTP. (Most of the code still has
      stasis_http references, but they will be cleaned up after there are no
      more outstanding branches that would have merge conflicts with such a
      change).
      
      A larger change was moving the ARI events WebSocket off of the shared
      /ws URL to its permanent home on /ari/events. The Swagger code
      generator was extended to handle "upgrade: websocket" and
      "websocketProtocol:" attributes on an operation.
      
      The WebSocket module was modified to better handle WebSocket servers
      that have a single registered protocol handler. If a client
      connections does not specify the Sec-WebSocket-Protocol header, and
      the server has a single protocol handler registered, the WebSocket
      server will go ahead and accept the client for that subprotocol.
      
      (closes issue ASTERISK-21857)
      Review: https://reviewboard.asterisk.org/r/2621/
      
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@393528 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      dcf03554
  14. Jun 12, 2013
    • David M. Lee's avatar
      Fix segfault for certain invalid WebSocket input. · 1e9faaf7
      David M. Lee authored
      The WebSocket code would allocate, on the stack, a string large enough
      to hold a key provided by the client, and the WEBSOCKET_GUID. If the key
      is NULL, this causes a segfault. If the key is too large, it could
      overflow the stack.
      
      This patch checks the key for NULL and checks the length of the key to
      avoid stack smashing nastiness.
      
      (closes issue ASTERISK-21825)
      Reported by: Alfred Farrugia
      Tested by: Alfred Farrugia, David M. Lee
      Patches:
          issueA21825_check_if_key_is_sent.patch uploaded by Walter Doekes (license 5674)
      ........
      
      Merged revisions 391560 from http://svn.asterisk.org/svn/asterisk/branches/11
      
      
      git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@391561 65c4cc65-6c06-0410-ace0-fbb531ad65f3
      1e9faaf7
  15. Apr 18, 2013
  16. Apr 08, 2013
  17. Nov 20, 2012
  18. Sep 27, 2012
  19. Jul 31, 2012
  20. Jul 16, 2012
  21. Jun 02, 2012
Loading