You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
doc: Add HTTP client migration notes for NCS Serial LTE Modem
Document the changes required to migrate from the NCS SLM HTTP client
API to the new HTTP client API in the Serial Modem add-on.
Rename the <socket_fd> parameter to <handle> for consistency with the
AT socket documentation.
Jira: SM-298
Signed-off-by: Juha Ylinen <juha.ylinen@nordicsemi.no>
It identifies the socket used when starting the manual-mode request.
285
285
286
286
* The ``<length>`` parameter is an optional integer.
@@ -292,7 +292,7 @@ Response syntax
292
292
293
293
When body data is available::
294
294
295
-
#XHTTPCDATA: <socket_fd>,<offset>,<length>
295
+
#XHTTPCDATA: <handle>,<offset>,<length>
296
296
<length bytes of raw body data>
297
297
OK
298
298
@@ -302,10 +302,10 @@ The ``#XHTTPCDATA:`` line is terminated with ``\r\n``.
302
302
303
303
When the socket buffer is temporarily empty (EAGAIN)::
304
304
305
-
#XHTTPCDATA: <socket_fd>,<offset>,0
305
+
#XHTTPCDATA: <handle>,<offset>,0
306
306
OK
307
307
308
-
* The ``<socket_fd>`` parameter is an integer.
308
+
* The ``<handle>`` parameter is an integer.
309
309
It identifies the socket.
310
310
* The ``<offset>`` parameter is an integer.
311
311
It contains the number of body bytes already delivered before this pull.
@@ -319,8 +319,8 @@ when the ``Content-Length`` bytes have all been forwarded.
319
319
320
320
.. note::
321
321
322
-
Retry the pull after a brief delay when ``#XHTTPCDATA: <socket_fd>,<offset>,0`` is received.
323
-
Use ``AT#XHTTPCCANCEL=<socket_fd>`` to cancel if no more data is needed.
322
+
Retry the pull after a brief delay when ``#XHTTPCDATA: <handle>,<offset>,0`` is received.
323
+
Use ``AT#XHTTPCCANCEL=<handle>`` to cancel if no more data is needed.
324
324
325
325
Example
326
326
~~~~~~~
@@ -356,15 +356,15 @@ Response syntax
356
356
357
357
::
358
358
359
-
#XHTTPCDATA: <socket_fd>[,<length>]
359
+
#XHTTPCDATA: <handle>[,<length>]
360
360
361
361
Example
362
362
~~~~~~~
363
363
364
364
::
365
365
366
366
AT#XHTTPCDATA=?
367
-
#XHTTPCDATA: <socket_fd>[,<length>]
367
+
#XHTTPCDATA: <handle>[,<length>]
368
368
OK
369
369
370
370
Idle timeout
@@ -377,7 +377,7 @@ The timer resets each time data is sent or received:
377
377
* Receiving response headers or body bytes.
378
378
* Pulling a body chunk in manual mode (``AT#XHTTPCDATA``).
379
379
380
-
If no such activity occurs within the configured window, the request is aborted and ``#XHTTPCSTAT: <socket_fd>,-1,<total_bytes>`` is emitted.
380
+
If no such activity occurs within the configured window, the request is aborted and ``#XHTTPCSTAT: <handle>,-1,<total_bytes>`` is emitted.
381
381
The timeout is enforced by a background timer that fires independently of normal socket poll events, so a server that stalls silently (no TCP RST or FIN) is also detected.
382
382
383
383
HTTP request cancel #XHTTPCCANCEL
@@ -395,12 +395,12 @@ Syntax
395
395
396
396
::
397
397
398
-
AT#XHTTPCCANCEL=<socket_fd>
398
+
AT#XHTTPCCANCEL=<handle>
399
399
400
-
* The ``<socket_fd>`` parameter is an integer.
400
+
* The ``<handle>`` parameter is an integer.
401
401
It identifies the socket of the request to cancel.
402
402
403
-
An unsolicited ``#XHTTPCSTAT: <socket_fd>,-1,<total_bytes>`` notification is emitted after cancellation, where ``<total_bytes>`` is the number of response body bytes already delivered to the host.
403
+
An unsolicited ``#XHTTPCSTAT: <handle>,-1,<total_bytes>`` notification is emitted after cancellation, where ``<total_bytes>`` is the number of response body bytes already delivered to the host.
Copy file name to clipboardExpand all lines: doc/releases/migration_notes_ncs_slm_v3.1.x.rst
+93-1Lines changed: 93 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,6 +231,99 @@ Migration example:
231
231
AT#XRECV=2,0,0,10 // Receive data from socket handle 2 with mode 0, no flags, 10s timeout
232
232
AT#XCLOSE=1 // Close socket handle 1
233
233
234
+
HTTP client changes
235
+
-------------------
236
+
237
+
The HTTP client has been redesigned from a dedicated connection-oriented interface to a socket-based interface.
238
+
The old |NCS| SLM HTTP client kept its own HTTP connection state with ``AT#XHTTPCCON``, sent requests with ``AT#XHTTPCREQ``, and delivered the raw HTTP response stream followed by ``#XHTTPCRSP`` notifications.
239
+
In |SM|, the HTTP client reuses Socket AT commands for transport setup and provides dedicated HTTP AT commands for requests and notifications, including headers, body data, and completion status.
240
+
241
+
The following is the list of changes:
242
+
243
+
* Removed ``AT#XHTTPCCON``.
244
+
245
+
* Create a plain TCP socket with ``AT#XSOCKET`` or a TLS socket with ``AT#XSSOCKET``.
246
+
* Configure TLS options such as security tag and peer verification with ``AT#XSSOCKETOPT``.
247
+
* Establish the transport connection with ``AT#XCONNECT=<handle>,<host>,<port>``.
248
+
* Close the connection with ``AT#XCLOSE`` when no more requests are needed.
249
+
250
+
* Updated ``AT#XHTTPCREQ`` to operate on an already connected socket.
251
+
252
+
* Old syntax: ``AT#XHTTPCREQ=<method>,<resource>[,<headers>[,<content_type>,<content_length>[,<chunked_transfer>]]]``
253
+
* New syntax: ``AT#XHTTPCREQ=<handle>,<url>,<method>[,<auto_reception>[,<body_len>[,<header 1>[,<header 2>[...]]]]]``
254
+
255
+
* Changed request parameter model.
256
+
257
+
* ``<method>`` changed from a string such as ``"GET"`` or ``"POST"`` to an integer:
258
+
259
+
* ``0`` - GET
260
+
* ``1`` - POST
261
+
* ``2`` - PUT
262
+
* ``3`` - DELETE
263
+
* ``4`` - HEAD
264
+
265
+
* ``<resource>`` is replaced by a full ``<url>`` parameter.
266
+
* Optional headers are no longer passed as one CRLF-delimited string.
267
+
Each header is now passed as a separate optional parameter.
268
+
* For POST and PUT, the body upload length is given with ``<body_len>``.
269
+
The command then enters data mode and the host must send exactly that many bytes.
270
+
* For GET or HEAD requests with extra headers, set ``<body_len>`` to ``0`` as a placeholder before the header parameters.
271
+
272
+
* Changed response delivery model.
273
+
274
+
* Removed the old raw response plus ``#XHTTPCRSP: <received_byte_count>,<state>`` framing.
275
+
* Response headers are now reported with ``#XHTTPCHEAD: <handle>,<status_code>,<content_length>``.
276
+
* In automatic mode, response body chunks are reported with ``#XHTTPCDATA: <handle>,<offset>,<length>`` and the raw body bytes follow immediately.
277
+
* In manual mode, the host pulls body chunks explicitly with ``AT#XHTTPCDATA=<handle>[,<length>]``.
278
+
* Request completion including failure, timeout, or cancel is reported with ``#XHTTPCSTAT: <handle>,<status_code>,<total_bytes>``.
279
+
280
+
* Added request cancellation with ``AT#XHTTPCCANCEL=<handle>``.
0 commit comments