Part 1
요약·해설
TLS overlay, certificate·private key와 QEMU/Linux host 실행 순서를 보존합니다.
HTTP · HTTPS
TLS credentials
Board · QEMU
Part 2
접을 수 있는 영어 원문 전체
영어 원문 전체 펼치기
898E5E22AFB0185EC5062348BF5307397DD1F61EC2DA6ED43CBC89C66E974C1A
.. zephyr:code-sample:: sockets-http-client
:name: HTTP Client
:relevant-api: bsd_sockets http_client tls_credentials secure_sockets_options
Implement an HTTP(S) client that issues a variety of HTTP requests.
Overview
********
This sample application implements an HTTP(S) client that will do an HTTP
or HTTPS request and wait for the response from the HTTP server.
The source code for this sample application can be found at:
:zephyr_file:`samples/net/sockets/http_client`.
Requirements
************
- :ref:`networking_with_host`
Building and Running
********************
You can use this application on a supported board, including
running it inside QEMU as described in :ref:`networking_with_qemu`.
Build the http-client sample application like this:
.. zephyr-app-commands::
:zephyr-app: samples/net/sockets/http_client
:board: <board to use>
:conf: <config file to use>
:goals: build
:compact:
Enabling TLS support
====================
Enable TLS support in the sample by building the project with the
``overlay-tls.conf`` overlay file enabled using these commands:
.. zephyr-app-commands::
:zephyr-app: samples/net/sockets/http_client
:board: qemu_x86
:conf: "prj.conf overlay-tls.conf"
:goals: build
:compact:
An alternative way is to specify ``-DEXTRA_CONF_FILE=overlay-tls.conf`` when
running ``west build`` or ``cmake``.
The certificate and private key used by the sample can be found in the sample's
:zephyr_file:`samples/net/sockets/http_client/src/` directory.
The default certificates used by Socket HTTP Client and
``https-server.py`` program found in the
`net-tools <https://github.com/zephyrproject-rtos/net-tools>`_ project, enable
establishing a secure connection between the samples.
Running http-server in Linux Host
=================================
You can run this ``http-client`` sample application in QEMU
and run the ``http-server.py`` (from net-tools) on a Linux host.
To use QEMU for testing, follow the :ref:`networking_with_qemu` guide.
In a terminal window:
.. code-block:: console
$ ./http-server.py
Run ``http-client`` application in QEMU:
.. zephyr-app-commands::
:zephyr-app: samples/net/sockets/http_client
:host-os: unix
:board: qemu_x86
:conf: prj.conf
:goals: run
:compact:
Note that ``http-server.py`` must be running in the Linux host terminal window
before you start the http-client application in QEMU.
Exit QEMU by pressing :kbd:`CTRL+A` :kbd:`x`.
You can verify TLS communication with a Linux host as well. Just use the
``https-server.py`` program in net-tools project.
Part 3
한국어 전문 번역
개요
이 sample application은 HTTP 또는 HTTPS request를 보내고 HTTP server의 response를 기다리는 HTTP(S) client를 구현합니다.
이 sample application의 source code는 samples/net/sockets/http_client에서 찾을 수 있습니다.
요구 사항
빌드 및 실행
이 application은 지원되는 board에서 사용할 수 있으며, Networking with QEMU에서 설명하는 방식으로 QEMU 안에서도 실행할 수 있습니다.
HTTP client sample application의 일반 build 방법은 다음과 같습니다.
west build -b <board to use> samples/net/sockets/http_client -- -DCONF_FILE=<config file to use>
TLS 지원 활성화
overlay-tls.conf overlay file을 활성화해 project를 build하면 sample의 TLS 지원을 켤 수 있습니다.
west build -b qemu_x86 samples/net/sockets/http_client -- -DCONF_FILE="prj.conf overlay-tls.conf"
다른 방법으로 west build 또는 cmake를 실행할 때 -DEXTRA_CONF_FILE=overlay-tls.conf를 지정할 수 있습니다.
Sample이 사용하는 certificate와 private key는 samples/net/sockets/http_client/src/ directory에 있습니다. Socket HTTP Client와 net-tools project의 https-server.py가 기본으로 사용하는 certificate를 이용하면 두 sample 사이에 secure connection을 수립할 수 있습니다.
Linux Host에서 http-server 실행
QEMU에서 이 http-client sample application을 실행하고 Linux host에서는 net-tools의 http-server.py를 실행할 수 있습니다.
QEMU test 설정은 Networking with QEMU guide를 따릅니다.
Terminal window에서 다음 명령을 실행합니다.
$ ./http-server.py
그 다음 QEMU에서 http-client application을 실행합니다.
west build -b qemu_x86 samples/net/sockets/http_client -- -DCONF_FILE=prj.conf
west build -t run
QEMU에서 HTTP client application을 시작하기 전에 Linux host terminal window에서 http-server.py가 실행 중이어야 합니다. CTRL+A에 이어 x를 눌러 QEMU를 종료합니다.
Linux host와의 TLS communication도 검증할 수 있습니다. 이때는 net-tools project의 https-server.py program을 사용하면 됩니다.
Source
출처
영어 원문에는 문단, 문서 지시문, 표, 코드, 코드 심벌, 경로를 그대로 보존했습니다.