Kaynağa Gözat

Prepare a list of proposed API changes for V1.10

For some new features, CivetWeb is limited by compatibility
of the current API. Some small changes will allow new features,
provide a more consistent API and improve maintainability.

Create a list as a base for discussion.
bel2125 8 yıl önce
ebeveyn
işleme
6f1eb90597
2 değiştirilmiş dosya ile 70 ekleme ve 1 silme
  1. 70 0
      docs/Interface_Changes_1.10.md
  2. 0 1
      src/civetweb.c

+ 70 - 0
docs/Interface_Changes_1.10.md

@@ -0,0 +1,70 @@
+# Interface changes
+
+## Proposed interface changes for 1.10
+
+Status: To be discussed
+
+### Server interface
+
+#### mg\_start / mg\_init\_library
+
+Calling mg\_init\_library is recommended before calling mg\_start.
+
+Compatibility:
+Initially, mg\_init\_library will be called implicitly if it has 
+not been called before mg\_start.
+If mg\_init\_library was not called, mg\_stop may leave memory leaks.
+
+#### mg\_websocket\_write functions
+
+Calling mg\_lock\_connection is no longer called implicitly
+in mg\_websocket\_write functions. 
+If you use websocket write functions them from two threads,
+you must call mg\_lock\_connection explicitly, just like for any
+other connection.
+
+This is an API harmonization issue.
+
+Compatibility:
+If a websocket connection was used in only one thread, there is
+no incompatibility. If a websocket connection was used in multiple
+threads, the user has to add the mg\_lock\_connection before and
+the mg\_unlock\_connection after the websocket write call.
+
+#### open\_file member of mg\_callbacks
+
+This member is going to be removed.
+It is superseeded by mg\_add\_request\_handler.
+
+Compatibility:
+Current code using open\_file needs to be changed.
+Instructions how to do this will be provided.
+
+
+### Client interface
+
+
+#### mg\_init\_library
+
+Calling mg\_init\_library is required before calling any client
+function. In particular, the TLS initialization must be done
+before using mg\_connect\_client\_secure.
+
+Compatibility:
+Some parts of the client interface did not work, if mg\_start
+was not called before. Now server and client become independent.
+
+#### mg\_connect\_client (family)
+
+mg_connect_client needs several new parameters (options).
+
+Details are to be defined.
+
+mg_connect_client and mg_download should return a different kind of
+mg_connection than used in server callbacks. At least, there should
+be a function mg_get_response_info, instead of using 
+mg_get_request_info, and getting the HTTP response code from the
+server by looking into the uri member of struct mg_request_info.
+
+
+

+ 0 - 1
src/civetweb.c

@@ -10231,7 +10231,6 @@ mg_websocket_write_exec(struct mg_connection *conn,
 	 * not for any other connection. It must be set for every
 	 * conn read/written by more than one thread, no matter if
 	 * it is a websocket or regular connection. */
-	/* TODO: Prepare a list of interface changes. */
 	(void)mg_lock_connection(conn);
 	retval = mg_write(conn, header, headerLen);
 	if (dataLen > 0) {