Docs on Nine Nines https://ninenines.eu/docs/ Recent content in Docs on Nine Nines Hugo -- gohugo.io en-us Installation https://ninenines.eu/docs/en/erlang.mk/1/guide/installation/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/installation/ On Unix Erlang.mk requires GNU Make to be installed. While it will currently work with GNU Make 3.81, support for this version is deprecated and will be removed in 2017. We recommend GNU Make 4.1 or later. Git and Erlang/OTP must also be installed. Some functionality requires that Autoconf 2.59 or later be installed, in order to compile Erlang/OTP. Erlang/OTP may have further requirements depending on your needs. Introduction https://ninenines.eu/docs/en/gun/1.0/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/introduction/ Gun is an Erlang HTTP client with support for HTTP/1.1, HTTP/2 and Websocket. Prerequisites Knowledge of Erlang, but also of the HTTP/1.1, HTTP/2 and Websocket protocols is required in order to read this guide. Supported platforms Gun is tested and supported on Linux. Gun is developed for Erlang 19+. Gun may be compiled on earlier Erlang versions with small source code modifications but there is no guarantee that it will work as intended. Introduction https://ninenines.eu/docs/en/ranch/1.2/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/introduction/ Ranch is a socket acceptor pool for TCP protocols. Ranch aims to provide everything you need to accept TCP connections with a small code base and low latency while being easy to use directly as an application or to embed into your own. Prerequisites It is assumed the developer already knows Erlang and has some experience with socket programming and TCP protocols. Supported platforms Ranch is tested and supported on Linux. Introduction https://ninenines.eu/docs/en/ranch/1.3/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/introduction/ Ranch is a socket acceptor pool for TCP protocols. Ranch aims to provide everything you need to accept TCP connections with a small code base and low latency while being easy to use directly as an application or to embed into your own. Prerequisites It is assumed the developer already knows Erlang and has some experience with socket programming and TCP protocols. Supported platforms Ranch is tested and supported on Linux, FreeBSD, OSX and Windows. Introduction https://ninenines.eu/docs/en/ranch/1.4/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/introduction/ Ranch is a socket acceptor pool for TCP protocols. Ranch aims to provide everything you need to accept TCP connections with a small code base and low latency while being easy to use directly as an application or to embed into your own. Prerequisites It is assumed the developer already knows Erlang and has some experience with socket programming and TCP protocols. Supported platforms Ranch is tested and supported on Linux, FreeBSD, OSX and Windows. The modern Web https://ninenines.eu/docs/en/cowboy/2.0/guide/modern_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/modern_web/ Cowboy is a server for the modern Web. This chapter explains what it means and details all the standards involved. Cowboy supports all the standards listed in this document. HTTP/2 HTTP/2 is the most efficient protocol for consuming Web services. It enables clients to keep a connection open for long periods of time; to send requests concurrently; to reduce the size of requests through HTTP headers compression; and more. The modern Web https://ninenines.eu/docs/en/cowboy/2.1/guide/modern_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/modern_web/ Cowboy is a server for the modern Web. This chapter explains what it means and details all the standards involved. Cowboy supports all the standards listed in this document. HTTP/2 HTTP/2 is the most efficient protocol for consuming Web services. It enables clients to keep a connection open for long periods of time; to send requests concurrently; to reduce the size of requests through HTTP headers compression; and more. The modern Web https://ninenines.eu/docs/en/cowboy/2.2/guide/modern_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/modern_web/ Cowboy is a server for the modern Web. This chapter explains what it means and details all the standards involved. Cowboy supports all the standards listed in this document. HTTP/2 HTTP/2 is the most efficient protocol for consuming Web services. It enables clients to keep a connection open for long periods of time; to send requests concurrently; to reduce the size of requests through HTTP headers compression; and more. The modern Web https://ninenines.eu/docs/en/cowboy/2.3/guide/modern_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/modern_web/ Cowboy is a server for the modern Web. This chapter explains what it means and details all the standards involved. Cowboy supports all the standards listed in this document. HTTP/2 HTTP/2 is the most efficient protocol for consuming Web services. It enables clients to keep a connection open for long periods of time; to send requests concurrently; to reduce the size of requests through HTTP headers compression; and more. Erlang and the Web https://ninenines.eu/docs/en/cowboy/2.0/guide/erlang_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/erlang_web/ Erlang is the ideal platform for writing Web applications. Its features are a perfect match for the requirements of modern Web applications. The Web is concurrent When you access a website there is little concurrency involved. A few connections are opened and requests are sent through these connections. Then the web page is displayed on your screen. Your browser will only open up to 4 or 8 connections to the server, depending on your settings. Erlang and the Web https://ninenines.eu/docs/en/cowboy/2.1/guide/erlang_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/erlang_web/ Erlang is the ideal platform for writing Web applications. Its features are a perfect match for the requirements of modern Web applications. The Web is concurrent When you access a website there is little concurrency involved. A few connections are opened and requests are sent through these connections. Then the web page is displayed on your screen. Your browser will only open up to 4 or 8 connections to the server, depending on your settings. Erlang and the Web https://ninenines.eu/docs/en/cowboy/2.2/guide/erlang_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/erlang_web/ Erlang is the ideal platform for writing Web applications. Its features are a perfect match for the requirements of modern Web applications. The Web is concurrent When you access a website there is little concurrency involved. A few connections are opened and requests are sent through these connections. Then the web page is displayed on your screen. Your browser will only open up to 4 or 8 connections to the server, depending on your settings. Erlang and the Web https://ninenines.eu/docs/en/cowboy/2.3/guide/erlang_web/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/erlang_web/ Erlang is the ideal platform for writing Web applications. Its features are a perfect match for the requirements of modern Web applications. The Web is concurrent When you access a website there is little concurrency involved. A few connections are opened and requests are sent through these connections. Then the web page is displayed on your screen. Your browser will only open up to 4 or 8 connections to the server, depending on your settings. Getting started https://ninenines.eu/docs/en/erlang.mk/1/guide/getting_started/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/getting_started/ This chapter explains how to get started using Erlang.mk. Creating a folder for your project The first step is always to create a new folder that will contain your project. $ mkdir hello_joe $ cd hello_joe Most people tend to put all their projects side by side in a common folder. We recommend keeping an organization similar to your remote repositories. For example, for GitHub users, put all your projects in a common folder with the same name as your username. Listeners https://ninenines.eu/docs/en/ranch/1.2/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/listeners/ A listener is a set of processes whose role is to listen on a port for new connections. It manages a pool of acceptor processes, each of them indefinitely accepting connections. When it does, it starts a new process executing the protocol handler code. All the socket programming is abstracted through the user of transport handlers. The listener takes care of supervising all the acceptor and connection processes, allowing developers to focus on building their application. Listeners https://ninenines.eu/docs/en/ranch/1.3/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/listeners/ A listener is a set of processes whose role is to listen on a port for new connections. It manages a pool of acceptor processes, each of them indefinitely accepting connections. When it does, it starts a new process executing the protocol handler code. All the socket programming is abstracted through the use of transport handlers. The listener takes care of supervising all the acceptor and connection processes, allowing developers to focus on building their application. Listeners https://ninenines.eu/docs/en/ranch/1.4/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/listeners/ A listener is a set of processes whose role is to listen on a port for new connections. It manages a pool of acceptor processes, each of them indefinitely accepting connections. When it does, it starts a new process executing the protocol handler code. All the socket programming is abstracted through the use of transport handlers. The listener takes care of supervising all the acceptor and connection processes, allowing developers to focus on building their application. Starting and stopping https://ninenines.eu/docs/en/gun/1.0/guide/start/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/start/ This chapter describes how to start and stop the Gun application. Setting up Before Gun can be used it needs to be in Erlang’s ERL_LIBS path variable. If you use erlang.mk or a similar build tool, you only need to specify Gun as a dependency to your application and the tool will take care of downloading Gun and setting up paths. With erlang.mk this is done by adding gun to the DEPS variable in your Makefile. Supported protocols https://ninenines.eu/docs/en/gun/1.0/guide/protocols/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/protocols/ This chapter describes the protocols supported and the operations available to them. HTTP/1.1 HTTP/1.1 is a text request-response protocol. The client sends a request, the server sends back a response. Gun provides convenience functions for performing GET, HEAD, OPTIONS, POST, PATCH, PUT, and DELETE requests. All these functions are aliases of gun:request/{4,5,6} for each respective methods. Gun also provides a gun:data/4 function for streaming the request body. Gun will send a gun_response message for every response received, followed by zero or more gun_data messages for the response body. Introduction https://ninenines.eu/docs/en/cowboy/2.0/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/introduction/ Cowboy is a small, fast and modern HTTP server for Erlang/OTP. Cowboy aims to provide a complete modern Web stack. This includes HTTP/1.1, HTTP/2, Websocket, Server-Sent Events and Webmachine-based REST. Cowboy comes with functions for introspection and tracing, enabling developers to know precisely what is happening at any time. Its modular design also easily enable developers to add instrumentation. Cowboy is a high quality project. It has a small code base, is very efficient (both in latency and memory use) and can easily be embedded in another application. Introduction https://ninenines.eu/docs/en/cowboy/2.1/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/introduction/ Cowboy is a small, fast and modern HTTP server for Erlang/OTP. Cowboy aims to provide a complete modern Web stack. This includes HTTP/1.1, HTTP/2, Websocket, Server-Sent Events and Webmachine-based REST. Cowboy comes with functions for introspection and tracing, enabling developers to know precisely what is happening at any time. Its modular design also easily enable developers to add instrumentation. Cowboy is a high quality project. It has a small code base, is very efficient (both in latency and memory use) and can easily be embedded in another application. Introduction https://ninenines.eu/docs/en/cowboy/2.2/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/introduction/ Cowboy is a small, fast and modern HTTP server for Erlang/OTP. Cowboy aims to provide a complete modern Web stack. This includes HTTP/1.1, HTTP/2, Websocket, Server-Sent Events and Webmachine-based REST. Cowboy comes with functions for introspection and tracing, enabling developers to know precisely what is happening at any time. Its modular design also easily enable developers to add instrumentation. Cowboy is a high quality project. It has a small code base, is very efficient (both in latency and memory use) and can easily be embedded in another application. Introduction https://ninenines.eu/docs/en/cowboy/2.3/guide/introduction/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/introduction/ Cowboy is a small, fast and modern HTTP server for Erlang/OTP. Cowboy aims to provide a complete modern Web stack. This includes HTTP/1.1, HTTP/2, Websocket, Server-Sent Events and Webmachine-based REST. Cowboy comes with functions for introspection and tracing, enabling developers to know precisely what is happening at any time. Its modular design also easily enable developers to add instrumentation. Cowboy is a high quality project. It has a small code base, is very efficient (both in latency and memory use) and can easily be embedded in another application. Transports https://ninenines.eu/docs/en/ranch/1.2/guide/transports/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/transports/ A transport defines the interface to interact with a socket. Transports can be used for connecting, listening and accepting connections, but also for receiving and sending data. Both passive and active mode are supported, although all sockets are initialized as passive. TCP transport The TCP transport is a thin wrapper around gen_tcp. SSL transport The SSL transport is a thin wrapper around ssl. It requires the crypto, asn1, public_key and ssl applications to be started. Transports https://ninenines.eu/docs/en/ranch/1.3/guide/transports/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/transports/ A transport defines the interface to interact with a socket. Transports can be used for connecting, listening and accepting connections, but also for receiving and sending data. Both passive and active mode are supported, although all sockets are initialized as passive. TCP transport The TCP transport is a thin wrapper around gen_tcp. SSL transport The SSL transport is a thin wrapper around ssl. Ranch depends on ssl by default so any necessary dependencies will start when Ranch is started. Transports https://ninenines.eu/docs/en/ranch/1.4/guide/transports/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/transports/ A transport defines the interface to interact with a socket. Transports can be used for connecting, listening and accepting connections, but also for receiving and sending data. Both passive and active mode are supported, although all sockets are initialized as passive. TCP transport The TCP transport is a thin wrapper around gen_tcp. SSL transport The SSL transport is a thin wrapper around ssl. Ranch depends on ssl by default so any necessary dependencies will start when Ranch is started. Overview https://ninenines.eu/docs/en/erlang.mk/1/guide/overview/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/overview/ Now that you know how to get started, let’s take a look at what Erlang.mk can do for you. Building your project Erlang.mk is first and foremost a build tool. It is especially tailored for Erlang developers and follows widely accepted practices in the Erlang community. Erlang.mk will happily build all Erlang-specific files you throw at it. Other kinds of files too, like C or C++ code when you are working on a NIF or a port driver. Connection https://ninenines.eu/docs/en/gun/1.0/guide/connect/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/connect/ This chapter describes how to open, monitor and close a connection using the Gun client. Gun connections Gun is designed with the HTTP/2 and Websocket protocols in mind. They are built for long-running connections that allow concurrent exchange of data, either in the form of request/responses for HTTP/2 or in the form of messages for Websocket. A Gun connection is an Erlang process that manages a socket to a remote endpoint. Protocols https://ninenines.eu/docs/en/ranch/1.2/guide/protocols/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/protocols/ A protocol handler starts a connection process and defines the protocol logic executed in this process. Writing a protocol handler All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/4. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to ranch:start_listener/6. Protocols https://ninenines.eu/docs/en/ranch/1.3/guide/protocols/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/protocols/ A protocol handler starts a connection process and defines the protocol logic executed in this process. Writing a protocol handler All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/4. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to ranch:start_listener/6. Protocols https://ninenines.eu/docs/en/ranch/1.4/guide/protocols/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/protocols/ A protocol handler starts a connection process and defines the protocol logic executed in this process. Writing a protocol handler All protocol handlers must implement the ranch_protocol behavior which defines a single callback, start_link/4. This callback is responsible for spawning a new process for handling the connection. It receives four arguments: the name of the listener, the socket, the transport handler being used and the protocol options defined in the call to ranch:start_listener/5. Getting started https://ninenines.eu/docs/en/cowboy/2.0/guide/getting_started/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/getting_started/ Erlang is more than a language, it is also an operating system for your applications. Erlang developers rarely write standalone modules, they write libraries or applications, and then bundle those into what is called a release. A release contains the Erlang VM plus all applications required to run the node, so it can be pushed to production directly. This chapter walks you through all the steps of setting up Cowboy, writing your first application and generating your first release. Getting started https://ninenines.eu/docs/en/cowboy/2.1/guide/getting_started/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/getting_started/ Erlang is more than a language, it is also an operating system for your applications. Erlang developers rarely write standalone modules, they write libraries or applications, and then bundle those into what is called a release. A release contains the Erlang VM plus all applications required to run the node, so it can be pushed to production directly. This chapter walks you through all the steps of setting up Cowboy, writing your first application and generating your first release. Getting started https://ninenines.eu/docs/en/cowboy/2.2/guide/getting_started/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/getting_started/ Erlang is more than a language, it is also an operating system for your applications. Erlang developers rarely write standalone modules, they write libraries or applications, and then bundle those into what is called a release. A release contains the Erlang VM plus all applications required to run the node, so it can be pushed to production directly. This chapter walks you through all the steps of setting up Cowboy, writing your first application and generating your first release. Getting started https://ninenines.eu/docs/en/cowboy/2.3/guide/getting_started/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/getting_started/ Erlang is more than a language, it is also an operating system for your applications. Erlang developers rarely write standalone modules, they write libraries or applications, and then bundle those into what is called a release. A release contains the Erlang VM plus all applications required to run the node, so it can be pushed to production directly. This chapter walks you through all the steps of setting up Cowboy, writing your first application and generating your first release. Updating Erlang.mk https://ninenines.eu/docs/en/erlang.mk/1/guide/updating/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/updating/ This chapter describes how to update the erlang.mk file in your repository. Initial bootstrap The first time you use Erlang.mk, it will bootstrap itself. It always uses the most recent version for this, so you don’t have to update after creating your project. Updating Later on though, updating becomes a necessity. Erlang.mk developers and contributors relentlessly improve the project and add new features; it would be a waste not to benefit from this. HTTP https://ninenines.eu/docs/en/gun/1.0/guide/http/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/http/ This chapter describes how to use the Gun client for communicating with an HTTP/1.1 or HTTP/2 server. Streams Every time a request is initiated, Gun creates a stream. A stream reference uniquely identifies a set of request and response(s) and must be used to perform additional operations with a stream or to identify its messages. Stream references use the Erlang reference data type and are therefore unique. Streams can be canceled at any time. Embedded mode https://ninenines.eu/docs/en/ranch/1.2/guide/embedded/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/embedded/ Embedded mode allows you to insert Ranch listeners directly in your supervision tree. This allows for greater fault tolerance control by permitting the shutdown of a listener due to the failure of another part of the application and vice versa. Embedding To embed Ranch in your application you can simply add the child specs to your supervision tree. This can all be done in the init/1 function of one of your application supervisors. Embedded mode https://ninenines.eu/docs/en/ranch/1.3/guide/embedded/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/embedded/ Embedded mode allows you to insert Ranch listeners directly in your supervision tree. This allows for greater fault tolerance control by permitting the shutdown of a listener due to the failure of another part of the application and vice versa. Embedding To embed Ranch in your application you can simply add the child specs to your supervision tree. This can all be done in the init/1 function of one of your application supervisors. Embedded mode https://ninenines.eu/docs/en/ranch/1.4/guide/embedded/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/embedded/ Embedded mode allows you to insert Ranch listeners directly in your supervision tree. This allows for greater fault tolerance control by permitting the shutdown of a listener due to the failure of another part of the application and vice versa. Embedding To embed Ranch in your application you can simply add the child specs to your supervision tree. This can all be done in the init/1 function of one of your application supervisors. Limitations https://ninenines.eu/docs/en/erlang.mk/1/guide/limitations/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/limitations/ No software is perfect. It’s very important, when evaluating and when using a tool, to understand its limitations, so as to avoid making mistakes and wasting valuable time. This chapter lists all known limitations of Erlang.mk. Erlang must be available Currently Erlang.mk requires you to install Erlang beforehand. Installing Erlang is not always easy, particularly if you need a specific version of Erlang for a specific project. Flow diagram https://ninenines.eu/docs/en/cowboy/2.0/guide/flow_diagram/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/flow_diagram/ Cowboy is a lightweight HTTP server with support for HTTP/1.1, HTTP/2 and Websocket. It is built on top of Ranch. Please see the Ranch guide for more information about how the network connections are handled. Overview As you can see on the diagram, the client begins by connecting to the server. This step is handled by a Ranch acceptor, which is a process dedicated to accepting new connections. Flow diagram https://ninenines.eu/docs/en/cowboy/2.1/guide/flow_diagram/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/flow_diagram/ Cowboy is a lightweight HTTP server with support for HTTP/1.1, HTTP/2 and Websocket. It is built on top of Ranch. Please see the Ranch guide for more information about how the network connections are handled. Overview As you can see on the diagram, the client begins by connecting to the server. This step is handled by a Ranch acceptor, which is a process dedicated to accepting new connections. Flow diagram https://ninenines.eu/docs/en/cowboy/2.2/guide/flow_diagram/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/flow_diagram/ Cowboy is a lightweight HTTP server with support for HTTP/1.1, HTTP/2 and Websocket. It is built on top of Ranch. Please see the Ranch guide for more information about how the network connections are handled. Overview As you can see on the diagram, the client begins by connecting to the server. This step is handled by a Ranch acceptor, which is a process dedicated to accepting new connections. Flow diagram https://ninenines.eu/docs/en/cowboy/2.3/guide/flow_diagram/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/flow_diagram/ Cowboy is a lightweight HTTP server with support for HTTP/1.1, HTTP/2 and Websocket. It is built on top of Ranch. Please see the Ranch guide for more information about how the network connections are handled. Overview As you can see on the diagram, the client begins by connecting to the server. This step is handled by a Ranch acceptor, which is a process dedicated to accepting new connections. Websocket https://ninenines.eu/docs/en/gun/1.0/guide/websocket/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/websocket/ This chapter describes how to use the Gun client for communicating with a Websocket server. @todo recovering from connection failure reconnecting to Websocket etc. HTTP upgrade Websocket is a protocol built on top of HTTP. To use Websocket, you must first request for the connection to be upgraded. Only HTTP/1.1 connections can be upgraded to Websocket, so you might need to restrict the protocol to HTTP/1.1 if you are planning to use Websocket over TLS. Writing parsers https://ninenines.eu/docs/en/ranch/1.2/guide/parsers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/parsers/ There are three kinds of protocols: Text protocols Schema-less binary protocols Schema-based binary protocols This chapter introduces the first two kinds. It will not cover more advanced topics such as continuations or parser generators. This chapter isn’t specifically about Ranch, we assume here that you know how to read data from the socket. The data you read and the data that hasn’t been parsed is saved in a buffer. Writing parsers https://ninenines.eu/docs/en/ranch/1.3/guide/parsers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/parsers/ There are three kinds of protocols: Text protocols Schema-less binary protocols Schema-based binary protocols This chapter introduces the first two kinds. It will not cover more advanced topics such as continuations or parser generators. This chapter isn’t specifically about Ranch, we assume here that you know how to read data from the socket. The data you read and the data that hasn’t been parsed is saved in a buffer. Writing parsers https://ninenines.eu/docs/en/ranch/1.4/guide/parsers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/parsers/ There are three kinds of protocols: Text protocols Schema-less binary protocols Schema-based binary protocols This chapter introduces the first two kinds. It will not cover more advanced topics such as continuations or parser generators. This chapter isn’t specifically about Ranch, we assume here that you know how to read data from the socket. The data you read and the data that hasn’t been parsed is saved in a buffer. Building https://ninenines.eu/docs/en/erlang.mk/1/guide/app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/app/ Erlang.mk can do a lot of things, but it is, first and foremost, a build tool. In this chapter we will cover the basics of building a project with Erlang.mk. For most of this chapter, we will assume that you are using a project generated by Erlang.mk. How to build To build a project, all you have to do is type make: $ make It will work regardless of your project: OTP applications, library applications, NIFs, port drivers or even releases. Listeners https://ninenines.eu/docs/en/cowboy/2.0/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/listeners/ A listener is a set of processes that listens on a port for new connections. Incoming connections get handled by Cowboy. Depending on the connection handshake, one or another protocol may be used. This chapter is specific to Cowboy. Please refer to the Ranch User Guide for more information about listeners. Cowboy provides two types of listeners: one listening for clear TCP connections, and one listening for secure TLS connections. Listeners https://ninenines.eu/docs/en/cowboy/2.1/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/listeners/ A listener is a set of processes that listens on a port for new connections. Incoming connections get handled by Cowboy. Depending on the connection handshake, one or another protocol may be used. This chapter is specific to Cowboy. Please refer to the Ranch User Guide for more information about listeners. Cowboy provides two types of listeners: one listening for clear TCP connections, and one listening for secure TLS connections. Listeners https://ninenines.eu/docs/en/cowboy/2.2/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/listeners/ A listener is a set of processes that listens on a port for new connections. Incoming connections get handled by Cowboy. Depending on the connection handshake, one or another protocol may be used. This chapter is specific to Cowboy. Please refer to the Ranch User Guide for more information about listeners. Cowboy provides two types of listeners: one listening for clear TCP connections, and one listening for secure TLS connections. Listeners https://ninenines.eu/docs/en/cowboy/2.3/guide/listeners/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/listeners/ A listener is a set of processes that listens on a port for new connections. Incoming connections get handled by Cowboy. Depending on the connection handshake, one or another protocol may be used. This chapter is specific to Cowboy. Please refer to the Ranch User Guide for more information about listeners. Cowboy provides two types of listeners: one listening for clear TCP connections, and one listening for secure TLS connections. SSL client authentication https://ninenines.eu/docs/en/ranch/1.2/guide/ssl_auth/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/ssl_auth/ Purpose SSL client authentication is a mechanism allowing applications to identify certificates. This allows your application to make sure that the client is an authorized certificate, but makes no claim about whether the user can be trusted. This can be combined with a password based authentication to attain greater security. The server only needs to retain the certificate serial number and the certificate issuer to authenticate the certificate. Together, they can be used to uniquely identify a certicate. SSL client authentication https://ninenines.eu/docs/en/ranch/1.3/guide/ssl_auth/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/ssl_auth/ Purpose SSL client authentication is a mechanism allowing applications to identify certificates. This allows your application to make sure that the client is an authorized certificate, but makes no claim about whether the user can be trusted. This can be combined with a password based authentication to attain greater security. The server only needs to retain the certificate serial number and the certificate issuer to authenticate the certificate. Together, they can be used to uniquely identify a certicate. SSL client authentication https://ninenines.eu/docs/en/ranch/1.4/guide/ssl_auth/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/ssl_auth/ Purpose SSL client authentication is a mechanism allowing applications to identify certificates. This allows your application to make sure that the client is an authorized certificate, but makes no claim about whether the user can be trusted. This can be combined with a password based authentication to attain greater security. The server only needs to retain the certificate serial number and the certificate issuer to authenticate the certificate. Together, they can be used to uniquely identify a certicate. Packages and dependencies https://ninenines.eu/docs/en/erlang.mk/1/guide/deps/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/deps/ Erlang.mk can fetch and compile the dependencies that your project requires. Erlang.mk improves upon the concepts introduced by Rebar, so they should be familiar to many seasoned Erlang developers. Erlang.mk is not a package manager, nor is it trying to be, but it does include an index of Erlang packages to make discovering useful projects easier. This chapter will explain how to use packages, add dependencies to your project or bundle them directly in a single repository. Routing https://ninenines.eu/docs/en/cowboy/2.0/guide/routing/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/routing/ Cowboy does nothing by default. To make Cowboy useful, you need to map URIs to Erlang modules that will handle the requests. This is called routing. When Cowboy receives a request, it tries to match the requested host and path to the configured routes. When there’s a match, the route’s associated handler is executed. Routes need to be compiled before they can be used by Cowboy. The result of the compilation is the dispatch rules. Routing https://ninenines.eu/docs/en/cowboy/2.1/guide/routing/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/routing/ Cowboy does nothing by default. To make Cowboy useful, you need to map URIs to Erlang modules that will handle the requests. This is called routing. When Cowboy receives a request, it tries to match the requested host and path to the configured routes. When there’s a match, the route’s associated handler is executed. Routes need to be compiled before they can be used by Cowboy. The result of the compilation is the dispatch rules. Routing https://ninenines.eu/docs/en/cowboy/2.2/guide/routing/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/routing/ Cowboy does nothing by default. To make Cowboy useful, you need to map URIs to Erlang modules that will handle the requests. This is called routing. When Cowboy receives a request, it tries to match the requested host and path to the configured routes. When there’s a match, the route’s associated handler is executed. Routes need to be compiled before they can be used by Cowboy. The result of the compilation is the dispatch rules. Routing https://ninenines.eu/docs/en/cowboy/2.3/guide/routing/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/routing/ Cowboy does nothing by default. To make Cowboy useful, you need to map URIs to Erlang modules that will handle the requests. This is called routing. When Cowboy receives a request, it tries to match the requested host and path to the configured routes. When there’s a match, the route’s associated handler is executed. Routes need to be compiled before they can be used by Cowboy. The result of the compilation is the dispatch rules. NIFs and port drivers https://ninenines.eu/docs/en/erlang.mk/1/guide/ports/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/ports/ Erlang.mk can not only build Erlang projects, but also the C code that some projects come with, like NIFs and port drivers. There are two ways to build the C code: using a custom Makefile, or making Erlang.mk do it directly. The C code will be built as needed when you run make. C source code location and Erlang environment The C source code should be located in the $(C_SRC_DIR) directory. Internals https://ninenines.eu/docs/en/ranch/1.2/guide/internals/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/internals/ This chapter may not apply to embedded Ranch as embedding allows you to use an architecture specific to your application, which may or may not be compatible with the description of the Ranch application. Note that for everything related to efficiency and performance, you should perform the benchmarks yourself to get the numbers that matter to you. Generic benchmarks found on the web may or may not be of use to you, you can never know until you benchmark your own system. Internals https://ninenines.eu/docs/en/ranch/1.3/guide/internals/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/internals/ This chapter may not apply to embedded Ranch as embedding allows you to use an architecture specific to your application, which may or may not be compatible with the description of the Ranch application. Note that for everything related to efficiency and performance, you should perform the benchmarks yourself to get the numbers that matter to you. Generic benchmarks found on the web may or may not be of use to you, you can never know until you benchmark your own system. Internals https://ninenines.eu/docs/en/ranch/1.4/guide/internals/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/internals/ This chapter may not apply to embedded Ranch as embedding allows you to use an architecture specific to your application, which may or may not be compatible with the description of the Ranch application. Note that for everything related to efficiency and performance, you should perform the benchmarks yourself to get the numbers that matter to you. Generic benchmarks found on the web may or may not be of use to you, you can never know until you benchmark your own system. Constraints https://ninenines.eu/docs/en/cowboy/2.0/guide/constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/constraints/ Constraints are validation and conversion functions applied to user input. They are used in various places in Cowboy, including the router and the cowboy_req match functions. Syntax Constraints are provided as a list of fields. For each field in the list, specific constraints can be applied, as well as a default value if the field is missing. A field can take the form of an atom field, a tuple with constraints {field, Constraints} or a tuple with constraints and a default value {field, Constraints, Default}. Constraints https://ninenines.eu/docs/en/cowboy/2.1/guide/constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/constraints/ Constraints are validation and conversion functions applied to user input. They are used in various places in Cowboy, including the router and the cowboy_req match functions. Syntax Constraints are provided as a list of fields. For each field in the list, specific constraints can be applied, as well as a default value if the field is missing. A field can take the form of an atom field, a tuple with constraints {field, Constraints} or a tuple with constraints and a default value {field, Constraints, Default}. Constraints https://ninenines.eu/docs/en/cowboy/2.2/guide/constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/constraints/ Constraints are validation and conversion functions applied to user input. They are used in various places in Cowboy, including the router and the cowboy_req match functions. Syntax Constraints are provided as a list of fields. For each field in the list, specific constraints can be applied, as well as a default value if the field is missing. A field can take the form of an atom field, a tuple with constraints {field, Constraints} or a tuple with constraints and a default value {field, Constraints, Default}. Constraints https://ninenines.eu/docs/en/cowboy/2.3/guide/constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/constraints/ Constraints are validation and conversion functions applied to user input. They are used in various places in Cowboy, including the router and the cowboy_req match functions. Syntax Constraints are provided as a list of fields. For each field in the list, specific constraints can be applied, as well as a default value if the field is missing. A field can take the form of an atom field, a tuple with constraints {field, Constraints} or a tuple with constraints and a default value {field, Constraints, Default}. Releases https://ninenines.eu/docs/en/erlang.mk/1/guide/releases/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/releases/ Erlang.mk relies on Relx for generating releases. This chapter covers the Erlang.mk-specific bits. Consult the Relx website for more information. Setup Erlang.mk will create a release if it detects a Relx configuration file in the $(RELX_CONFIG) location. This defaults to $(CURDIR)/relx.config. You can override it by defining the variable before including Erlang.mk: RELX_CONFIG = $(CURDIR)/webchat.config Relx does not need to be installed. Erlang.mk will download and build it automatically. Self-extracting releases https://ninenines.eu/docs/en/erlang.mk/1/guide/sfx/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/sfx/ Erlang.mk allows you to package Relx releases as self-extracting archives. These archives contain all the files in the release and come in the form of a script that will extract and run the release automatically. This allows you to package the release as a single file that can then be executed. This feature is currently experimental. Feedback is much appreciated. Generating the self-extracting archive To generate a self-extracting release, all you need to do is pass the SFX=1 variable to Make when you build the release: Handlers https://ninenines.eu/docs/en/cowboy/2.0/guide/handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/handlers/ Handlers are Erlang modules that handle HTTP requests. Plain HTTP handlers The most basic handler in Cowboy implements the mandatory init/2 callback, manipulates the request, optionally sends a response and then returns. This callback receives the Req object and the initial state defined in the router configuration. A handler that does nothing would look like this: init(Req, State) -> {ok, Req, State}. Despite sending no reply, a 204 No Content response will be sent to the client, as Cowboy makes sure that a response is sent for every request. Handlers https://ninenines.eu/docs/en/cowboy/2.1/guide/handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/handlers/ Handlers are Erlang modules that handle HTTP requests. Plain HTTP handlers The most basic handler in Cowboy implements the mandatory init/2 callback, manipulates the request, optionally sends a response and then returns. This callback receives the Req object and the initial state defined in the router configuration. A handler that does nothing would look like this: init(Req, State) -> {ok, Req, State}. Despite sending no reply, a 204 No Content response will be sent to the client, as Cowboy makes sure that a response is sent for every request. Handlers https://ninenines.eu/docs/en/cowboy/2.2/guide/handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/handlers/ Handlers are Erlang modules that handle HTTP requests. Plain HTTP handlers The most basic handler in Cowboy implements the mandatory init/2 callback, manipulates the request, optionally sends a response and then returns. This callback receives the Req object and the initial state defined in the router configuration. A handler that does nothing would look like this: init(Req, State) -> {ok, Req, State}. Despite sending no reply, a 204 No Content response will be sent to the client, as Cowboy makes sure that a response is sent for every request. Handlers https://ninenines.eu/docs/en/cowboy/2.3/guide/handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/handlers/ Handlers are Erlang modules that handle HTTP requests. Plain HTTP handlers The most basic handler in Cowboy implements the mandatory init/2 callback, manipulates the request, optionally sends a response and then returns. This callback receives the Req object and the initial state defined in the router configuration. A handler that does nothing would look like this: init(Req, State) -> {ok, Req, State}. Despite sending no reply, a 204 No Content response will be sent to the client, as Cowboy makes sure that a response is sent for every request. Escripts https://ninenines.eu/docs/en/erlang.mk/1/guide/escripts/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/escripts/ Escripts are an alternative to release. They are meant to be used for small command line executables written in Erlang. They are not self-contained, unlike releases. Erlang must be installed for them to run. This however means that they are fairly small compared to releases. For self-contained executables, check self-extracting releases. Requirements Erlang.mk uses p7zip by default to generate the escript archive. Make sure it is installed. On most systems the package is named p7zip; on Ubuntu you need p7zip-full. Loop handlers https://ninenines.eu/docs/en/cowboy/2.0/guide/loop_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/loop_handlers/ Loop handlers are a special kind of HTTP handlers used when the response can not be sent right away. The handler enters instead a receive loop waiting for the right message before it can send a response. Loop handlers are used for requests where a response might not be immediately available, but where you would like to keep the connection open for a while in case the response arrives. The most known example of such practice is known as long polling. Loop handlers https://ninenines.eu/docs/en/cowboy/2.1/guide/loop_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/loop_handlers/ Loop handlers are a special kind of HTTP handlers used when the response can not be sent right away. The handler enters instead a receive loop waiting for the right message before it can send a response. Loop handlers are used for requests where a response might not be immediately available, but where you would like to keep the connection open for a while in case the response arrives. The most known example of such practice is known as long polling. Loop handlers https://ninenines.eu/docs/en/cowboy/2.2/guide/loop_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/loop_handlers/ Loop handlers are a special kind of HTTP handlers used when the response can not be sent right away. The handler enters instead a receive loop waiting for the right message before it can send a response. Loop handlers are used for requests where a response might not be immediately available, but where you would like to keep the connection open for a while in case the response arrives. The most known example of such practice is known as long polling. Loop handlers https://ninenines.eu/docs/en/cowboy/2.3/guide/loop_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/loop_handlers/ Loop handlers are a special kind of HTTP handlers used when the response can not be sent right away. The handler enters instead a receive loop waiting for the right message before it can send a response. Loop handlers are used for requests where a response might not be immediately available, but where you would like to keep the connection open for a while in case the response arrives. The most known example of such practice is known as long polling. OTP version management https://ninenines.eu/docs/en/erlang.mk/1/guide/kerl/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/kerl/ Erlang.mk comes with integrated support for Kerl, a shell script that automates the downloading, building and installing of Erlang/OTP. It can be used to easily build a specific Erlang/OTP version (with or without custom build options) or maintain different versions side by side. Erlang versions Erlang.mk uses the Git tags from Erlang/OTP to identify OTP versions. The most recent tag at the time of writing is OTP-20.0.4, which is a patch release of OTP-20. Static files https://ninenines.eu/docs/en/cowboy/2.0/guide/static_files/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/static_files/ Cowboy comes with a ready to use handler for serving static files. It is provided as a convenience for serving files during development. For systems in production, consider using one of the many Content Distribution Network (CDN) available on the market, as they are the best solution for serving files. The static handler can serve either one file or all files from a given directory. The etag generation and mime types can be configured. Static files https://ninenines.eu/docs/en/cowboy/2.1/guide/static_files/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/static_files/ Cowboy comes with a ready to use handler for serving static files. It is provided as a convenience for serving files during development. For systems in production, consider using one of the many Content Distribution Network (CDN) available on the market, as they are the best solution for serving files. The static handler can serve either one file or all files from a given directory. The etag generation and mime types can be configured. Static files https://ninenines.eu/docs/en/cowboy/2.2/guide/static_files/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/static_files/ Cowboy comes with a ready to use handler for serving static files. It is provided as a convenience for serving files during development. For systems in production, consider using one of the many Content Distribution Network (CDN) available on the market, as they are the best solution for serving files. The static handler can serve either one file or all files from a given directory. The etag generation and mime types can be configured. Static files https://ninenines.eu/docs/en/cowboy/2.3/guide/static_files/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/static_files/ Cowboy comes with a ready to use handler for serving static files. It is provided as a convenience for serving files during development. For systems in production, consider using one of the many Content Distribution Network (CDN) available on the market, as they are the best solution for serving files. The static handler can serve either one file or all files from a given directory. The etag generation and mime types can be configured. Compatibility with other build tools https://ninenines.eu/docs/en/erlang.mk/1/guide/compat/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/compat/ Erlang.mk tries its best to be compatible with the other Erlang build tools. It can use dependencies written with other build tools in mind, and can also make your projects usable by those build tools as well. Erlang.mk is like the cool kid that gets along with everybody. In this chapter I will use the term Rebar project to refer to a project built using Rebar 2, Rebar 3 or Mad. AsciiDoc documentation https://ninenines.eu/docs/en/erlang.mk/1/guide/asciidoc/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/asciidoc/ Erlang.mk provides rules for generating documentation from AsciiDoc files. It can automatically build a user guide PDF, chunked HTML documentation and Unix manual pages. Requirements It is necessary to have AsciiDoc, xsltproc and dblatex installed on your system for Erlang.mk to generate documentation from AsciiDoc sources. Writing AsciiDoc documentation AsciiDoc is a text document format for writing notes, documentation, articles, books, ebooks, slideshows, web pages, man pages and blogs. The Req object https://ninenines.eu/docs/en/cowboy/2.0/guide/req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/req/ The Req object is a variable used for obtaining information about a request, read its body or send a response. It is not really an object in the object-oriented sense. It is a simple map that can be directly accessed or used when calling functions from the cowboy_req module. The Req object is the subject of a few different chapters. In this chapter we will learn about the Req object and look at how to retrieve information about the request. The Req object https://ninenines.eu/docs/en/cowboy/2.1/guide/req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/req/ The Req object is a variable used for obtaining information about a request, read its body or send a response. It is not really an object in the object-oriented sense. It is a simple map that can be directly accessed or used when calling functions from the cowboy_req module. The Req object is the subject of a few different chapters. In this chapter we will learn about the Req object and look at how to retrieve information about the request. The Req object https://ninenines.eu/docs/en/cowboy/2.2/guide/req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/req/ The Req object is a variable used for obtaining information about a request, read its body or send a response. It is not really an object in the object-oriented sense. It is a simple map that can be directly accessed or used when calling functions from the cowboy_req module. The Req object is the subject of a few different chapters. In this chapter we will learn about the Req object and look at how to retrieve information about the request. The Req object https://ninenines.eu/docs/en/cowboy/2.3/guide/req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/req/ The Req object is a variable used for obtaining information about a request, read its body or send a response. It is not really an object in the object-oriented sense. It is a simple map that can be directly accessed or used when calling functions from the cowboy_req module. The Req object is the subject of a few different chapters. In this chapter we will learn about the Req object and look at how to retrieve information about the request. Reading the request body https://ninenines.eu/docs/en/cowboy/2.0/guide/req_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/req_body/ The request body can be read using the Req object. Cowboy will not attempt to read the body until requested. You need to call the body reading functions in order to retrieve it. Cowboy will not cache the body, it is therefore only possible to read it once. You are not required to read it, however. If a body is present and was not read, Cowboy will either cancel or skip its download, depending on the protocol. Reading the request body https://ninenines.eu/docs/en/cowboy/2.1/guide/req_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/req_body/ The request body can be read using the Req object. Cowboy will not attempt to read the body until requested. You need to call the body reading functions in order to retrieve it. Cowboy will not cache the body, it is therefore only possible to read it once. You are not required to read it, however. If a body is present and was not read, Cowboy will either cancel or skip its download, depending on the protocol. Reading the request body https://ninenines.eu/docs/en/cowboy/2.2/guide/req_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/req_body/ The request body can be read using the Req object. Cowboy will not attempt to read the body until requested. You need to call the body reading functions in order to retrieve it. Cowboy will not cache the body, it is therefore only possible to read it once. You are not required to read it, however. If a body is present and was not read, Cowboy will either cancel or skip its download, depending on the protocol. Reading the request body https://ninenines.eu/docs/en/cowboy/2.3/guide/req_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/req_body/ The request body can be read using the Req object. Cowboy will not attempt to read the body until requested. You need to call the body reading functions in order to retrieve it. Cowboy will not cache the body, it is therefore only possible to read it once. You are not required to read it, however. If a body is present and was not read, Cowboy will either cancel or skip its download, depending on the protocol. EDoc comments https://ninenines.eu/docs/en/erlang.mk/1/guide/edoc/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/edoc/ Erlang.mk provides a thin wrapper on top of EDoc, an application that generates documentation based on comments found in modules. Writing EDoc comments The EDoc user guide explains everything you need to know about EDoc comments. Configuration The EDOC_OPTS variable allows you to specify additional EDoc options. Options are documented in the EDoc manual. A common use for this variable is to enable Markdown in doc comments, using the edown application: Sphinx documentation https://ninenines.eu/docs/en/erlang.mk/1/guide/sphinx/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/sphinx/ Erlang.mk includes targets for running the Sphinx documentation generator, which can produce documentation in various formats, like HTML, man pages, Texinfo, LaTeX, and others. Writing Sphinx documentation Sphinx generates documentation from a set of reST documents. There is a quick start guide on Sphinx' website. For Erlang.mk, we’ll set up a minimal environment instead. Basic setup By default, Erlang.mk expects Sphinx documentation to be placed in the doc directory, with doc/conf. Sending a response https://ninenines.eu/docs/en/cowboy/2.0/guide/resp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/resp/ The response must be sent using the Req object. Cowboy provides two different ways of sending responses: either directly or by streaming the body. Response headers and body may be set in advance. The response is sent as soon as one of the reply or stream reply function is called. Cowboy also provides a simplified interface for sending files. It can also send only specific parts of a file. Sending a response https://ninenines.eu/docs/en/cowboy/2.1/guide/resp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/resp/ The response must be sent using the Req object. Cowboy provides two different ways of sending responses: either directly or by streaming the body. Response headers and body may be set in advance. The response is sent as soon as one of the reply or stream reply function is called. Cowboy also provides a simplified interface for sending files. It can also send only specific parts of a file. Sending a response https://ninenines.eu/docs/en/cowboy/2.2/guide/resp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/resp/ The response must be sent using the Req object. Cowboy provides two different ways of sending responses: either directly or by streaming the body. Response headers and body may be set in advance. The response is sent as soon as one of the reply or stream reply function is called. Cowboy also provides a simplified interface for sending files. It can also send only specific parts of a file. Sending a response https://ninenines.eu/docs/en/cowboy/2.3/guide/resp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/resp/ The response must be sent using the Req object. Cowboy provides two different ways of sending responses: either directly or by streaming the body. Response headers and body may be set in advance. The response is sent as soon as one of the reply or stream reply function is called. Cowboy also provides a simplified interface for sending files. It can also send only specific parts of a file. Erlang shell https://ninenines.eu/docs/en/erlang.mk/1/guide/shell/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/shell/ Erlang.mk provides a convenient target for starting a shell with all the paths set properly to experiment with your code. Configuration The SHELL_DEPS variable can be used to define dependencies that are only to be used when the make shell command is called. For example, if you want to use kjell as your shell: SHELL_DEPS = kjell Dependencies are downloaded and compiled the first time you run the make shell command. Using cookies https://ninenines.eu/docs/en/cowboy/2.0/guide/cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/cookies/ Cookies are a mechanism allowing applications to maintain state on top of the stateless HTTP protocol. Cookies are a name/value store where the names and values are stored in plain text. They expire either after a delay or when the browser closes. They can be configured on a specific domain name or path, and restricted to secure resources (sent or downloaded over HTTPS), or restricted to the server (disallowing access from client-side scripts). Using cookies https://ninenines.eu/docs/en/cowboy/2.1/guide/cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/cookies/ Cookies are a mechanism allowing applications to maintain state on top of the stateless HTTP protocol. Cookies are a name/value store where the names and values are stored in plain text. They expire either after a delay or when the browser closes. They can be configured on a specific domain name or path, and restricted to secure resources (sent or downloaded over HTTPS), or restricted to the server (disallowing access from client-side scripts). Using cookies https://ninenines.eu/docs/en/cowboy/2.2/guide/cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/cookies/ Cookies are a mechanism allowing applications to maintain state on top of the stateless HTTP protocol. Cookies are a name/value store where the names and values are stored in plain text. They expire either after a delay or when the browser closes. They can be configured on a specific domain name or path, and restricted to secure resources (sent or downloaded over HTTPS), or restricted to the server (disallowing access from client-side scripts). Using cookies https://ninenines.eu/docs/en/cowboy/2.3/guide/cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/cookies/ Cookies are a mechanism allowing applications to maintain state on top of the stateless HTTP protocol. Cookies are a name/value store where the names and values are stored in plain text. They expire either after a delay or when the browser closes. They can be configured on a specific domain name or path, and restricted to secure resources (sent or downloaded over HTTPS), or restricted to the server (disallowing access from client-side scripts). EUnit https://ninenines.eu/docs/en/erlang.mk/1/guide/eunit/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/eunit/ EUnit is the tool of choice for unit testing. Erlang.mk automates a few things on top of EUnit, including the discovery and running of unit tests. Writing tests The EUnit user guide is the best place to learn how to write tests. Of note is that all functions ending with _test or _test_ will be picked up as EUnit test cases. Erlang.mk will automatically pick up tests found in any of the Erlang modules of your application. Multipart requests https://ninenines.eu/docs/en/cowboy/2.0/guide/multipart/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/multipart/ Multipart originates from MIME, an Internet standard that extends the format of emails. A multipart message is a list of parts. A part contains headers and a body. The body of the parts may be of any media type, and contain text or binary data. It is possible for parts to contain a multipart media type. In the context of HTTP, multipart is most often used with the multipart/form-data media type. Multipart requests https://ninenines.eu/docs/en/cowboy/2.1/guide/multipart/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/multipart/ Multipart originates from MIME, an Internet standard that extends the format of emails. A multipart message is a list of parts. A part contains headers and a body. The body of the parts may be of any media type, and contain text or binary data. It is possible for parts to contain a multipart media type. In the context of HTTP, multipart is most often used with the multipart/form-data media type. Multipart requests https://ninenines.eu/docs/en/cowboy/2.2/guide/multipart/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/multipart/ Multipart originates from MIME, an Internet standard that extends the format of emails. A multipart message is a list of parts. A part contains headers and a body. The body of the parts may be of any media type, and contain text or binary data. It is possible for parts to contain a multipart media type. In the context of HTTP, multipart is most often used with the multipart/form-data media type. Multipart requests https://ninenines.eu/docs/en/cowboy/2.3/guide/multipart/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/multipart/ Multipart originates from MIME, an Internet standard that extends the format of emails. A multipart message is a list of parts. A part contains headers and a body. The body of the parts may be of any media type, and contain text or binary data. It is possible for parts to contain a multipart media type. In the context of HTTP, multipart is most often used with the multipart/form-data media type. Common Test https://ninenines.eu/docs/en/erlang.mk/1/guide/common_test/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/common_test/ Common Test is Erlang’s functional testing framework. Erlang.mk automates the discovery and running of Common Test suites. Writing tests The Common Test user guide is the best place to learn how to write tests. Erlang.mk requires that file names for test suites end with _SUITE.erl and that the files be located in the $(TEST_DIR) directory. This defaults to test/. Configuration The CT_OPTS variable allows you to set extra Common Test options. REST principles https://ninenines.eu/docs/en/cowboy/2.0/guide/rest_principles/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/rest_principles/ This chapter will attempt to define the concepts behind REST and explain what makes a service RESTful. REST is often confused with performing a distinct operation depending on the HTTP method, while using more than the GET and POST methods. That’s highly misguided at best. We will first attempt to define REST and will look at what it means in the context of HTTP and the Web. For a more in-depth explanation of REST, you can read Roy T. REST principles https://ninenines.eu/docs/en/cowboy/2.1/guide/rest_principles/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/rest_principles/ This chapter will attempt to define the concepts behind REST and explain what makes a service RESTful. REST is often confused with performing a distinct operation depending on the HTTP method, while using more than the GET and POST methods. That’s highly misguided at best. We will first attempt to define REST and will look at what it means in the context of HTTP and the Web. For a more in-depth explanation of REST, you can read Roy T. REST principles https://ninenines.eu/docs/en/cowboy/2.2/guide/rest_principles/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/rest_principles/ This chapter will attempt to define the concepts behind REST and explain what makes a service RESTful. REST is often confused with performing a distinct operation depending on the HTTP method, while using more than the GET and POST methods. That’s highly misguided at best. We will first attempt to define REST and will look at what it means in the context of HTTP and the Web. For a more in-depth explanation of REST, you can read Roy T. REST principles https://ninenines.eu/docs/en/cowboy/2.3/guide/rest_principles/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/rest_principles/ This chapter will attempt to define the concepts behind REST and explain what makes a service RESTful. REST is often confused with performing a distinct operation depending on the HTTP method, while using more than the GET and POST methods. That’s highly misguided at best. We will first attempt to define REST and will look at what it means in the context of HTTP and the Web. For a more in-depth explanation of REST, you can read Roy T. Code coverage https://ninenines.eu/docs/en/erlang.mk/1/guide/coverage/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/coverage/ Placeholder chapter. REST handlers https://ninenines.eu/docs/en/cowboy/2.0/guide/rest_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/rest_handlers/ REST is implemented in Cowboy as a sub protocol. The request is handled as a state machine with many optional callbacks describing the resource and modifying the machine’s behavior. The REST handler is the recommended way to handle HTTP requests. Initialization First, the init/2 callback is called. This callback is common to all handlers. To use REST for the current request, this function must return a cowboy_rest tuple. REST handlers https://ninenines.eu/docs/en/cowboy/2.1/guide/rest_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/rest_handlers/ REST is implemented in Cowboy as a sub protocol. The request is handled as a state machine with many optional callbacks describing the resource and modifying the machine’s behavior. The REST handler is the recommended way to handle HTTP requests. Initialization First, the init/2 callback is called. This callback is common to all handlers. To use REST for the current request, this function must return a cowboy_rest tuple. REST handlers https://ninenines.eu/docs/en/cowboy/2.2/guide/rest_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/rest_handlers/ REST is implemented in Cowboy as a sub protocol. The request is handled as a state machine with many optional callbacks describing the resource and modifying the machine’s behavior. The REST handler is the recommended way to handle HTTP requests. Initialization First, the init/2 callback is called. This callback is common to all handlers. To use REST for the current request, this function must return a cowboy_rest tuple. REST handlers https://ninenines.eu/docs/en/cowboy/2.3/guide/rest_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/rest_handlers/ REST is implemented in Cowboy as a sub protocol. The request is handled as a state machine with many optional callbacks describing the resource and modifying the machine’s behavior. The REST handler is the recommended way to handle HTTP requests. Initialization First, the init/2 callback is called. This callback is common to all handlers. To use REST for the current request, this function must return a cowboy_rest tuple. Continuous integration https://ninenines.eu/docs/en/erlang.mk/1/guide/ci/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/ci/ Erlang.mk comes with some support for continuous integration, aimed at open source projects that need to support more than one specific Erlang/OTP release. (If you target one specific release, check the OTP version pinning section of the OTP version management chapter.) Configuring Erlang/OTP versions to test To use the CI plugin you must first configure which versions of Erlang/OTP will be used. Erlang.mk provides three separate configuration variables depending on whether you need a normal OTP release, a HiPE-enabled release or an ErLLVM-enabled release. Dialyzer https://ninenines.eu/docs/en/erlang.mk/1/guide/dialyzer/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/dialyzer/ Dialyzer is a tool that will detect discrepancies in your program. It does so using a technique known as success typing analysis which has the advantage of providing no false positives. Dialyzer is able to detect type errors, dead code and more. Erlang.mk provides a wrapper around Dialyzer. How it works Dialyzer requires a PLT file to work. The PLT file contains the analysis information from all applications which are not expected to change, or rarely do. REST flowcharts https://ninenines.eu/docs/en/cowboy/2.0/guide/rest_flowcharts/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/rest_flowcharts/ This chapter will explain the REST handler state machine through a number of different diagrams. There are four main paths that requests may follow. One for the method OPTIONS; one for the methods GET and HEAD; one for the methods PUT, POST and PATCH; and one for the method DELETE. All paths start with the "Start" diagram, and all paths excluding the OPTIONS path go through the "Content negotiation" REST flowcharts https://ninenines.eu/docs/en/cowboy/2.1/guide/rest_flowcharts/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/rest_flowcharts/ This chapter will explain the REST handler state machine through a number of different diagrams. There are four main paths that requests may follow. One for the method OPTIONS; one for the methods GET and HEAD; one for the methods PUT, POST and PATCH; and one for the method DELETE. All paths start with the "Start" diagram, and all paths excluding the OPTIONS path go through the "Content negotiation" REST flowcharts https://ninenines.eu/docs/en/cowboy/2.2/guide/rest_flowcharts/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/rest_flowcharts/ This chapter will explain the REST handler state machine through a number of different diagrams. There are four main paths that requests may follow. One for the method OPTIONS; one for the methods GET and HEAD; one for the methods PUT, POST and PATCH; and one for the method DELETE. All paths start with the "Start" diagram, and all paths excluding the OPTIONS path go through the "Content negotiation" REST flowcharts https://ninenines.eu/docs/en/cowboy/2.3/guide/rest_flowcharts/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/rest_flowcharts/ This chapter will explain the REST handler state machine through a number of different diagrams. There are four main paths that requests may follow. One for the method OPTIONS; one for the methods GET and HEAD; one for the methods PUT, POST and PATCH; and one for the method DELETE. All paths start with the "Start" diagram, and all paths excluding the OPTIONS path go through the "Content negotiation" Xref https://ninenines.eu/docs/en/erlang.mk/1/guide/xref/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/xref/ Placeholder chapter. Designing a resource handler https://ninenines.eu/docs/en/cowboy/2.0/guide/resource_design/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/resource_design/ This chapter aims to provide you with a list of questions you must answer in order to write a good resource handler. It is meant to be usable as a step by step guide. The service Can the service become unavailable, and when it does, can we detect it? For example, database connectivity problems may be detected early. We may also have planned outages of all or parts of the system. Designing a resource handler https://ninenines.eu/docs/en/cowboy/2.1/guide/resource_design/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/resource_design/ This chapter aims to provide you with a list of questions you must answer in order to write a good resource handler. It is meant to be usable as a step by step guide. The service Can the service become unavailable, and when it does, can we detect it? For example, database connectivity problems may be detected early. We may also have planned outages of all or parts of the system. Designing a resource handler https://ninenines.eu/docs/en/cowboy/2.2/guide/resource_design/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/resource_design/ This chapter aims to provide you with a list of questions you must answer in order to write a good resource handler. It is meant to be usable as a step by step guide. The service Can the service become unavailable, and when it does, can we detect it? For example, database connectivity problems may be detected early. We may also have planned outages of all or parts of the system. Designing a resource handler https://ninenines.eu/docs/en/cowboy/2.3/guide/resource_design/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/resource_design/ This chapter aims to provide you with a list of questions you must answer in order to write a good resource handler. It is meant to be usable as a step by step guide. The service Can the service become unavailable, and when it does, can we detect it? For example, database connectivity problems may be detected early. We may also have planned outages of all or parts of the system. External plugins https://ninenines.eu/docs/en/erlang.mk/1/guide/external_plugins/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/external_plugins/ It is often convenient to be able to keep the build files used by all your projects in one place. Those files could be Makefiles, configuration files, templates and more. Erlang.mk allows you to automatically load plugins from dependencies. Plugins can do anything, including defining new variables, defining file templates, hooking themselves inside the normal Erlang.mk processing or even adding new rules. You can load plugins using one of two methods. The Websocket protocol https://ninenines.eu/docs/en/cowboy/2.0/guide/ws_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/ws_protocol/ This chapter explains what Websocket is and why it is a vital component of soft realtime Web applications. Description Websocket is an extension to HTTP that emulates plain TCP connections between the client, typically a Web browser, and the server. It uses the HTTP Upgrade mechanism to establish the connection. Websocket connections are fully asynchronous, unlike HTTP/1.1 (synchronous) and HTTP/2 (asynchronous, but the server can only initiate streams in response to requests). The Websocket protocol https://ninenines.eu/docs/en/cowboy/2.1/guide/ws_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/ws_protocol/ This chapter explains what Websocket is and why it is a vital component of soft realtime Web applications. Description Websocket is an extension to HTTP that emulates plain TCP connections between the client, typically a Web browser, and the server. It uses the HTTP Upgrade mechanism to establish the connection. Websocket connections are fully asynchronous, unlike HTTP/1.1 (synchronous) and HTTP/2 (asynchronous, but the server can only initiate streams in response to requests). The Websocket protocol https://ninenines.eu/docs/en/cowboy/2.2/guide/ws_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/ws_protocol/ This chapter explains what Websocket is and why it is a vital component of soft realtime Web applications. Description Websocket is an extension to HTTP that emulates plain TCP connections between the client, typically a Web browser, and the server. It uses the HTTP Upgrade mechanism to establish the connection. Websocket connections are fully asynchronous, unlike HTTP/1.1 (synchronous) and HTTP/2 (asynchronous, but the server can only initiate streams in response to requests). The Websocket protocol https://ninenines.eu/docs/en/cowboy/2.3/guide/ws_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/ws_protocol/ This chapter explains what Websocket is and why it is a vital component of soft realtime Web applications. Description Websocket is an extension to HTTP that emulates plain TCP connections between the client, typically a Web browser, and the server. It uses the HTTP Upgrade mechanism to establish the connection. Websocket connections are fully asynchronous, unlike HTTP/1.1 (synchronous) and HTTP/2 (asynchronous, but the server can only initiate streams in response to requests). List of plugins https://ninenines.eu/docs/en/erlang.mk/1/guide/external_plugins_list/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/external_plugins_list/ This is a non-exhaustive list of Erlang.mk plugins, sorted alphabetically. efene.mk An Efene plugin for Erlang.mk. Efene is an alternative language for the BEAM. elixir.mk An Elixir plugin for Erlang.mk. Elixir is an alternative language for the BEAM. elvis.mk An Elvis plugin for Erlang.mk. Elvis is an Erlang style reviewer. geas Geas gives aggregated information on a project and its dependencies, and is available as an Erlang. Websocket handlers https://ninenines.eu/docs/en/cowboy/2.0/guide/ws_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/ws_handlers/ Websocket handlers provide an interface for upgrading HTTP/1.1 connections to Websocket and sending or receiving frames on the Websocket connection. As Websocket connections are established through the HTTP/1.1 upgrade mechanism, Websocket handlers need to be able to first receive the HTTP request for the upgrade, before switching to Websocket and taking over the connection. They can then receive or send Websocket frames, handle incoming Erlang messages or close the connection. Websocket handlers https://ninenines.eu/docs/en/cowboy/2.1/guide/ws_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/ws_handlers/ Websocket handlers provide an interface for upgrading HTTP/1.1 connections to Websocket and sending or receiving frames on the Websocket connection. As Websocket connections are established through the HTTP/1.1 upgrade mechanism, Websocket handlers need to be able to first receive the HTTP request for the upgrade, before switching to Websocket and taking over the connection. They can then receive or send Websocket frames, handle incoming Erlang messages or close the connection. Websocket handlers https://ninenines.eu/docs/en/cowboy/2.2/guide/ws_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/ws_handlers/ Websocket handlers provide an interface for upgrading HTTP/1.1 connections to Websocket and sending or receiving frames on the Websocket connection. As Websocket connections are established through the HTTP/1.1 upgrade mechanism, Websocket handlers need to be able to first receive the HTTP request for the upgrade, before switching to Websocket and taking over the connection. They can then receive or send Websocket frames, handle incoming Erlang messages or close the connection. Websocket handlers https://ninenines.eu/docs/en/cowboy/2.3/guide/ws_handlers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/ws_handlers/ Websocket handlers provide an interface for upgrading HTTP/1.1 connections to Websocket and sending or receiving frames on the Websocket connection. As Websocket connections are established through the HTTP/1.1 upgrade mechanism, Websocket handlers need to be able to first receive the HTTP request for the upgrade, before switching to Websocket and taking over the connection. They can then receive or send Websocket frames, handle incoming Erlang messages or close the connection. Why Erlang.mk https://ninenines.eu/docs/en/erlang.mk/1/guide/why/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/why/ Why would you choose Erlang.mk, if not for its many features? This chapter will attempt to answer that. Erlang.mk is fast Erlang.mk is as fast as it gets. Erlang.mk will group the compilation of files so as to avoid running the BEAM more than necessary. This saves many seconds compared to traditional Makefiles, even on small projects. Erlang.mk will not try to be too smart. It provides a simple solution that works for most people, and gives additional options for projects that run into edge cases, often in the form of extra variables or rules to be defined. Streams https://ninenines.eu/docs/en/cowboy/2.0/guide/streams/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/streams/ A stream is the set of messages that form an HTTP request/response pair. The term stream comes from HTTP/2. In Cowboy, it is also used when talking about HTTP/1.1 or HTTP/1.0. It should not be confused with streaming the request or response body. All versions of HTTP allow clients to initiate streams. HTTP/2 is the only one also allowing servers, through its server push feature. Both client and server-initiated streams go through the same process in Cowboy. Streams https://ninenines.eu/docs/en/cowboy/2.1/guide/streams/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/streams/ A stream is the set of messages that form an HTTP request/response pair. The term stream comes from HTTP/2. In Cowboy, it is also used when talking about HTTP/1.1 or HTTP/1.0. It should not be confused with streaming the request or response body. All versions of HTTP allow clients to initiate streams. HTTP/2 is the only one also allowing servers, through its server push feature. Both client and server-initiated streams go through the same process in Cowboy. Streams https://ninenines.eu/docs/en/cowboy/2.2/guide/streams/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/streams/ A stream is the set of messages that form an HTTP request/response pair. The term stream comes from HTTP/2. In Cowboy, it is also used when talking about HTTP/1.1 or HTTP/1.0. It should not be confused with streaming the request or response body. All versions of HTTP allow clients to initiate streams. HTTP/2 is the only one also allowing servers, through its server push feature. Both client and server-initiated streams go through the same process in Cowboy. Streams https://ninenines.eu/docs/en/cowboy/2.3/guide/streams/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/streams/ A stream is the set of messages that form an HTTP request/response pair. The term stream comes from HTTP/2. In Cowboy, it is also used when talking about HTTP/1.1 or HTTP/1.0. It should not be confused with streaming the request or response body. All versions of HTTP allow clients to initiate streams. HTTP/2 is the only one also allowing servers, through its server push feature. Both client and server-initiated streams go through the same process in Cowboy. Short history https://ninenines.eu/docs/en/erlang.mk/1/guide/history/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/history/ This chapter aims to be a brief record of the life of the Erlang.mk project. Before Erlang.mk Erlang.mk originates from the Cowboy project. Cowboy started as a Rebar project and I, Loïc Hoguin, was very happy with it for a couple years. Over time however I started getting annoyed and frustrated by a number of things, including bad defaults, changing defaults and overall slowness. In particular, at the time I gave up on Rebar, the Cowboy test suite was taking about five minutes to run. Middlewares https://ninenines.eu/docs/en/cowboy/2.0/guide/middlewares/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/middlewares/ Cowboy delegates the request processing to middleware components. By default, two middlewares are defined, for the routing and handling of the request, as is detailed in most of this guide. Middlewares give you complete control over how requests are to be processed. You can add your own middlewares to the mix or completely change the chain of middlewares as needed. Cowboy will execute all middlewares in the given order, unless one of them decides to stop processing. Middlewares https://ninenines.eu/docs/en/cowboy/2.1/guide/middlewares/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/middlewares/ Cowboy delegates the request processing to middleware components. By default, two middlewares are defined, for the routing and handling of the request, as is detailed in most of this guide. Middlewares give you complete control over how requests are to be processed. You can add your own middlewares to the mix or completely change the chain of middlewares as needed. Cowboy will execute all middlewares in the given order, unless one of them decides to stop processing. Middlewares https://ninenines.eu/docs/en/cowboy/2.2/guide/middlewares/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/middlewares/ Cowboy delegates the request processing to middleware components. By default, two middlewares are defined, for the routing and handling of the request, as is detailed in most of this guide. Middlewares give you complete control over how requests are to be processed. You can add your own middlewares to the mix or completely change the chain of middlewares as needed. Cowboy will execute all middlewares in the given order, unless one of them decides to stop processing. Middlewares https://ninenines.eu/docs/en/cowboy/2.3/guide/middlewares/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/middlewares/ Cowboy delegates the request processing to middleware components. By default, two middlewares are defined, for the routing and handling of the request, as is detailed in most of this guide. Middlewares give you complete control over how requests are to be processed. You can add your own middlewares to the mix or completely change the chain of middlewares as needed. Cowboy will execute all middlewares in the given order, unless one of them decides to stop processing. Contributing https://ninenines.eu/docs/en/erlang.mk/1/guide/contributing/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/contributing/ You are welcome and encouraged to contribute. This is how. Priorities From the most important to the least important: Bugs Package issues/additions Refactoring Features Bugs If you have found a bug, you should open a ticket. Include everything relevant including the command you used, output, a link to the code that triggers the issue, why you think this is a bug, etc. Changes since Cowboy 2.2 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_2.2/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_2.2/ The following patch versions were released since Cowboy 2.2: Cowboy 2.2.2 While fixing the miscount in the previous patch release an issue was introduced where HTTP/2 bodies could be sent out of orders when using iolists. This has been corrected. Cowboy 2.2.1 Colons are now allowed within path segments in routes provided to cowboy_router:compile/1 as long as they are not the first character of the path segment. Migrating from Cowboy 1.0 to 2.0 https://ninenines.eu/docs/en/cowboy/2.0/guide/migrating_from_1.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/migrating_from_1.0/ A lot has changed between Cowboy 1.0 and 2.0. The cowboy_req interface in particular has seen a massive revamp. Hooks are gone, their functionality can now be achieved via stream handlers. The documentation has seen great work, in particular the manual. Each module and each function now has its own dedicated manual page with full details and examples. Compatibility Compatibility with Erlang/OTP R16, 17 and 18 has been dropped. Migrating from Cowboy 2.0 to 2.1 https://ninenines.eu/docs/en/cowboy/2.1/guide/migrating_from_2.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/migrating_from_2.0/ Cowboy 2.1 focused on adding features that were temporarily removed in Cowboy 2.0. A number of bugs found in the 2.0 release were also fixed. Features added It is now possible to obtain the client TLS certificate and the local IP/port for the connection from the Req object. Informational responses (1XX responses) can now be sent. They must be sent before initiating the final response. Migrating from Cowboy 2.2 to 2.3 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_2.2/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_2.2/ Cowboy 2.3 focused on making the Cowboy processes behave properly according to OTP principles. This version is a very good milestone toward that goal and most of everything should now work. Release upgrades and a few details will be improved in future versions. Features added Add support for all functions from the module sys. Note that Cowboy currently does not implement the sys debugging mechanisms as tracing is recommended instead. HTTP and other specifications https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/specs/ This chapter intends to list all the specification documents for or related to HTTP. HTTP IANA Registries HTTP Method Registry HTTP Status Code Registry Message Headers HTTP Parameters HTTP Alt-Svc Parameter Registry HTTP Authentication Scheme Registry HTTP Cache Directive Registry HTTP Digest Algorithm Values HTTP Origin-Bound Authentication Device Identifier Types HTTP Upgrade Token Registry HTTP Warn Codes HTTP/2 Parameters WebSocket Protocol Registries Current CORS: Cross-Origin Resource Sharing CSP2: Content Security Policy Level 2 DNT: Tracking Preference Expression (DNT) eventsource: Server-Sent Events Form content types: Form content types Preload: Preload REST: Fielding’s Dissertation RFC 1945: HTTP/1. Migrating from Cowboy 1.0 to 2.0 https://ninenines.eu/docs/en/cowboy/2.1/guide/migrating_from_1.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/migrating_from_1.0/ A lot has changed between Cowboy 1.0 and 2.0. The cowboy_req interface in particular has seen a massive revamp. Hooks are gone, their functionality can now be achieved via stream handlers. The documentation has seen great work, in particular the manual. Each module and each function now has its own dedicated manual page with full details and examples. Compatibility Compatibility with Erlang/OTP R16, 17 and 18 has been dropped. Migrating from Cowboy 2.1 to 2.2 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_2.1/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_2.1/ Cowboy 2.2 focused on adding features required for writing gRPC servers and on completing test suites for the core HTTP RFCs, fixing many bugs along the way. Features added Add support for sending trailers at the end of response bodies. Trailers are additional header fields that may be sent after the body to add more information to the response. Their usage is required in gRPC servers. They are optional and may be discarded in other scenarios (for example if the request goes through an HTTP/1. Migrating from Cowboy 2.1 to 2.2 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_2.1/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_2.1/ Cowboy 2.2 focused on adding features required for writing gRPC servers and on completing test suites for the core HTTP RFCs, fixing many bugs along the way. Features added Add support for sending trailers at the end of response bodies. Trailers are additional header fields that may be sent after the body to add more information to the response. Their usage is required in gRPC servers. They are optional and may be discarded in other scenarios (for example if the request goes through an HTTP/1. HTTP and other specifications https://ninenines.eu/docs/en/cowboy/2.1/guide/specs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/specs/ This chapter intends to list all the specification documents for or related to HTTP. HTTP IANA Registries HTTP Method Registry HTTP Status Code Registry Message Headers HTTP Parameters HTTP Alt-Svc Parameter Registry HTTP Authentication Scheme Registry HTTP Cache Directive Registry HTTP Digest Algorithm Values HTTP Origin-Bound Authentication Device Identifier Types HTTP Upgrade Token Registry HTTP Warn Codes HTTP/2 Parameters WebSocket Protocol Registries Current CORS: Cross-Origin Resource Sharing CSP2: Content Security Policy Level 2 DNT: Tracking Preference Expression (DNT) eventsource: Server-Sent Events Form content types: Form content types Preload: Preload REST: Fielding’s Dissertation RFC 1945: HTTP/1. Migrating from Cowboy 2.0 to 2.1 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_2.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_2.0/ Cowboy 2.1 focused on adding features that were temporarily removed in Cowboy 2.0. A number of bugs found in the 2.0 release were also fixed. Features added It is now possible to obtain the client TLS certificate and the local IP/port for the connection from the Req object. Informational responses (1XX responses) can now be sent. They must be sent before initiating the final response. Migrating from Cowboy 2.0 to 2.1 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_2.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_2.0/ Cowboy 2.1 focused on adding features that were temporarily removed in Cowboy 2.0. A number of bugs found in the 2.0 release were also fixed. Features added It is now possible to obtain the client TLS certificate and the local IP/port for the connection from the Req object. Informational responses (1XX responses) can now be sent. They must be sent before initiating the final response. Migrating from Cowboy 1.0 to 2.0 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_1.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/migrating_from_1.0/ A lot has changed between Cowboy 1.0 and 2.0. The cowboy_req interface in particular has seen a massive revamp. Hooks are gone, their functionality can now be achieved via stream handlers. The documentation has seen great work, in particular the manual. Each module and each function now has its own dedicated manual page with full details and examples. Compatibility Compatibility with Erlang/OTP R16, 17 and 18 has been dropped. Migrating from Cowboy 1.0 to 2.0 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_1.0/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/migrating_from_1.0/ A lot has changed between Cowboy 1.0 and 2.0. The cowboy_req interface in particular has seen a massive revamp. Hooks are gone, their functionality can now be achieved via stream handlers. The documentation has seen great work, in particular the manual. Each module and each function now has its own dedicated manual page with full details and examples. Compatibility Compatibility with Erlang/OTP R16, 17 and 18 has been dropped. HTTP and other specifications https://ninenines.eu/docs/en/cowboy/2.2/guide/specs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/specs/ This chapter intends to list all the specification documents for or related to HTTP. HTTP IANA Registries HTTP Method Registry HTTP Status Code Registry Message Headers HTTP Parameters HTTP Alt-Svc Parameter Registry HTTP Authentication Scheme Registry HTTP Cache Directive Registry HTTP Digest Algorithm Values HTTP Origin-Bound Authentication Device Identifier Types HTTP Upgrade Token Registry HTTP Warn Codes HTTP/2 Parameters WebSocket Protocol Registries Current CORS: Cross-Origin Resource Sharing CSP2: Content Security Policy Level 2 DNT: Tracking Preference Expression (DNT) eventsource: Server-Sent Events Form content types: Form content types Preload: Preload REST: Fielding’s Dissertation RFC 1945: HTTP/1. HTTP and other specifications https://ninenines.eu/docs/en/cowboy/2.3/guide/specs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/specs/ This chapter intends to list all the specification documents for or related to HTTP. HTTP IANA Registries HTTP Method Registry HTTP Status Code Registry Message Headers HTTP Parameters HTTP Alt-Svc Parameter Registry HTTP Authentication Scheme Registry HTTP Cache Directive Registry HTTP Digest Algorithm Values HTTP Origin-Bound Authentication Device Identifier Types HTTP Upgrade Token Registry HTTP Warn Codes HTTP/2 Parameters WebSocket Protocol Registries Current CORS: Cross-Origin Resource Sharing CSP2: Content Security Policy Level 2 DNT: Tracking Preference Expression (DNT) eventsource: Server-Sent Events Form content types: Form content types Preload: Preload PROXY: The PROXY protocol REST: Fielding’s Dissertation RFC 1945: HTTP/1. Cowboy Function Reference https://ninenines.eu/docs/en/cowboy/2.0/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: Cowboy Function Reference https://ninenines.eu/docs/en/cowboy/2.1/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: Cowboy Function Reference https://ninenines.eu/docs/en/cowboy/2.2/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: Cowboy Function Reference https://ninenines.eu/docs/en/cowboy/2.3/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: Cowboy User Guide https://ninenines.eu/docs/en/cowboy/2.0/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/guide/ Rationale The modern Web Erlang and the Web Introduction Introduction Getting started Flow diagram Configuration Listeners Routing Constraints Handlers Handlers Loop handlers Static files Request and response Request details Reading the request body Sending a response Using cookies Multipart REST REST principles Handling REST requests REST flowcharts Designing a resource handler Websocket The Websocket protocol Websocket handlers Advanced Streams Middlewares Additional information Migrating from Cowboy 1. Cowboy User Guide https://ninenines.eu/docs/en/cowboy/2.1/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/guide/ Rationale The modern Web Erlang and the Web Introduction Introduction Getting started Flow diagram Configuration Listeners Routing Constraints Handlers Handlers Loop handlers Static files Request and response Request details Reading the request body Sending a response Using cookies Multipart REST REST principles Handling REST requests REST flowcharts Designing a resource handler Websocket The Websocket protocol Websocket handlers Advanced Streams Middlewares Additional information Migrating from Cowboy 2. Cowboy User Guide https://ninenines.eu/docs/en/cowboy/2.2/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/guide/ Rationale The modern Web Erlang and the Web Introduction Introduction Getting started Flow diagram Configuration Listeners Routing Constraints Handlers Handlers Loop handlers Static files Request and response Request details Reading the request body Sending a response Using cookies Multipart REST REST principles Handling REST requests REST flowcharts Designing a resource handler Websocket The Websocket protocol Websocket handlers Advanced Streams Middlewares Additional information Changes since Cowboy 2. Cowboy User Guide https://ninenines.eu/docs/en/cowboy/2.3/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/guide/ Rationale The modern Web Erlang and the Web Introduction Introduction Getting started Flow diagram Configuration Listeners Routing Constraints Handlers Handlers Loop handlers Static files Request and response Request details Reading the request body Sending a response Using cookies Multipart REST REST principles Handling REST requests REST flowcharts Designing a resource handler Websocket The Websocket protocol Websocket handlers Advanced Streams Middlewares Additional information Migrating from Cowboy 2. Erlang.mk User Guide https://ninenines.eu/docs/en/erlang.mk/1/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/erlang.mk/1/guide/ Installation Getting started Overview Updating Erlang.mk Limitations Code Building Packages and dependencies NIFs and port drivers Releases Self-extracting releases Escripts OTP version management Compatibility with other build tools Documentation Asciidoc documentation EDoc comments Sphinx documentation Tests Erlang shell EUnit Common Test Code coverage Continuous integration Dialyzer Xref Third-party plugins External plugins List of plugins About Erlang. Gun Function Reference https://ninenines.eu/docs/en/gun/1.0/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/manual/ gun(7) gun(3) Gun User Guide https://ninenines.eu/docs/en/gun/1.0/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/guide/ Introduction Starting and stopping Supported protocols Connection Using HTTP Using Websocket HTTP status codes(7) https://ninenines.eu/docs/en/cowboy/2.0/manual/http_status_codes/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/http_status_codes/ Name HTTP status codes - status codes used by Cowboy Description This chapter aims to list all HTTP status codes that Cowboy may return, with details on the reasons why. The list given here only includes the replies that Cowboy sends, not user replies. 100 Continue When the client sends an expect: 100-continue header, Cowboy automatically sends a this status code before trying to read the request body. HTTP status codes(7) https://ninenines.eu/docs/en/cowboy/2.1/manual/http_status_codes/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/http_status_codes/ Name HTTP status codes - status codes used by Cowboy Description This chapter aims to list all HTTP status codes that Cowboy may return, with details on the reasons why. The list given here only includes the replies that Cowboy sends, not user replies. 100 Continue When the client sends an expect: 100-continue header, Cowboy automatically sends a this status code before trying to read the request body. HTTP status codes(7) https://ninenines.eu/docs/en/cowboy/2.2/manual/http_status_codes/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/http_status_codes/ Name HTTP status codes - status codes used by Cowboy Description This chapter aims to list all HTTP status codes that Cowboy may return, with details on the reasons why. The list given here only includes the replies that Cowboy sends, not user replies. 100 Continue When the client sends an expect: 100-continue header, Cowboy automatically sends a this status code before trying to read the request body. HTTP status codes(7) https://ninenines.eu/docs/en/cowboy/2.3/manual/http_status_codes/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/http_status_codes/ Name HTTP status codes - status codes used by Cowboy Description This chapter aims to list all HTTP status codes that Cowboy may return, with details on the reasons why. The list given here only includes the replies that Cowboy sends, not user replies. 100 Continue When the client sends an expect: 100-continue header, Cowboy automatically sends a this status code before trying to read the request body. Ranch Function Reference https://ninenines.eu/docs/en/ranch/1.2/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ ranch(7) ranch(3) ranch_protocol(3) ranch_ssl(3) ranch_tcp(3) ranch_transport(3) Ranch Function Reference https://ninenines.eu/docs/en/ranch/1.3/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ ranch(7) ranch(3) ranch_protocol(3) ranch_ssl(3) ranch_tcp(3) ranch_transport(3) Ranch Function Reference https://ninenines.eu/docs/en/ranch/1.4/manual/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ ranch(7) ranch(3) ranch_protocol(3) ranch_ssl(3) ranch_tcp(3) ranch_transport(3) Ranch User Guide https://ninenines.eu/docs/en/ranch/1.2/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/guide/ Introduction Listeners Transports Protocols Embedded mode Writing parsers SSL client authentication Internals Ranch User Guide https://ninenines.eu/docs/en/ranch/1.3/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/guide/ Introduction Listeners Transports Protocols Embedded mode Writing parsers SSL client authentication Internals Ranch User Guide https://ninenines.eu/docs/en/ranch/1.4/guide/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/guide/ Introduction Listeners Transports Protocols Embedded mode Writing parsers SSL client authentication Internals cowboy(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy/ Name cowboy - HTTP server Description The module cowboy provides convenience functions for manipulating Ranch listeners. Exports cowboy:start_clear(3) - Listen for connections using plain TCP cowboy:start_tls(3) - Listen for connections using TLS cowboy:stop_listener(3) - Stop the given listener cowboy:set_env(3) - Update a listener’s environment value Types fields() fields() :: [Name | {Name, Constraints} | {Name, Constraints, Default}] Name :: atom() Constraints :: Constraint | [Constraint] Constraint :: cowboy_constraints:constraint() Default :: any() Fields description for match operations. cowboy(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy/ Name cowboy - HTTP server Description The module cowboy provides convenience functions for manipulating Ranch listeners. Exports cowboy:start_clear(3) - Listen for connections using plain TCP cowboy:start_tls(3) - Listen for connections using TLS cowboy:stop_listener(3) - Stop the given listener cowboy:set_env(3) - Update a listener’s environment value Types fields() fields() :: [Name | {Name, Constraints} | {Name, Constraints, Default}] Name :: atom() Constraints :: Constraint | [Constraint] Constraint :: cowboy_constraints:constraint() Default :: any() Fields description for match operations. cowboy(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy/ Name cowboy - HTTP server Description The module cowboy provides convenience functions for manipulating Ranch listeners. Exports cowboy:start_clear(3) - Listen for connections using plain TCP cowboy:start_tls(3) - Listen for connections using TLS cowboy:stop_listener(3) - Stop the given listener cowboy:set_env(3) - Update a listener’s environment value Types fields() fields() :: [Name | {Name, Constraints} | {Name, Constraints, Default}] Name :: atom() Constraints :: Constraint | [Constraint] Constraint :: cowboy_constraints:constraint() Default :: any() Fields description for match operations. cowboy(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy/ Name cowboy - HTTP server Description The module cowboy provides convenience functions for manipulating Ranch listeners. Exports cowboy:start_clear(3) - Listen for connections using plain TCP cowboy:start_tls(3) - Listen for connections using TLS cowboy:stop_listener(3) - Stop the given listener cowboy:set_env(3) - Update a listener’s environment value Types fields() fields() :: [Name | {Name, Constraints} | {Name, Constraints, Default}] Name :: atom() Constraints :: Constraint | [Constraint] Constraint :: cowboy_constraints:constraint() Default :: any() Fields description for match operations. cowboy(7) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_app/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: cowboy(7) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_app/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: cowboy(7) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_app/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: cowboy(7) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_app/ Name cowboy - Small, fast, modern HTTP server for Erlang/OTP Description Cowboy is an HTTP server for Erlang/OTP with support for the HTTP/1.1, HTTP/2 and Websocket protocols. Cowboy aims to provide a complete HTTP stack. This includes the implementation of the HTTP RFCs but also any directly related standards, like Websocket or Server-Sent Events. Modules Functions: cowboy(3) - Listener management cowboy_req(3) - Request and response cowboy_router(3) - Router cowboy_constraints(3) - Constraints Protocols: cowboy:set_env(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.set_env/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.set_env/ Name cowboy:set_env - Update a listener’s environment value Description set_env(Name :: ranch:ref(), Key :: atom(), Value :: any()) -> ok Set or update an environment value for a previously started listener. This is most useful for updating the routes dynamically, without having to restart the listener. The new value will only be available to new connections. Pre-existing connections will still use the old value. Arguments Name The name of the listener to update. cowboy:set_env(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.set_env/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.set_env/ Name cowboy:set_env - Update a listener’s environment value Description set_env(Name :: ranch:ref(), Key :: atom(), Value :: any()) -> ok Set or update an environment value for a previously started listener. This is most useful for updating the routes dynamically, without having to restart the listener. The new value will only be available to new connections. Pre-existing connections will still use the old value. Arguments Name The name of the listener to update. cowboy:set_env(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.set_env/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.set_env/ Name cowboy:set_env - Update a listener’s environment value Description set_env(Name :: ranch:ref(), Key :: atom(), Value :: any()) -> ok Set or update an environment value for a previously started listener. This is most useful for updating the routes dynamically, without having to restart the listener. The new value will only be available to new connections. Pre-existing connections will still use the old value. Arguments Name The name of the listener to update. cowboy:set_env(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.set_env/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.set_env/ Name cowboy:set_env - Update a listener’s environment value Description set_env(Name :: ranch:ref(), Key :: atom(), Value :: any()) -> ok Set or update an environment value for a previously started listener. This is most useful for updating the routes dynamically, without having to restart the listener. The new value will only be available to new connections. Pre-existing connections will still use the old value. Arguments Name The name of the listener to update. cowboy:start_clear(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.start_clear/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.start_clear/ Name cowboy:start_clear - Listen for connections using plain TCP Description start_clear(Name :: ranch:ref(), TransportOpts :: ranch_tcp:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a clear TCP channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. HTTP/2 has two methods of establishing a connection over a clear TCP channel. Both the upgrade and the prior knowledge methods are supported. cowboy:start_clear(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.start_clear/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.start_clear/ Name cowboy:start_clear - Listen for connections using plain TCP Description start_clear(Name :: ranch:ref(), TransportOpts :: ranch_tcp:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a clear TCP channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. HTTP/2 has two methods of establishing a connection over a clear TCP channel. Both the upgrade and the prior knowledge methods are supported. cowboy:start_clear(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.start_clear/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.start_clear/ Name cowboy:start_clear - Listen for connections using plain TCP Description start_clear(Name :: ranch:ref(), TransportOpts :: ranch_tcp:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a clear TCP channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. HTTP/2 has two methods of establishing a connection over a clear TCP channel. Both the upgrade and the prior knowledge methods are supported. cowboy:start_clear(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.start_clear/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.start_clear/ Name cowboy:start_clear - Listen for connections using plain TCP Description start_clear(Name :: ranch:ref(), TransportOpts :: ranch_tcp:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a clear TCP channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. HTTP/2 has two methods of establishing a connection over a clear TCP channel. Both the upgrade and the prior knowledge methods are supported. cowboy:start_tls(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.start_tls/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.start_tls/ Name cowboy:start_tls - Listen for connections using TLS Description start_tls(Name :: ranch:ref(), TransportOpts :: ranch_ssl:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a secure TLS channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. The ALPN TLS extension must be used to initiate an HTTP/2 connection. Arguments Name The listener name is used to refer to this listener in future calls, for example when stopping it or when updating the routes defined. cowboy:start_tls(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.start_tls/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.start_tls/ Name cowboy:start_tls - Listen for connections using TLS Description start_tls(Name :: ranch:ref(), TransportOpts :: ranch_ssl:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a secure TLS channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. The ALPN TLS extension must be used to initiate an HTTP/2 connection. Arguments Name The listener name is used to refer to this listener in future calls, for example when stopping it or when updating the routes defined. cowboy:start_tls(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.start_tls/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.start_tls/ Name cowboy:start_tls - Listen for connections using TLS Description start_tls(Name :: ranch:ref(), TransportOpts :: ranch_ssl:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a secure TLS channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. The ALPN TLS extension must be used to initiate an HTTP/2 connection. Arguments Name The listener name is used to refer to this listener in future calls, for example when stopping it or when updating the routes defined. cowboy:start_tls(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.start_tls/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.start_tls/ Name cowboy:start_tls - Listen for connections using TLS Description start_tls(Name :: ranch:ref(), TransportOpts :: ranch_ssl:opts(), ProtocolOpts :: opts()) -> {ok, ListenerPid :: pid()} | {error, any()} Start listening for connections over a secure TLS channel. Both HTTP/1.1 and HTTP/2 are supported on this listener. The ALPN TLS extension must be used to initiate an HTTP/2 connection. Arguments Name The listener name is used to refer to this listener in future calls, for example when stopping it or when updating the routes defined. cowboy:stop_listener(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.stop_listener/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy.stop_listener/ Name cowboy:stop_listener - Stop the given listener Description stop_listener(Name :: ranch:ref()) -> ok | {error, not_found}. Stop a previously started listener. Alias of ranch:stop_listener(3). Arguments Name The name of the listener to be stopped. The name of the listener is the first argument given to the cowboy:start_clear(3), cowboy:start_tls(3) or ranch:start_listener(3) function. Return value The atom ok is returned on success. cowboy:stop_listener(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.stop_listener/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy.stop_listener/ Name cowboy:stop_listener - Stop the given listener Description stop_listener(Name :: ranch:ref()) -> ok | {error, not_found}. Stop a previously started listener. Alias of ranch:stop_listener(3). Arguments Name The name of the listener to be stopped. The name of the listener is the first argument given to the cowboy:start_clear(3), cowboy:start_tls(3) or ranch:start_listener(3) function. Return value The atom ok is returned on success. cowboy:stop_listener(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.stop_listener/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy.stop_listener/ Name cowboy:stop_listener - Stop the given listener Description stop_listener(Name :: ranch:ref()) -> ok | {error, not_found}. Stop a previously started listener. Alias of ranch:stop_listener(3). Arguments Name The name of the listener to be stopped. The name of the listener is the first argument given to the cowboy:start_clear(3), cowboy:start_tls(3) or ranch:start_listener(3) function. Return value The atom ok is returned on success. cowboy:stop_listener(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.stop_listener/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy.stop_listener/ Name cowboy:stop_listener - Stop the given listener Description stop_listener(Name :: ranch:ref()) -> ok | {error, not_found}. Stop a previously started listener. Alias of ranch:stop_listener(3). Arguments Name The name of the listener to be stopped. The name of the listener is the first argument given to the cowboy:start_clear(3), cowboy:start_tls(3) or ranch:start_listener(3) function. Return value The atom ok is returned on success. cowboy_constraints(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_constraints/ Name cowboy_constraints - Constraints Description The module cowboy_constraints defines the built-in constraints in Cowboy and provides an interface for manipulating these constraints. Constraints are functions that define what type of input is allowed. They are used throughout Cowboy, from the router to query strings to cookies. Exports Built-in constraints: cowboy_constraints:int(3) - Integer constraint cowboy_constraints:nonempty(3) - Non-empty constraint Types constraint() constraint() :: int | nonempty | fun() A constraint function. cowboy_constraints(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_constraints/ Name cowboy_constraints - Constraints Description The module cowboy_constraints defines the built-in constraints in Cowboy and provides an interface for manipulating these constraints. Constraints are functions that define what type of input is allowed. They are used throughout Cowboy, from the router to query strings to cookies. Exports Built-in constraints: cowboy_constraints:int(3) - Integer constraint cowboy_constraints:nonempty(3) - Non-empty constraint Types constraint() constraint() :: int | nonempty | fun() A constraint function. cowboy_constraints(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_constraints/ Name cowboy_constraints - Constraints Description The module cowboy_constraints defines the built-in constraints in Cowboy and provides an interface for manipulating these constraints. Constraints are functions that define what type of input is allowed. They are used throughout Cowboy, from the router to query strings to cookies. Exports Built-in constraints: cowboy_constraints:int(3) - Integer constraint cowboy_constraints:nonempty(3) - Non-empty constraint Types constraint() constraint() :: int | nonempty | fun() A constraint function. cowboy_constraints(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_constraints/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_constraints/ Name cowboy_constraints - Constraints Description The module cowboy_constraints defines the built-in constraints in Cowboy and provides an interface for manipulating these constraints. Constraints are functions that define what type of input is allowed. They are used throughout Cowboy, from the router to query strings to cookies. Exports Built-in constraints: cowboy_constraints:int(3) - Integer constraint cowboy_constraints:nonempty(3) - Non-empty constraint Types constraint() constraint() :: int | nonempty | fun() A constraint function. cowboy_constraints:int(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_constraints.int/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_constraints.int/ Name cowboy_constraints:int - Integer constraint Description Constraint functions implement a number of different operations. int(forward, Bin) -> {ok, Int} | {error, not_an_integer} Bin :: binary() Int :: integer() Validate and convert the text representation of an integer. int(reverse, Int) -> {ok, Bin} | {error, not_an_integer} Convert an integer back to its text representation. int(format_error, Error) -> HumanReadable Error :: {not_an_integer, Bin | Int} HumanReadable :: iolist() Generate a human-readable error message. cowboy_constraints:int(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_constraints.int/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_constraints.int/ Name cowboy_constraints:int - Integer constraint Description Constraint functions implement a number of different operations. int(forward, Bin) -> {ok, Int} | {error, not_an_integer} Bin :: binary() Int :: integer() Validate and convert the text representation of an integer. int(reverse, Int) -> {ok, Bin} | {error, not_an_integer} Convert an integer back to its text representation. int(format_error, Error) -> HumanReadable Error :: {not_an_integer, Bin | Int} HumanReadable :: iolist() Generate a human-readable error message. cowboy_constraints:int(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_constraints.int/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_constraints.int/ Name cowboy_constraints:int - Integer constraint Description Constraint functions implement a number of different operations. int(forward, Bin) -> {ok, Int} | {error, not_an_integer} Bin :: binary() Int :: integer() Validate and convert the text representation of an integer. int(reverse, Int) -> {ok, Bin} | {error, not_an_integer} Convert an integer back to its text representation. int(format_error, Error) -> HumanReadable Error :: {not_an_integer, Bin | Int} HumanReadable :: iolist() Generate a human-readable error message. cowboy_constraints:int(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_constraints.int/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_constraints.int/ Name cowboy_constraints:int - Integer constraint Description Constraint functions implement a number of different operations. int(forward, Bin) -> {ok, Int} | {error, not_an_integer} Bin :: binary() Int :: integer() Validate and convert the text representation of an integer. int(reverse, Int) -> {ok, Bin} | {error, not_an_integer} Convert an integer back to its text representation. int(format_error, Error) -> HumanReadable Error :: {not_an_integer, Bin | Int} HumanReadable :: iolist() Generate a human-readable error message. cowboy_constraints:nonempty(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_constraints.nonempty/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_constraints.nonempty/ Name cowboy_constraints:nonempty - Non-empty constraint Description Constraint functions implement a number of different operations. nonempty(forward | reverse, <<>>) -> {error, empty} Reject empty values. nonempty(forward | reverse, Bin) -> {ok, Bin} Bin :: binary() Accept any other binary values. nonempty(format_error, Error) -> HumanReadable Error :: {empty, Bin} HumanReadable :: iolist() Generate a human-readable error message. Arguments Arguments vary depending on the operation. cowboy_constraints:nonempty(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_constraints.nonempty/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_constraints.nonempty/ Name cowboy_constraints:nonempty - Non-empty constraint Description Constraint functions implement a number of different operations. nonempty(forward | reverse, <<>>) -> {error, empty} Reject empty values. nonempty(forward | reverse, Bin) -> {ok, Bin} Bin :: binary() Accept any other binary values. nonempty(format_error, Error) -> HumanReadable Error :: {empty, Bin} HumanReadable :: iolist() Generate a human-readable error message. Arguments Arguments vary depending on the operation. cowboy_constraints:nonempty(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_constraints.nonempty/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_constraints.nonempty/ Name cowboy_constraints:nonempty - Non-empty constraint Description Constraint functions implement a number of different operations. nonempty(forward | reverse, <<>>) -> {error, empty} Reject empty values. nonempty(forward | reverse, Bin) -> {ok, Bin} Bin :: binary() Accept any other binary values. nonempty(format_error, Error) -> HumanReadable Error :: {empty, Bin} HumanReadable :: iolist() Generate a human-readable error message. Arguments Arguments vary depending on the operation. cowboy_constraints:nonempty(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_constraints.nonempty/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_constraints.nonempty/ Name cowboy_constraints:nonempty - Non-empty constraint Description Constraint functions implement a number of different operations. nonempty(forward | reverse, <<>>) -> {error, empty} Reject empty values. nonempty(forward | reverse, Bin) -> {ok, Bin} Bin :: binary() Accept any other binary values. nonempty(format_error, Error) -> HumanReadable Error :: {empty, Bin} HumanReadable :: iolist() Generate a human-readable error message. Arguments Arguments vary depending on the operation. cowboy_handler(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_handler/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_handler/ Name cowboy_handler - Plain HTTP handlers Description The cowboy_handler middleware executes the handler selected by the router or any other preceding middleware. This middleware takes the handler module and initial state from the handler and handler_opts environment values, respectively. On completion, it adds a result value to the middleware environment, containing the return value of the terminate/3 callback (if defined) and ok otherwise. This module also defines a callback interface for handling HTTP requests. cowboy_handler(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_handler/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_handler/ Name cowboy_handler - Plain HTTP handlers Description The cowboy_handler middleware executes the handler selected by the router or any other preceding middleware. This middleware takes the handler module and initial state from the handler and handler_opts environment values, respectively. On completion, it adds a result value to the middleware environment, containing the return value of the terminate/3 callback (if defined) and ok otherwise. This module also defines a callback interface for handling HTTP requests. cowboy_handler(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_handler/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_handler/ Name cowboy_handler - Plain HTTP handlers Description The cowboy_handler middleware executes the handler selected by the router or any other preceding middleware. This middleware takes the handler module and initial state from the handler and handler_opts environment values, respectively. On completion, it adds a result value to the middleware environment, containing the return value of the terminate/3 callback (if defined) and ok otherwise. This module also defines a callback interface for handling HTTP requests. cowboy_handler(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_handler/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_handler/ Name cowboy_handler - Plain HTTP handlers Description The cowboy_handler middleware executes the handler selected by the router or any other preceding middleware. This middleware takes the handler module and initial state from the handler and handler_opts environment values, respectively. On completion, it adds a result value to the middleware environment, containing the return value of the terminate/3 callback (if defined) and ok otherwise. This module also defines a callback interface for handling HTTP requests. cowboy_handler:terminate(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_handler.terminate/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_handler.terminate/ Name cowboy_handler:terminate - Terminate the handler Description terminate(Reason, PartialReq, State, Handler) -> ok Reason :: any() PartialReq :: map() State :: any() Handler :: module() Call the optional terminate callback if it is defined. Make sure to use this function at the end of the execution of modules that implement custom handler behaviors. Arguments Reason Reason for termination. PartialReq The Req object. cowboy_handler:terminate(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_handler.terminate/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_handler.terminate/ Name cowboy_handler:terminate - Terminate the handler Description terminate(Reason, PartialReq, State, Handler) -> ok Reason :: any() PartialReq :: map() State :: any() Handler :: module() Call the optional terminate callback if it is defined. Make sure to use this function at the end of the execution of modules that implement custom handler behaviors. Arguments Reason Reason for termination. PartialReq The Req object. cowboy_handler:terminate(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_handler.terminate/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_handler.terminate/ Name cowboy_handler:terminate - Terminate the handler Description terminate(Reason, PartialReq, State, Handler) -> ok Reason :: any() PartialReq :: map() State :: any() Handler :: module() Call the optional terminate callback if it is defined. Make sure to use this function at the end of the execution of modules that implement custom handler behaviors. Arguments Reason Reason for termination. PartialReq The Req object. cowboy_handler:terminate(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_handler.terminate/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_handler.terminate/ Name cowboy_handler:terminate - Terminate the handler Description terminate(Reason, PartialReq, State, Handler) -> ok Reason :: any() PartialReq :: map() State :: any() Handler :: module() Call the optional terminate callback if it is defined. Make sure to use this function at the end of the execution of modules that implement custom handler behaviors. Arguments Reason Reason for termination. PartialReq The Req object. cowboy_http(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_http/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_http/ Name cowboy_http - HTTP/1.1 Description The module cowboy_http implements HTTP/1.1 and HTTP/1.0 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), idle_timeout => timeout(), inactivity_timeout => timeout(), max_empty_lines => non_neg_integer(), max_header_name_length => non_neg_integer(), max_header_value_length => non_neg_integer(), max_headers => non_neg_integer(), max_keepalive => non_neg_integer(), max_method_length => non_neg_integer(), max_request_line_length => non_neg_integer(), middlewares => [module()], request_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/1. cowboy_http(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_http/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_http/ Name cowboy_http - HTTP/1.1 Description The module cowboy_http implements HTTP/1.1 and HTTP/1.0 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), idle_timeout => timeout(), inactivity_timeout => timeout(), max_empty_lines => non_neg_integer(), max_header_name_length => non_neg_integer(), max_header_value_length => non_neg_integer(), max_headers => non_neg_integer(), max_keepalive => non_neg_integer(), max_method_length => non_neg_integer(), max_request_line_length => non_neg_integer(), middlewares => [module()], request_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/1. cowboy_http(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_http/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_http/ Name cowboy_http - HTTP/1.1 Description The module cowboy_http implements HTTP/1.1 and HTTP/1.0 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), idle_timeout => timeout(), inactivity_timeout => timeout(), max_empty_lines => non_neg_integer(), max_header_name_length => non_neg_integer(), max_header_value_length => non_neg_integer(), max_headers => non_neg_integer(), max_keepalive => non_neg_integer(), max_method_length => non_neg_integer(), max_request_line_length => non_neg_integer(), max_skip_body_length => non_neg_integer(), middlewares => [module()], request_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/1. cowboy_http(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_http/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_http/ Name cowboy_http - HTTP/1.1 Description The module cowboy_http implements HTTP/1.1 and HTTP/1.0 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), idle_timeout => timeout(), inactivity_timeout => timeout(), max_empty_lines => non_neg_integer(), max_header_name_length => non_neg_integer(), max_header_value_length => non_neg_integer(), max_headers => non_neg_integer(), max_keepalive => non_neg_integer(), max_method_length => non_neg_integer(), max_request_line_length => non_neg_integer(), max_skip_body_length => non_neg_integer(), middlewares => [module()], request_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/1. cowboy_http2(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_http2/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_http2/ Name cowboy_http2 - HTTP/2 Description The module cowboy_http2 implements HTTP/2 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), inactivity_timeout => timeout(), middlewares => [module()], preface_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/2 protocol. This configuration is passed to Cowboy when starting listeners using cowboy:start_clear/3 or cowboy:start_tls/3 functions. It can be updated without restarting listeners using the Ranch functions ranch:get_protocol_options/1 and ranch:set_protocol_options/2. cowboy_http2(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_http2/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_http2/ Name cowboy_http2 - HTTP/2 Description The module cowboy_http2 implements HTTP/2 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), inactivity_timeout => timeout(), middlewares => [module()], preface_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/2 protocol. This configuration is passed to Cowboy when starting listeners using cowboy:start_clear/3 or cowboy:start_tls/3 functions. It can be updated without restarting listeners using the Ranch functions ranch:get_protocol_options/1 and ranch:set_protocol_options/2. cowboy_http2(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_http2/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_http2/ Name cowboy_http2 - HTTP/2 Description The module cowboy_http2 implements HTTP/2 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), inactivity_timeout => timeout(), middlewares => [module()], preface_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/2 protocol. This configuration is passed to Cowboy when starting listeners using cowboy:start_clear/3 or cowboy:start_tls/3 functions. It can be updated without restarting listeners using the Ranch functions ranch:get_protocol_options/1 and ranch:set_protocol_options/2. cowboy_http2(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_http2/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_http2/ Name cowboy_http2 - HTTP/2 Description The module cowboy_http2 implements HTTP/2 as a Ranch protocol. Options opts() :: #{ connection_type => worker | supervisor, env => cowboy_middleware:env(), inactivity_timeout => timeout(), middlewares => [module()], preface_timeout => timeout(), shutdown_timeout => timeout(), stream_handlers => [module()] } Configuration for the HTTP/2 protocol. This configuration is passed to Cowboy when starting listeners using cowboy:start_clear/3 or cowboy:start_tls/3 functions. It can be updated without restarting listeners using the Ranch functions ranch:get_protocol_options/1 and ranch:set_protocol_options/2. cowboy_loop(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_loop/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_loop/ Name cowboy_loop - Loop handlers Description The module cowboy_loop defines a callback interface for long running HTTP connections. You should switch to this behavior for long polling, server-sent events and similar long-running requests. There are generally two usage patterns: Loop until receiving a specific message, then send a response and stop execution (for example long polling); Or initiate a response in init/2 and stream the body in info/3 as necessary (for example server-sent events). cowboy_loop(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_loop/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_loop/ Name cowboy_loop - Loop handlers Description The module cowboy_loop defines a callback interface for long running HTTP connections. You should switch to this behavior for long polling, server-sent events and similar long-running requests. There are generally two usage patterns: Loop until receiving a specific message, then send a response and stop execution (for example long polling); Or initiate a response in init/2 and stream the body in info/3 as necessary (for example server-sent events). cowboy_loop(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_loop/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_loop/ Name cowboy_loop - Loop handlers Description The module cowboy_loop defines a callback interface for long running HTTP connections. You should switch to this behavior for long polling, server-sent events and similar long-running requests. There are generally two usage patterns: Loop until receiving a specific message, then send a response and stop execution (for example long polling); Or initiate a response in init/2 and stream the body in info/3 as necessary (for example server-sent events). cowboy_loop(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_loop/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_loop/ Name cowboy_loop - Loop handlers Description The module cowboy_loop defines a callback interface for long running HTTP connections. You should switch to this behavior for long polling, server-sent events and similar long-running requests. There are generally two usage patterns: Loop until receiving a specific message, then send a response and stop execution (for example long polling); Or initiate a response in init/2 and stream the body in info/3 as necessary (for example server-sent events). cowboy_middleware(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_middleware/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_middleware/ Name cowboy_middleware - Middlewares Description The module cowboy_middleware defines a callback interface for Cowboy middlewares. Middlewares process the request sequentially in the order they are configured. Callbacks Middlewares implement the following interface: execute(Req, Env) -> {ok, Req, Env} | {suspend, module(), atom(), [any()]} | {stop, Req} Req :: cowboy_req:req() Env :: cowboy_middleware:env() The execute/2 is the only callback that needs to be implemented. cowboy_middleware(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_middleware/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_middleware/ Name cowboy_middleware - Middlewares Description The module cowboy_middleware defines a callback interface for Cowboy middlewares. Middlewares process the request sequentially in the order they are configured. Callbacks Middlewares implement the following interface: execute(Req, Env) -> {ok, Req, Env} | {suspend, module(), atom(), [any()]} | {stop, Req} Req :: cowboy_req:req() Env :: cowboy_middleware:env() The execute/2 is the only callback that needs to be implemented. cowboy_middleware(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_middleware/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_middleware/ Name cowboy_middleware - Middlewares Description The module cowboy_middleware defines a callback interface for Cowboy middlewares. Middlewares process the request sequentially in the order they are configured. Callbacks Middlewares implement the following interface: execute(Req, Env) -> {ok, Req, Env} | {suspend, module(), atom(), [any()]} | {stop, Req} Req :: cowboy_req:req() Env :: cowboy_middleware:env() The execute/2 is the only callback that needs to be implemented. cowboy_middleware(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_middleware/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_middleware/ Name cowboy_middleware - Middlewares Description The module cowboy_middleware defines a callback interface for Cowboy middlewares. Middlewares process the request sequentially in the order they are configured. Callbacks Middlewares implement the following interface: execute(Req, Env) -> {ok, Req, Env} | {suspend, module(), atom(), [any()]} | {stop, Req} Req :: cowboy_req:req() Env :: cowboy_middleware:env() The execute/2 is the only callback that needs to be implemented. cowboy_req(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req/ Name cowboy_req - HTTP request and response Description The module cowboy_req provides functions to access, manipulate and respond to requests. There are four types of functions in this module. They can be differentiated by their name and their return type: Type Name pattern Return type access no verb, parse_*, match_* Value question cowboy_req(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req/ Name cowboy_req - HTTP request and response Description The module cowboy_req provides functions to access, manipulate and respond to requests. There are four types of functions in this module. They can be differentiated by their name and their return type: Type Name pattern Return type access no verb, parse_*, match_* Value question cowboy_req(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req/ Name cowboy_req - HTTP request and response Description The module cowboy_req provides functions to access, manipulate and respond to requests. There are four types of functions in this module. They can be differentiated by their name and their return type: Type Name pattern Return type access no verb, parse_*, match_* Value question cowboy_req(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req/ Name cowboy_req - HTTP request and response Description The module cowboy_req provides functions to access, manipulate and respond to requests. There are four types of functions in this module. They can be differentiated by their name and their return type: Type Name pattern Return type access no verb, parse_*, match_* Value question cowboy_req:binding(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.binding/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.binding/ Name cowboy_req:binding - Access a value bound from the route Description binding(Name, Req) -> binding(Name, Req, undefined) binding(Name, Req, Default) -> any() | Default Name :: atom() Req :: cowboy_req:req() Default :: any() Return the value for the given binding. Arguments Name Desired binding name as an atom. Req The Req object. Default Default value returned when the binding is missing. cowboy_req:binding(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.binding/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.binding/ Name cowboy_req:binding - Access a value bound from the route Description binding(Name, Req) -> binding(Name, Req, undefined) binding(Name, Req, Default) -> any() | Default Name :: atom() Req :: cowboy_req:req() Default :: any() Return the value for the given binding. Arguments Name Desired binding name as an atom. Req The Req object. Default Default value returned when the binding is missing. cowboy_req:binding(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.binding/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.binding/ Name cowboy_req:binding - Access a value bound from the route Description binding(Name, Req) -> binding(Name, Req, undefined) binding(Name, Req, Default) -> any() | Default Name :: atom() Req :: cowboy_req:req() Default :: any() Return the value for the given binding. Arguments Name Desired binding name as an atom. Req The Req object. Default Default value returned when the binding is missing. cowboy_req:binding(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.binding/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.binding/ Name cowboy_req:binding - Access a value bound from the route Description binding(Name, Req) -> binding(Name, Req, undefined) binding(Name, Req, Default) -> any() | Default Name :: atom() Req :: cowboy_req:req() Default :: any() Return the value for the given binding. Arguments Name Desired binding name as an atom. Req The Req object. Default Default value returned when the binding is missing. cowboy_req:bindings(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.bindings/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.bindings/ Name cowboy_req:bindings - Access all values bound from the route Description bindings(Req :: cowboy_req:req()) -> cowboy_router:bindings() Return a map containing all bindings. Arguments Req The Req object. Return value By default values are case sensitive binary strings, however constraints may change the type of this value (for example automatically converting numbers to integer). Changelog 2. cowboy_req:bindings(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.bindings/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.bindings/ Name cowboy_req:bindings - Access all values bound from the route Description bindings(Req :: cowboy_req:req()) -> cowboy_router:bindings() Return a map containing all bindings. Arguments Req The Req object. Return value By default values are case sensitive binary strings, however constraints may change the type of this value (for example automatically converting numbers to integer). Changelog 2. cowboy_req:bindings(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.bindings/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.bindings/ Name cowboy_req:bindings - Access all values bound from the route Description bindings(Req :: cowboy_req:req()) -> cowboy_router:bindings() Return a map containing all bindings. Arguments Req The Req object. Return value By default values are case sensitive binary strings, however constraints may change the type of this value (for example automatically converting numbers to integer). Changelog 2. cowboy_req:bindings(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.bindings/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.bindings/ Name cowboy_req:bindings - Access all values bound from the route Description bindings(Req :: cowboy_req:req()) -> cowboy_router:bindings() Return a map containing all bindings. Arguments Req The Req object. Return value By default values are case sensitive binary strings, however constraints may change the type of this value (for example automatically converting numbers to integer). Changelog 2. cowboy_req:body_length(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.body_length/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.body_length/ Name cowboy_req:body_length - Body length Description body_length(Req :: cowboy_req:req()) -> undefined | non_neg_integer() Return the length of the request body. The length is not always known before reading the body. In those cases Cowboy will return undefined. The body length is available after the body has been fully read. Arguments Req The Req object. Return value The length of the request body, or undefined if it is not known. cowboy_req:body_length(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.body_length/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.body_length/ Name cowboy_req:body_length - Body length Description body_length(Req :: cowboy_req:req()) -> undefined | non_neg_integer() Return the length of the request body. The length is not always known before reading the body. In those cases Cowboy will return undefined. The body length is available after the body has been fully read. Arguments Req The Req object. Return value The length of the request body, or undefined if it is not known. cowboy_req:body_length(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.body_length/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.body_length/ Name cowboy_req:body_length - Body length Description body_length(Req :: cowboy_req:req()) -> undefined | non_neg_integer() Return the length of the request body. The length is not always known before reading the body. In those cases Cowboy will return undefined. The body length is available after the body has been fully read. Arguments Req The Req object. Return value The length of the request body, or undefined if it is not known. cowboy_req:body_length(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.body_length/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.body_length/ Name cowboy_req:body_length - Body length Description body_length(Req :: cowboy_req:req()) -> undefined | non_neg_integer() Return the length of the request body. The length is not always known before reading the body. In those cases Cowboy will return undefined. The body length is available after the body has been fully read. Arguments Req The Req object. Return value The length of the request body, or undefined if it is not known. cowboy_req:cert(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.cert/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.cert/ Name cowboy_req:cert - Client TLS certificate Description cert(Req :: cowboy_req:req()) -> binary() | undefined Return the peer’s TLS certificate. Using the default configuration this function will always return undefined. You need to explicitly configure Cowboy to request the client certificate. To do this you need to set the verify transport option to verify_peer: {ok, _} = cowboy:start_tls(example, [ {port, 8443}, {cert, "path/to/cert.pem"}, {verify, verify_peer} ], #{ env => #{dispatch => Dispatch} }). cowboy_req:cert(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.cert/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.cert/ Name cowboy_req:cert - Client TLS certificate Description cert(Req :: cowboy_req:req()) -> binary() | undefined Return the peer’s TLS certificate. Using the default configuration this function will always return undefined. You need to explicitly configure Cowboy to request the client certificate. To do this you need to set the verify transport option to verify_peer: {ok, _} = cowboy:start_tls(example, [ {port, 8443}, {cert, "path/to/cert.pem"}, {verify, verify_peer} ], #{ env => #{dispatch => Dispatch} }). cowboy_req:cert(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.cert/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.cert/ Name cowboy_req:cert - Client TLS certificate Description cert(Req :: cowboy_req:req()) -> binary() | undefined Return the peer’s TLS certificate. Using the default configuration this function will always return undefined. You need to explicitly configure Cowboy to request the client certificate. To do this you need to set the verify transport option to verify_peer: {ok, _} = cowboy:start_tls(example, [ {port, 8443}, {cert, "path/to/cert.pem"}, {verify, verify_peer} ], #{ env => #{dispatch => Dispatch} }). cowboy_req:delete_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.delete_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.delete_resp_header/ Name cowboy_req:delete_resp_header - Delete a response header Description delete_resp_header(Name, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Delete the given response header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:delete_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.delete_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.delete_resp_header/ Name cowboy_req:delete_resp_header - Delete a response header Description delete_resp_header(Name, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Delete the given response header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:delete_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.delete_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.delete_resp_header/ Name cowboy_req:delete_resp_header - Delete a response header Description delete_resp_header(Name, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Delete the given response header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:delete_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.delete_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.delete_resp_header/ Name cowboy_req:delete_resp_header - Delete a response header Description delete_resp_header(Name, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Delete the given response header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:has_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.has_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.has_body/ Name cowboy_req:has_body - Is there a request body? Description has_body(Req :: cowboy_req:req()) -> boolean() Return whether the request has a body. Arguments Req The Req object. Return value A boolean indicating whether the request has a body. Changelog 1.0: Function introduced. Examples Ensure the request has a body true = cowboy_req:has_body(Req). cowboy_req:has_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.has_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.has_body/ Name cowboy_req:has_body - Is there a request body? Description has_body(Req :: cowboy_req:req()) -> boolean() Return whether the request has a body. Arguments Req The Req object. Return value A boolean indicating whether the request has a body. Changelog 1.0: Function introduced. Examples Ensure the request has a body true = cowboy_req:has_body(Req). cowboy_req:has_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.has_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.has_body/ Name cowboy_req:has_body - Is there a request body? Description has_body(Req :: cowboy_req:req()) -> boolean() Return whether the request has a body. Arguments Req The Req object. Return value A boolean indicating whether the request has a body. Changelog 1.0: Function introduced. Examples Ensure the request has a body true = cowboy_req:has_body(Req). cowboy_req:has_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.has_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.has_body/ Name cowboy_req:has_body - Is there a request body? Description has_body(Req :: cowboy_req:req()) -> boolean() Return whether the request has a body. Arguments Req The Req object. Return value A boolean indicating whether the request has a body. Changelog 1.0: Function introduced. Examples Ensure the request has a body true = cowboy_req:has_body(Req). cowboy_req:has_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.has_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.has_resp_body/ Name cowboy_req:has_resp_body - Is there a response body? Description has_resp_body(Req :: cowboy_req:req()) -> boolean() Return whether a response body has been set. Arguments Req The Req object. Return value A boolean indicating whether a response body has been set. This function will return false when an empty response body has been set. Changelog 1. cowboy_req:has_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.has_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.has_resp_body/ Name cowboy_req:has_resp_body - Is there a response body? Description has_resp_body(Req :: cowboy_req:req()) -> boolean() Return whether a response body has been set. Arguments Req The Req object. Return value A boolean indicating whether a response body has been set. This function will return false when an empty response body has been set. Changelog 1. cowboy_req:has_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.has_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.has_resp_body/ Name cowboy_req:has_resp_body - Is there a response body? Description has_resp_body(Req :: cowboy_req:req()) -> boolean() Return whether a response body has been set. Arguments Req The Req object. Return value A boolean indicating whether a response body has been set. This function will return false when an empty response body has been set. Changelog 1. cowboy_req:has_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.has_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.has_resp_body/ Name cowboy_req:has_resp_body - Is there a response body? Description has_resp_body(Req :: cowboy_req:req()) -> boolean() Return whether a response body has been set. Arguments Req The Req object. Return value A boolean indicating whether a response body has been set. This function will return false when an empty response body has been set. Changelog 1. cowboy_req:has_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.has_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.has_resp_header/ Name cowboy_req:has_resp_header - Is the given response header set? Description has_resp_header(Name, Req :: cowboy_req:req()) -> boolean() Name :: binary() %% lowercase; case insensitive Return whether the given response header has been set. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:has_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.has_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.has_resp_header/ Name cowboy_req:has_resp_header - Is the given response header set? Description has_resp_header(Name, Req :: cowboy_req:req()) -> boolean() Name :: binary() %% lowercase; case insensitive Return whether the given response header has been set. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:has_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.has_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.has_resp_header/ Name cowboy_req:has_resp_header - Is the given response header set? Description has_resp_header(Name, Req :: cowboy_req:req()) -> boolean() Name :: binary() %% lowercase; case insensitive Return whether the given response header has been set. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:has_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.has_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.has_resp_header/ Name cowboy_req:has_resp_header - Is the given response header set? Description has_resp_header(Name, Req :: cowboy_req:req()) -> boolean() Name :: binary() %% lowercase; case insensitive Return whether the given response header has been set. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Arguments Name Header name as a lowercase binary string. cowboy_req:header(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.header/ Name cowboy_req:header - HTTP header Description header(Name, Req) -> header(Name, Req, undefined) header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:header(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.header/ Name cowboy_req:header - HTTP header Description header(Name, Req) -> header(Name, Req, undefined) header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:header(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.header/ Name cowboy_req:header - HTTP header Description header(Name, Req) -> header(Name, Req, undefined) header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:header(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.header/ Name cowboy_req:header - HTTP header Description header(Name, Req) -> header(Name, Req, undefined) header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:headers(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.headers/ Name cowboy_req:headers - HTTP headers Description headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all request headers. Request headers can also be obtained using pattern matching: #{headers := Headers} = Req. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2. cowboy_req:headers(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.headers/ Name cowboy_req:headers - HTTP headers Description headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all request headers. Request headers can also be obtained using pattern matching: #{headers := Headers} = Req. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2. cowboy_req:headers(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.headers/ Name cowboy_req:headers - HTTP headers Description headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all request headers. Request headers can also be obtained using pattern matching: #{headers := Headers} = Req. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2. cowboy_req:headers(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.headers/ Name cowboy_req:headers - HTTP headers Description headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all request headers. Request headers can also be obtained using pattern matching: #{headers := Headers} = Req. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2. cowboy_req:host(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.host/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.host/ Name cowboy_req:host - URI host name Description host(Req :: cowboy_req:req()) -> Host :: binary() Return the host name of the effective request URI. The host name can also be obtained using pattern matching: #{host := Host} = Req. Arguments Req The Req object. Return value The host name is returned as a lowercase binary string. It is case insensitive. cowboy_req:host(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.host/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.host/ Name cowboy_req:host - URI host name Description host(Req :: cowboy_req:req()) -> Host :: binary() Return the host name of the effective request URI. The host name can also be obtained using pattern matching: #{host := Host} = Req. Arguments Req The Req object. Return value The host name is returned as a lowercase binary string. It is case insensitive. cowboy_req:host(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.host/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.host/ Name cowboy_req:host - URI host name Description host(Req :: cowboy_req:req()) -> Host :: binary() Return the host name of the effective request URI. The host name can also be obtained using pattern matching: #{host := Host} = Req. Arguments Req The Req object. Return value The host name is returned as a lowercase binary string. It is case insensitive. cowboy_req:host(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.host/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.host/ Name cowboy_req:host - URI host name Description host(Req :: cowboy_req:req()) -> Host :: binary() Return the host name of the effective request URI. The host name can also be obtained using pattern matching: #{host := Host} = Req. Arguments Req The Req object. Return value The host name is returned as a lowercase binary string. It is case insensitive. cowboy_req:host_info(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.host_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.host_info/ Name cowboy_req:host_info - Access the route’s heading host segments Description host_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the heading host segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case insensitive binary strings. cowboy_req:host_info(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.host_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.host_info/ Name cowboy_req:host_info - Access the route’s heading host segments Description host_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the heading host segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case insensitive binary strings. cowboy_req:host_info(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.host_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.host_info/ Name cowboy_req:host_info - Access the route’s heading host segments Description host_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the heading host segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case insensitive binary strings. cowboy_req:host_info(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.host_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.host_info/ Name cowboy_req:host_info - Access the route’s heading host segments Description host_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the heading host segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case insensitive binary strings. cowboy_req:inform(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.inform/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.inform/ Name cowboy_req:inform - Send an informational response Description inform(Status, Req :: cowboy_req:req()) -> inform(StatusCode, #{}, Req) inform(Status, Headers, Req :: cowboy_req:req()) -> ok Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send an informational response. Informational responses use a status code between 100 and 199. They cannot include a body. This function will not use any of the previously set headers. All headers to be sent must be given directly. cowboy_req:inform(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.inform/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.inform/ Name cowboy_req:inform - Send an informational response Description inform(Status, Req :: cowboy_req:req()) -> inform(StatusCode, #{}, Req) inform(Status, Headers, Req :: cowboy_req:req()) -> ok Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send an informational response. Informational responses use a status code between 100 and 199. They cannot include a body. This function will not use any of the previously set headers. All headers to be sent must be given directly. cowboy_req:inform(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.inform/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.inform/ Name cowboy_req:inform - Send an informational response Description inform(Status, Req :: cowboy_req:req()) -> inform(StatusCode, #{}, Req) inform(Status, Headers, Req :: cowboy_req:req()) -> ok Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send an informational response. Informational responses use a status code between 100 and 199. They cannot include a body. This function will not use any of the previously set headers. All headers to be sent must be given directly. cowboy_req:match_cookies(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.match_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.match_cookies/ Name cowboy_req:match_cookies - Match cookies against constraints Description match_cookies(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the cookies and match specific values against constraints. Cowboy will only return the cookie values specified in the fields list, and ignore all others. Fields can be either the name of the cookie requested; the name along with a list of constraints; or the name, a list of constraints and a default value in case the cookie is missing. cowboy_req:match_cookies(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.match_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.match_cookies/ Name cowboy_req:match_cookies - Match cookies against constraints Description match_cookies(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the cookies and match specific values against constraints. Cowboy will only return the cookie values specified in the fields list, and ignore all others. Fields can be either the name of the cookie requested; the name along with a list of constraints; or the name, a list of constraints and a default value in case the cookie is missing. cowboy_req:match_cookies(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.match_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.match_cookies/ Name cowboy_req:match_cookies - Match cookies against constraints Description match_cookies(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the cookies and match specific values against constraints. Cowboy will only return the cookie values specified in the fields list, and ignore all others. Fields can be either the name of the cookie requested; the name along with a list of constraints; or the name, a list of constraints and a default value in case the cookie is missing. cowboy_req:match_cookies(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.match_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.match_cookies/ Name cowboy_req:match_cookies - Match cookies against constraints Description match_cookies(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the cookies and match specific values against constraints. Cowboy will only return the cookie values specified in the fields list, and ignore all others. Fields can be either the name of the cookie requested; the name along with a list of constraints; or the name, a list of constraints and a default value in case the cookie is missing. cowboy_req:match_qs(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.match_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.match_qs/ Name cowboy_req:match_qs - Match the query string against constraints Description match_qs(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the query string and match specific values against constraints. Cowboy will only return the query string values specified in the fields list, and ignore all others. Fields can be either the key requested; the key along with a list of constraints; or the key, a list of constraints and a default value in case the key is missing. cowboy_req:match_qs(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.match_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.match_qs/ Name cowboy_req:match_qs - Match the query string against constraints Description match_qs(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the query string and match specific values against constraints. Cowboy will only return the query string values specified in the fields list, and ignore all others. Fields can be either the key requested; the key along with a list of constraints; or the key, a list of constraints and a default value in case the key is missing. cowboy_req:match_qs(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.match_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.match_qs/ Name cowboy_req:match_qs - Match the query string against constraints Description match_qs(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the query string and match specific values against constraints. Cowboy will only return the query string values specified in the fields list, and ignore all others. Fields can be either the key requested; the key along with a list of constraints; or the key, a list of constraints and a default value in case the key is missing. cowboy_req:match_qs(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.match_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.match_qs/ Name cowboy_req:match_qs - Match the query string against constraints Description match_qs(Fields :: cowboy:fields(), Req :: cowboy_req:req()) -> #{atom() => any()} Parse the query string and match specific values against constraints. Cowboy will only return the query string values specified in the fields list, and ignore all others. Fields can be either the key requested; the key along with a list of constraints; or the key, a list of constraints and a default value in case the key is missing. cowboy_req:method(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.method/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.method/ Name cowboy_req:method - HTTP method Description method(Req :: cowboy_req:req()) -> Method :: binary() Return the request’s HTTP method. The method can also be obtained using pattern matching: #{method := Method} = Req. Arguments Req The Req object. Return value The request’s HTTP method is returned as a binary string. While methods are case sensitive, standard methods are always uppercase. cowboy_req:method(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.method/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.method/ Name cowboy_req:method - HTTP method Description method(Req :: cowboy_req:req()) -> Method :: binary() Return the request’s HTTP method. The method can also be obtained using pattern matching: #{method := Method} = Req. Arguments Req The Req object. Return value The request’s HTTP method is returned as a binary string. While methods are case sensitive, standard methods are always uppercase. cowboy_req:method(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.method/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.method/ Name cowboy_req:method - HTTP method Description method(Req :: cowboy_req:req()) -> Method :: binary() Return the request’s HTTP method. The method can also be obtained using pattern matching: #{method := Method} = Req. Arguments Req The Req object. Return value The request’s HTTP method is returned as a binary string. While methods are case sensitive, standard methods are always uppercase. cowboy_req:method(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.method/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.method/ Name cowboy_req:method - HTTP method Description method(Req :: cowboy_req:req()) -> Method :: binary() Return the request’s HTTP method. The method can also be obtained using pattern matching: #{method := Method} = Req. Arguments Req The Req object. Return value The request’s HTTP method is returned as a binary string. While methods are case sensitive, standard methods are always uppercase. cowboy_req:parse_cookies(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.parse_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.parse_cookies/ Name cowboy_req:parse_cookies - Parse cookie headers Description parse_cookies(Req) -> [{Name, Value}] Name :: binary() %% case sensitive Value :: binary() %% case sensitive Parse cookie headers. Alias for cowboy_req:parse_header([cookie], Req). When the cookie header is missing, [] is returned. While an empty cookie header is not valid, some clients do send it. Cowboy will in this case also return []. Arguments Req The Req object. cowboy_req:parse_cookies(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.parse_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.parse_cookies/ Name cowboy_req:parse_cookies - Parse cookie headers Description parse_cookies(Req) -> [{Name, Value}] Name :: binary() %% case sensitive Value :: binary() %% case sensitive Parse cookie headers. Alias for cowboy_req:parse_header([cookie], Req). When the cookie header is missing, [] is returned. While an empty cookie header is not valid, some clients do send it. Cowboy will in this case also return []. Arguments Req The Req object. cowboy_req:parse_cookies(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.parse_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.parse_cookies/ Name cowboy_req:parse_cookies - Parse cookie headers Description parse_cookies(Req) -> [{Name, Value}] Name :: binary() %% case sensitive Value :: binary() %% case sensitive Parse cookie headers. Alias for cowboy_req:parse_header([cookie], Req). When the cookie header is missing, [] is returned. While an empty cookie header is not valid, some clients do send it. Cowboy will in this case also return []. Arguments Req The Req object. cowboy_req:parse_cookies(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.parse_cookies/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.parse_cookies/ Name cowboy_req:parse_cookies - Parse cookie headers Description parse_cookies(Req) -> [{Name, Value}] Name :: binary() %% case sensitive Value :: binary() %% case sensitive Parse cookie headers. Alias for cowboy_req:parse_header([cookie], Req). When the cookie header is missing, [] is returned. While an empty cookie header is not valid, some clients do send it. Cowboy will in this case also return []. Arguments Req The Req object. cowboy_req:parse_header(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.parse_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.parse_header/ Name cowboy_req:parse_header - Parse the given HTTP header Description parse_header(Name, Req) -> ParsedValue | Default parse_header(Name, Req, Default) -> ParsedValue | Default Name :: binary() Req :: cowboy_req:req() ParsedValue :: any() Default :: any() Parse the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:parse_header(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.parse_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.parse_header/ Name cowboy_req:parse_header - Parse the given HTTP header Description parse_header(Name, Req) -> ParsedValue | Default parse_header(Name, Req, Default) -> ParsedValue | Default Name :: binary() Req :: cowboy_req:req() ParsedValue :: any() Default :: any() Parse the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:parse_header(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.parse_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.parse_header/ Name cowboy_req:parse_header - Parse the given HTTP header Description parse_header(Name, Req) -> ParsedValue | Default parse_header(Name, Req, Default) -> ParsedValue | Default Name :: binary() Req :: cowboy_req:req() ParsedValue :: any() Default :: any() Parse the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:parse_header(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.parse_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.parse_header/ Name cowboy_req:parse_header - Parse the given HTTP header Description parse_header(Name, Req) -> ParsedValue | Default parse_header(Name, Req, Default) -> ParsedValue | Default Name :: binary() Req :: cowboy_req:req() ParsedValue :: any() Default :: any() Parse the given HTTP header. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:parse_qs(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.parse_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.parse_qs/ Name cowboy_req:parse_qs - Parse the query string Description parse_qs(Req :: cowboy_req:req()) -> [{Key :: binary(), Value :: binary() | true}] Parse the query string as a list of key/value pairs. Arguments Req The Req object. Return value The parsed query string is returned as a list of key/value pairs. The key is a binary string. The value is either a binary string, or the atom true. cowboy_req:parse_qs(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.parse_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.parse_qs/ Name cowboy_req:parse_qs - Parse the query string Description parse_qs(Req :: cowboy_req:req()) -> [{Key :: binary(), Value :: binary() | true}] Parse the query string as a list of key/value pairs. Arguments Req The Req object. Return value The parsed query string is returned as a list of key/value pairs. The key is a binary string. The value is either a binary string, or the atom true. cowboy_req:parse_qs(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.parse_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.parse_qs/ Name cowboy_req:parse_qs - Parse the query string Description parse_qs(Req :: cowboy_req:req()) -> [{Key :: binary(), Value :: binary() | true}] Parse the query string as a list of key/value pairs. Arguments Req The Req object. Return value The parsed query string is returned as a list of key/value pairs. The key is a binary string. The value is either a binary string, or the atom true. cowboy_req:parse_qs(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.parse_qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.parse_qs/ Name cowboy_req:parse_qs - Parse the query string Description parse_qs(Req :: cowboy_req:req()) -> [{Key :: binary(), Value :: binary() | true}] Parse the query string as a list of key/value pairs. Arguments Req The Req object. Return value The parsed query string is returned as a list of key/value pairs. The key is a binary string. The value is either a binary string, or the atom true. cowboy_req:path(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.path/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.path/ Name cowboy_req:path - URI path Description path(Req :: cowboy_req:req()) -> Path :: binary() Return the path of the effective request URI. The path can also be obtained using pattern matching: #{path := Path} = Req. Arguments Req The Req object. Return value The path is returned as a binary string. It is case sensitive. Changelog 2. cowboy_req:path(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.path/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.path/ Name cowboy_req:path - URI path Description path(Req :: cowboy_req:req()) -> Path :: binary() Return the path of the effective request URI. The path can also be obtained using pattern matching: #{path := Path} = Req. Arguments Req The Req object. Return value The path is returned as a binary string. It is case sensitive. Changelog 2. cowboy_req:path(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.path/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.path/ Name cowboy_req:path - URI path Description path(Req :: cowboy_req:req()) -> Path :: binary() Return the path of the effective request URI. The path can also be obtained using pattern matching: #{path := Path} = Req. Arguments Req The Req object. Return value The path is returned as a binary string. It is case sensitive. Changelog 2. cowboy_req:path(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.path/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.path/ Name cowboy_req:path - URI path Description path(Req :: cowboy_req:req()) -> Path :: binary() Return the path of the effective request URI. The path can also be obtained using pattern matching: #{path := Path} = Req. Arguments Req The Req object. Return value The path is returned as a binary string. It is case sensitive. Changelog 2. cowboy_req:path_info(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.path_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.path_info/ Name cowboy_req:path_info - Access the route’s trailing path segments Description path_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the trailing path segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case sensitive binary strings. cowboy_req:path_info(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.path_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.path_info/ Name cowboy_req:path_info - Access the route’s trailing path segments Description path_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the trailing path segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case sensitive binary strings. cowboy_req:path_info(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.path_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.path_info/ Name cowboy_req:path_info - Access the route’s trailing path segments Description path_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the trailing path segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case sensitive binary strings. cowboy_req:path_info(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.path_info/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.path_info/ Name cowboy_req:path_info - Access the route’s trailing path segments Description path_info(Req :: cowboy_req:req()) -> cowboy_router:tokens() Return the tokens for the trailing path segments. This is the part of the host name that was matched using the ... notation. Arguments Req The Req object. Return value The tokens are returned as a list of case sensitive binary strings. cowboy_req:peer(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.peer/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.peer/ Name cowboy_req:peer - Peer address and port Description peer(Req :: cowboy_req:req()) -> Peer Peer :: {inet:ip_address(), inet:port_number()} Return the peer’s IP address and port number. The peer can also be obtained using pattern matching: #{peer := {IP, Port}} = Req. Arguments Req The Req object. Return value The peer’s IP address and port number. The peer is not necessarily the client’s IP address and port. cowboy_req:peer(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.peer/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.peer/ Name cowboy_req:peer - Peer address and port Description peer(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()} Return the peer’s IP address and port number. The peer information can also be obtained using pattern matching: #{peer := {IP, Port}} = Req. Arguments Req The Req object. Return value The peer’s IP address and port number. cowboy_req:peer(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.peer/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.peer/ Name cowboy_req:peer - Peer address and port Description peer(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()} Return the peer’s IP address and port number. The peer information can also be obtained using pattern matching: #{peer := {IP, Port}} = Req. Arguments Req The Req object. Return value The peer’s IP address and port number. cowboy_req:peer(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.peer/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.peer/ Name cowboy_req:peer - Peer address and port Description peer(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()} Return the peer’s IP address and port number. The peer information can also be obtained using pattern matching: #{peer := {IP, Port}} = Req. Arguments Req The Req object. Return value The peer’s IP address and port number. cowboy_req:port(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.port/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.port/ Name cowboy_req:port - URI port number Description port(Req :: cowboy_req:req()) -> Port :: inet:port_number() Return the port number of the effective request URI. Note that the port number returned by this function is obtained by parsing the host header. It may be different from the port the peer used to connect to Cowboy. The port number can also be obtained using pattern matching: #{port := Port} = Req. cowboy_req:port(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.port/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.port/ Name cowboy_req:port - URI port number Description port(Req :: cowboy_req:req()) -> Port :: inet:port_number() Return the port number of the effective request URI. Note that the port number returned by this function is obtained by parsing the host header. It may be different from the port the peer used to connect to Cowboy. The port number can also be obtained using pattern matching: #{port := Port} = Req. cowboy_req:port(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.port/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.port/ Name cowboy_req:port - URI port number Description port(Req :: cowboy_req:req()) -> Port :: inet:port_number() Return the port number of the effective request URI. Note that the port number returned by this function is obtained by parsing the host header. It may be different from the port the peer used to connect to Cowboy. The port number can also be obtained using pattern matching: #{port := Port} = Req. cowboy_req:port(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.port/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.port/ Name cowboy_req:port - URI port number Description port(Req :: cowboy_req:req()) -> Port :: inet:port_number() Return the port number of the effective request URI. Note that the port number returned by this function is obtained by parsing the host header. It may be different from the port the peer used to connect to Cowboy. The port number can also be obtained using pattern matching: #{port := Port} = Req. cowboy_req:push(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.push/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.push/ Name cowboy_req:push - Push a resource to the client Description push(Path, Headers, Req :: cowboy_req:req()) -> push(Path, Headers, Req, #{}) push(Path, Headers, Req :: cowboy_req:req(), Opts) -> ok Path :: iodata() %% case sensitive Headers :: cowboy:http_headers() Opts :: cowboy_req:push_opts() Push a resource to the client. Cowboy handles push requests the same way as if they came from the client, including the creation of a request handling process, routing and middlewares and so on. cowboy_req:push(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.push/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.push/ Name cowboy_req:push - Push a resource to the client Description push(Path, Headers, Req :: cowboy_req:req()) -> push(Path, Headers, Req, #{}) push(Path, Headers, Req :: cowboy_req:req(), Opts) -> ok Path :: iodata() %% case sensitive Headers :: cowboy:http_headers() Opts :: cowboy_req:push_opts() Push a resource to the client. Cowboy handles push requests the same way as if they came from the client, including the creation of a request handling process, routing and middlewares and so on. cowboy_req:push(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.push/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.push/ Name cowboy_req:push - Push a resource to the client Description push(Path, Headers, Req :: cowboy_req:req()) -> push(Path, Headers, Req, #{}) push(Path, Headers, Req :: cowboy_req:req(), Opts) -> ok Path :: iodata() %% case sensitive Headers :: cowboy:http_headers() Opts :: cowboy_req:push_opts() Push a resource to the client. Cowboy handles push requests the same way as if they came from the client, including the creation of a request handling process, routing and middlewares and so on. cowboy_req:push(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.push/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.push/ Name cowboy_req:push - Push a resource to the client Description push(Path, Headers, Req :: cowboy_req:req()) -> push(Path, Headers, Req, #{}) push(Path, Headers, Req :: cowboy_req:req(), Opts) -> ok Path :: iodata() %% case sensitive Headers :: cowboy:http_headers() Opts :: cowboy_req:push_opts() Push a resource to the client. Cowboy handles push requests the same way as if they came from the client, including the creation of a request handling process, routing and middlewares and so on. cowboy_req:qs(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.qs/ Name cowboy_req:qs - URI query string Description qs(Req :: cowboy_req:req()) -> Qs :: binary() Return the query string of the effective request URI. The query string can also be obtained using pattern matching: #{qs := Qs} = Req. Arguments Req The Req object. Return value The query string is returned as a binary string. It is case sensitive. cowboy_req:qs(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.qs/ Name cowboy_req:qs - URI query string Description qs(Req :: cowboy_req:req()) -> Qs :: binary() Return the query string of the effective request URI. The query string can also be obtained using pattern matching: #{qs := Qs} = Req. Arguments Req The Req object. Return value The query string is returned as a binary string. It is case sensitive. cowboy_req:qs(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.qs/ Name cowboy_req:qs - URI query string Description qs(Req :: cowboy_req:req()) -> Qs :: binary() Return the query string of the effective request URI. The query string can also be obtained using pattern matching: #{qs := Qs} = Req. Arguments Req The Req object. Return value The query string is returned as a binary string. It is case sensitive. cowboy_req:qs(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.qs/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.qs/ Name cowboy_req:qs - URI query string Description qs(Req :: cowboy_req:req()) -> Qs :: binary() Return the query string of the effective request URI. The query string can also be obtained using pattern matching: #{qs := Qs} = Req. Arguments Req The Req object. Return value The query string is returned as a binary string. It is case sensitive. cowboy_req:read_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_body/ Name cowboy_req:read_body - Read the request body Description read_body(Req :: cowboy_req:req()) -> read_body(Req, #{}) read_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the request body. This function reads a chunk of the request body. A more tuple is returned when more data remains to be read. Call the function repeatedly until an ok tuple is returned to read the entire body. cowboy_req:read_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_body/ Name cowboy_req:read_body - Read the request body Description read_body(Req :: cowboy_req:req()) -> read_body(Req, #{}) read_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the request body. This function reads a chunk of the request body. A more tuple is returned when more data remains to be read. Call the function repeatedly until an ok tuple is returned to read the entire body. cowboy_req:read_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_body/ Name cowboy_req:read_body - Read the request body Description read_body(Req :: cowboy_req:req()) -> read_body(Req, #{}) read_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the request body. This function reads a chunk of the request body. A more tuple is returned when more data remains to be read. Call the function repeatedly until an ok tuple is returned to read the entire body. cowboy_req:read_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_body/ Name cowboy_req:read_body - Read the request body Description read_body(Req :: cowboy_req:req()) -> read_body(Req, #{}) read_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the request body. This function reads a chunk of the request body. A more tuple is returned when more data remains to be read. Call the function repeatedly until an ok tuple is returned to read the entire body. cowboy_req:read_part(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_part/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_part/ Name cowboy_req:read_part - Read the next multipart headers Description read_part(Req :: cowboy_req:req()) -> read_part(Req, #{}) read_part(Req :: cowboy_req:req(), Opts) -> {ok, Headers, Req} | {done, Req} Opts :: cowboy_req:read_body_opts() Headers :: #{binary() => binary()} Read the next part of a multipart body. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. This function parses and returns headers. cowboy_req:read_part(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_part/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_part/ Name cowboy_req:read_part - Read the next multipart headers Description read_part(Req :: cowboy_req:req()) -> read_part(Req, #{}) read_part(Req :: cowboy_req:req(), Opts) -> {ok, Headers, Req} | {done, Req} Opts :: cowboy_req:read_body_opts() Headers :: #{binary() => binary()} Read the next part of a multipart body. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. This function parses and returns headers. cowboy_req:read_part(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_part/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_part/ Name cowboy_req:read_part - Read the next multipart headers Description read_part(Req :: cowboy_req:req()) -> read_part(Req, #{}) read_part(Req :: cowboy_req:req(), Opts) -> {ok, Headers, Req} | {done, Req} Opts :: cowboy_req:read_body_opts() Headers :: #{binary() => binary()} Read the next part of a multipart body. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. This function parses and returns headers. cowboy_req:read_part(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_part/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_part/ Name cowboy_req:read_part - Read the next multipart headers Description read_part(Req :: cowboy_req:req()) -> read_part(Req, #{}) read_part(Req :: cowboy_req:req(), Opts) -> {ok, Headers, Req} | {done, Req} Opts :: cowboy_req:read_body_opts() Headers :: #{binary() => binary()} Read the next part of a multipart body. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. This function parses and returns headers. cowboy_req:read_part_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_part_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_part_body/ Name cowboy_req:read_part_body - Read the current part’s body Description read_part_body(Req :: cowboy_req:req()) -> read_part_body(Req, #{}) read_part_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the body of the current part of the multipart message. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. cowboy_req:read_part_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_part_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_part_body/ Name cowboy_req:read_part_body - Read the current part’s body Description read_part_body(Req :: cowboy_req:req()) -> read_part_body(Req, #{}) read_part_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the body of the current part of the multipart message. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. cowboy_req:read_part_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_part_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_part_body/ Name cowboy_req:read_part_body - Read the current part’s body Description read_part_body(Req :: cowboy_req:req()) -> read_part_body(Req, #{}) read_part_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the body of the current part of the multipart message. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. cowboy_req:read_part_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_part_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_part_body/ Name cowboy_req:read_part_body - Read the current part’s body Description read_part_body(Req :: cowboy_req:req()) -> read_part_body(Req, #{}) read_part_body(Req :: cowboy_req:req(), Opts) -> {ok, Data :: binary(), Req} | {more, Data :: binary(), Req} Opts :: cowboy_req:read_body_opts() Read the body of the current part of the multipart message. This function reads the request body and parses it as multipart. Each parts of a multipart representation have their own headers and body. cowboy_req:read_urlencoded_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_urlencoded_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.read_urlencoded_body/ Name cowboy_req:read_urlencoded_body - Read and parse a urlencoded request body Description read_urlencoded_body(Req :: cowboy_req:req()) -> read_urlencoded_body(Req, #{}) read_urlencoded_body(Req :: cowboy_req:req(), Opts) -> {ok, Body, Req} Opts :: cowboy_req:read_body_opts() Body :: [{Key :: binary(), Value :: binary() | true}] Read and parse a urlencoded request body. This function reads the request body and parses it as application/x-www-form-urlencoded. It returns a list of key/values. The urlencoded media type is used by Web browsers when submitting HTML forms using the POST method. cowboy_req:read_urlencoded_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_urlencoded_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.read_urlencoded_body/ Name cowboy_req:read_urlencoded_body - Read and parse a urlencoded request body Description read_urlencoded_body(Req :: cowboy_req:req()) -> read_urlencoded_body(Req, #{}) read_urlencoded_body(Req :: cowboy_req:req(), Opts) -> {ok, Body, Req} Opts :: cowboy_req:read_body_opts() Body :: [{Key :: binary(), Value :: binary() | true}] Read and parse a urlencoded request body. This function reads the request body and parses it as application/x-www-form-urlencoded. It returns a list of key/values. The urlencoded media type is used by Web browsers when submitting HTML forms using the POST method. cowboy_req:read_urlencoded_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_urlencoded_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.read_urlencoded_body/ Name cowboy_req:read_urlencoded_body - Read and parse a urlencoded request body Description read_urlencoded_body(Req :: cowboy_req:req()) -> read_urlencoded_body(Req, #{}) read_urlencoded_body(Req :: cowboy_req:req(), Opts) -> {ok, Body, Req} Opts :: cowboy_req:read_body_opts() Body :: [{Key :: binary(), Value :: binary() | true}] Read and parse a urlencoded request body. This function reads the request body and parses it as application/x-www-form-urlencoded. It returns a list of key/values. The urlencoded media type is used by Web browsers when submitting HTML forms using the POST method. cowboy_req:read_urlencoded_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_urlencoded_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.read_urlencoded_body/ Name cowboy_req:read_urlencoded_body - Read and parse a urlencoded request body Description read_urlencoded_body(Req :: cowboy_req:req()) -> read_urlencoded_body(Req, #{}) read_urlencoded_body(Req :: cowboy_req:req(), Opts) -> {ok, Body, Req} Opts :: cowboy_req:read_body_opts() Body :: [{Key :: binary(), Value :: binary() | true}] Read and parse a urlencoded request body. This function reads the request body and parses it as application/x-www-form-urlencoded. It returns a list of key/values. The urlencoded media type is used by Web browsers when submitting HTML forms using the POST method. cowboy_req:reply(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.reply/ Name cowboy_req:reply - Send the response Description reply(Status, Req :: cowboy_req:req()) -> reply(StatusCode, #{}, Req) reply(Status, Headers, Req :: cowboy_req:req()) -> Req reply(Status, Headers, Body, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Body :: cowboy_req:resp_body() Send the response. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:reply(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.reply/ Name cowboy_req:reply - Send the response Description reply(Status, Req :: cowboy_req:req()) -> reply(StatusCode, #{}, Req) reply(Status, Headers, Req :: cowboy_req:req()) -> Req reply(Status, Headers, Body, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Body :: cowboy_req:resp_body() Send the response. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:reply(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.reply/ Name cowboy_req:reply - Send the response Description reply(Status, Req :: cowboy_req:req()) -> reply(StatusCode, #{}, Req) reply(Status, Headers, Req :: cowboy_req:req()) -> Req reply(Status, Headers, Body, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Body :: cowboy_req:resp_body() Send the response. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:reply(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.reply/ Name cowboy_req:reply - Send the response Description reply(Status, Req :: cowboy_req:req()) -> reply(StatusCode, #{}, Req) reply(Status, Headers, Req :: cowboy_req:req()) -> Req reply(Status, Headers, Body, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Body :: cowboy_req:resp_body() Send the response. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:resp_header(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.resp_header/ Name cowboy_req:resp_header - Response header Description resp_header(Name, Req) -> resp_header(Name, Req, undefined) resp_header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given response header. The response header must have been set previously using cowboy_req:set_resp_header(3) or cowboy_req:set_resp_headers(3). The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:resp_header(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.resp_header/ Name cowboy_req:resp_header - Response header Description resp_header(Name, Req) -> resp_header(Name, Req, undefined) resp_header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given response header. The response header must have been set previously using cowboy_req:set_resp_header(3) or cowboy_req:set_resp_headers(3). The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:resp_header(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.resp_header/ Name cowboy_req:resp_header - Response header Description resp_header(Name, Req) -> resp_header(Name, Req, undefined) resp_header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given response header. The response header must have been set previously using cowboy_req:set_resp_header(3) or cowboy_req:set_resp_headers(3). The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:resp_header(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.resp_header/ Name cowboy_req:resp_header - Response header Description resp_header(Name, Req) -> resp_header(Name, Req, undefined) resp_header(Name, Req, Default) -> binary() | Default Name :: binary() %% lowercase; case insensitive Req :: cowboy_req:req() Default :: any() Return the value for the given response header. The response header must have been set previously using cowboy_req:set_resp_header(3) or cowboy_req:set_resp_headers(3). The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.resp_headers/ Name cowboy_req:resp_headers - Response headers Description resp_headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all response headers. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2.0: Function introduced. Examples Get all response headers Headers = cowboy_req:resp_headers(Req). cowboy_req:resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.resp_headers/ Name cowboy_req:resp_headers - Response headers Description resp_headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all response headers. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2.0: Function introduced. Examples Get all response headers Headers = cowboy_req:resp_headers(Req). cowboy_req:resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.resp_headers/ Name cowboy_req:resp_headers - Response headers Description resp_headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all response headers. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2.0: Function introduced. Examples Get all response headers Headers = cowboy_req:resp_headers(Req). cowboy_req:resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.resp_headers/ Name cowboy_req:resp_headers - Response headers Description resp_headers(Req :: cowboy_req:req()) -> cowboy:http_headers() Return all response headers. Arguments Req The Req object. Return value Headers are returned as a map with keys being lowercase binary strings, and values as binary strings. Changelog 2.0: Function introduced. Examples Get all response headers Headers = cowboy_req:resp_headers(Req). cowboy_req:scheme(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.scheme/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.scheme/ Name cowboy_req:scheme - URI scheme Description scheme(Req :: cowboy_req:req()) -> Scheme :: binary() Return the scheme of the effective request URI. The scheme can also be obtained using pattern matching: #{scheme := Scheme} = Req. Arguments Req The Req object. Return value The scheme is returned as a binary. It is case insensitive. Cowboy will only set the scheme to <<" cowboy_req:scheme(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.scheme/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.scheme/ Name cowboy_req:scheme - URI scheme Description scheme(Req :: cowboy_req:req()) -> Scheme :: binary() Return the scheme of the effective request URI. The scheme can also be obtained using pattern matching: #{scheme := Scheme} = Req. Arguments Req The Req object. Return value The scheme is returned as a binary. It is case insensitive. Cowboy will only set the scheme to <<" cowboy_req:scheme(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.scheme/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.scheme/ Name cowboy_req:scheme - URI scheme Description scheme(Req :: cowboy_req:req()) -> Scheme :: binary() Return the scheme of the effective request URI. The scheme can also be obtained using pattern matching: #{scheme := Scheme} = Req. Arguments Req The Req object. Return value The scheme is returned as a binary. It is case insensitive. Cowboy will only set the scheme to <<" cowboy_req:scheme(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.scheme/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.scheme/ Name cowboy_req:scheme - URI scheme Description scheme(Req :: cowboy_req:req()) -> Scheme :: binary() Return the scheme of the effective request URI. The scheme can also be obtained using pattern matching: #{scheme := Scheme} = Req. Arguments Req The Req object. Return value The scheme is returned as a binary. It is case insensitive. Cowboy will only set the scheme to <<" cowboy_req:set_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_body/ Name cowboy_req:set_resp_body - Set the response body Description set_resp_body(Body, Req :: cowboy_req:req()) -> Req Body :: cowboy_req:resp_body() Set the response body. The response body will be sent when a reply is initiated. Note that the functions stream_reply/2,3 and reply/4 will override the body set by this function. This function can also be used to remove a response body that was set previously. To do so, simply call this function with an empty body. cowboy_req:set_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_body/ Name cowboy_req:set_resp_body - Set the response body Description set_resp_body(Body, Req :: cowboy_req:req()) -> Req Body :: cowboy_req:resp_body() Set the response body. The response body will be sent when a reply is initiated. Note that the functions stream_reply/2,3 and reply/4 will override the body set by this function. This function can also be used to remove a response body that was set previously. To do so, simply call this function with an empty body. cowboy_req:set_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_body/ Name cowboy_req:set_resp_body - Set the response body Description set_resp_body(Body, Req :: cowboy_req:req()) -> Req Body :: cowboy_req:resp_body() Set the response body. The response body will be sent when a reply is initiated. Note that the functions stream_reply/2,3 and reply/4 will override the body set by this function. This function can also be used to remove a response body that was set previously. To do so, simply call this function with an empty body. cowboy_req:set_resp_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_body/ Name cowboy_req:set_resp_body - Set the response body Description set_resp_body(Body, Req :: cowboy_req:req()) -> Req Body :: cowboy_req:resp_body() Set the response body. The response body will be sent when a reply is initiated. Note that the functions stream_reply/2,3 and reply/4 will override the body set by this function. This function can also be used to remove a response body that was set previously. To do so, simply call this function with an empty body. cowboy_req:set_resp_cookie(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_cookie/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_cookie/ Name cowboy_req:set_resp_cookie - Set a cookie Description set_resp_cookie(Name, Value, Req :: cowboy_req:req()) -> set_resp_cookie(Name, Value, [], Req) set_resp_cookie(Name, Value, Req :: cowboy_req:req(), Opts) -> Req Name :: binary() %% case sensitive Value :: iodata() %% case sensitive Opts :: cow_cookie:cookie_opts() Set a cookie to be sent with the response. Note that cookie names are case sensitive. Arguments Name Cookie name. cowboy_req:set_resp_cookie(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_cookie/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_cookie/ Name cowboy_req:set_resp_cookie - Set a cookie Description set_resp_cookie(Name, Value, Req :: cowboy_req:req()) -> set_resp_cookie(Name, Value, [], Req) set_resp_cookie(Name, Value, Req :: cowboy_req:req(), Opts) -> Req Name :: binary() %% case sensitive Value :: iodata() %% case sensitive Opts :: cow_cookie:cookie_opts() Set a cookie to be sent with the response. Note that cookie names are case sensitive. Arguments Name Cookie name. cowboy_req:set_resp_cookie(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_cookie/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_cookie/ Name cowboy_req:set_resp_cookie - Set a cookie Description set_resp_cookie(Name, Value, Req :: cowboy_req:req()) -> set_resp_cookie(Name, Value, [], Req) set_resp_cookie(Name, Value, Req :: cowboy_req:req(), Opts) -> Req Name :: binary() %% case sensitive Value :: iodata() %% case sensitive Opts :: cow_cookie:cookie_opts() Set a cookie to be sent with the response. Note that cookie names are case sensitive. Arguments Name Cookie name. cowboy_req:set_resp_cookie(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_cookie/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_cookie/ Name cowboy_req:set_resp_cookie - Set a cookie Description set_resp_cookie(Name, Value, Req :: cowboy_req:req()) -> set_resp_cookie(Name, Value, [], Req) set_resp_cookie(Name, Value, Req :: cowboy_req:req(), Opts) -> Req Name :: binary() %% case sensitive Value :: iodata() %% case sensitive Opts :: cow_cookie:cookie_opts() Set a cookie to be sent with the response. Note that cookie names are case sensitive. Arguments Name Cookie name. cowboy_req:set_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_header/ Name cowboy_req:set_resp_header - Set a response header Description set_resp_header(Name, Value, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Value :: iodata() %% case depends on header Set a header to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:set_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_header/ Name cowboy_req:set_resp_header - Set a response header Description set_resp_header(Name, Value, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Value :: iodata() %% case depends on header Set a header to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:set_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_header/ Name cowboy_req:set_resp_header - Set a response header Description set_resp_header(Name, Value, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Value :: iodata() %% case depends on header Set a header to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:set_resp_header(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_header/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_header/ Name cowboy_req:set_resp_header - Set a response header Description set_resp_header(Name, Value, Req :: cowboy_req:req()) -> Req Name :: binary() %% lowercase; case insensitive Value :: iodata() %% case depends on header Set a header to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. cowboy_req:set_resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.set_resp_headers/ Name cowboy_req:set_resp_headers - Set several response headers Description set_resp_headers(Headers, Req :: cowboy_req:req()) -> Req Headers :: cowboy:http_headers() Set several headers to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. Headers set by this function may be overwritten by those set from the reply functions. cowboy_req:set_resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.set_resp_headers/ Name cowboy_req:set_resp_headers - Set several response headers Description set_resp_headers(Headers, Req :: cowboy_req:req()) -> Req Headers :: cowboy:http_headers() Set several headers to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. Headers set by this function may be overwritten by those set from the reply functions. cowboy_req:set_resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.set_resp_headers/ Name cowboy_req:set_resp_headers - Set several response headers Description set_resp_headers(Headers, Req :: cowboy_req:req()) -> Req Headers :: cowboy:http_headers() Set several headers to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. Headers set by this function may be overwritten by those set from the reply functions. cowboy_req:set_resp_headers(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_headers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.set_resp_headers/ Name cowboy_req:set_resp_headers - Set several response headers Description set_resp_headers(Headers, Req :: cowboy_req:req()) -> Req Headers :: cowboy:http_headers() Set several headers to be sent with the response. The header name must be given as a lowercase binary string. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. Headers set by this function may be overwritten by those set from the reply functions. cowboy_req:sock(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.sock/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.sock/ Name cowboy_req:sock - Socket address and port Description sock(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()} Return the socket’s IP address and port number. The socket information can also be obtained using pattern matching: #{sock := {IP, Port}} = Req. Arguments Req The Req object. Return value The socket’s local IP address and port number. cowboy_req:sock(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.sock/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.sock/ Name cowboy_req:sock - Socket address and port Description sock(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()} Return the socket’s IP address and port number. The socket information can also be obtained using pattern matching: #{sock := {IP, Port}} = Req. Arguments Req The Req object. Return value The socket’s local IP address and port number. cowboy_req:sock(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.sock/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.sock/ Name cowboy_req:sock - Socket address and port Description sock(Req :: cowboy_req:req()) -> Info Info :: {inet:ip_address(), inet:port_number()} Return the socket’s IP address and port number. The socket information can also be obtained using pattern matching: #{sock := {IP, Port}} = Req. Arguments Req The Req object. Return value The socket’s local IP address and port number. cowboy_req:stream_body(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.stream_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.stream_body/ Name cowboy_req:stream_body - Stream the response body Description stream_body(Data, IsFin, Req :: cowboy_req:req()) -> ok Data :: iodata() IsFin :: fin | nofin Stream the response body. This function may be called as many times as needed after initiating a response using the cowboy_req:stream_reply(3) function. The second argument indicates if this call is the final call. Use the nofin value until you know no more data will be sent. cowboy_req:stream_body(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.stream_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.stream_body/ Name cowboy_req:stream_body - Stream the response body Description stream_body(Data, IsFin, Req :: cowboy_req:req()) -> ok Data :: iodata() IsFin :: fin | nofin Stream the response body. This function may be called as many times as needed after initiating a response using the cowboy_req:stream_reply(3) function. The second argument indicates if this call is the final call. Use the nofin value until you know no more data will be sent. cowboy_req:stream_body(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.stream_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.stream_body/ Name cowboy_req:stream_body - Stream the response body Description stream_body(Data, IsFin, Req :: cowboy_req:req()) -> ok Data :: iodata() IsFin :: fin | nofin Stream the response body. This function may be called as many times as needed after initiating a response using the cowboy_req:stream_reply(3) function. The second argument indicates if this call is the final call. Use the nofin value until you know no more data will be sent. cowboy_req:stream_body(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.stream_body/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.stream_body/ Name cowboy_req:stream_body - Stream the response body Description stream_body(Data, IsFin, Req :: cowboy_req:req()) -> ok Data :: iodata() IsFin :: fin | nofin Stream the response body. This function may be called as many times as needed after initiating a response using the cowboy_req:stream_reply(3) function. The second argument indicates if this call is the final call. Use the nofin value until you know no more data will be sent. cowboy_req:stream_reply(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.stream_reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.stream_reply/ Name cowboy_req:stream_reply - Send the response headers Description stream_reply(Status, Req :: cowboy_req:req()) -> stream_reply(StatusCode, #{}, Req) stream_reply(Status, Headers, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send the response headers. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. cowboy_req:stream_reply(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.stream_reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.stream_reply/ Name cowboy_req:stream_reply - Send the response headers Description stream_reply(Status, Req :: cowboy_req:req()) -> stream_reply(StatusCode, #{}, Req) stream_reply(Status, Headers, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send the response headers. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. cowboy_req:stream_reply(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.stream_reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.stream_reply/ Name cowboy_req:stream_reply - Send the response headers Description stream_reply(Status, Req :: cowboy_req:req()) -> stream_reply(StatusCode, #{}, Req) stream_reply(Status, Headers, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send the response headers. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. cowboy_req:stream_reply(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.stream_reply/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.stream_reply/ Name cowboy_req:stream_reply - Send the response headers Description stream_reply(Status, Req :: cowboy_req:req()) -> stream_reply(StatusCode, #{}, Req) stream_reply(Status, Headers, Req :: cowboy_req:req()) -> Req Status :: cowboy:http_status() Headers :: cowboy:http_headers() Send the response headers. The header names must be given as lowercase binary strings. While header names are case insensitive, Cowboy requires them to be given as lowercase to function properly. Cowboy does not allow duplicate header names. cowboy_req:stream_trailers(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.stream_trailers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.stream_trailers/ Name cowboy_req:stream_trailers - Send the response trailers Description stream_trailers(Trailers, Req :: cowboy_req:req()) -> ok Trailers :: cowboy:http_headers() Send the response trailers and terminate the stream. This function can only be called once, after initiating a response using cowboy_req:stream_reply(3) and sending zero or more body chunks using cowboy_req:stream_body(3) with the nofin argument set. The function stream_trailers/2 implies fin and automatically terminate the response. You must list all field names sent in trailers in the trailer header, otherwise they might be dropped by intermediaries or clients. cowboy_req:stream_trailers(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.stream_trailers/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.stream_trailers/ Name cowboy_req:stream_trailers - Send the response trailers Description stream_trailers(Trailers, Req :: cowboy_req:req()) -> ok Trailers :: cowboy:http_headers() Send the response trailers and terminate the stream. This function can only be called once, after initiating a response using cowboy_req:stream_reply(3) and sending zero or more body chunks using cowboy_req:stream_body(3) with the nofin argument set. The function stream_trailers/2 implies fin and automatically terminate the response. You must list all field names sent in trailers in the trailer header, otherwise they might be dropped by intermediaries or clients. cowboy_req:uri(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.uri/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.uri/ Name cowboy_req:uri - Reconstructed URI Description uri(Req :: cowboy_req:req()) -> uri(Req, #{}) uri(Req :: cowboy_req:req(), Opts) -> URI :: iodata() Opts :: #{ scheme => iodata() | undefined, host => iodata() | undefined, port => inet:port_number() | undefined, path => iodata() | undefined, qs => iodata() | undefined, fragment => iodata() | undefined } Reconstruct the effective request URI, optionally modifying components. By default Cowboy will build a URI using the components found in the request. cowboy_req:uri(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.uri/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.uri/ Name cowboy_req:uri - Reconstructed URI Description uri(Req :: cowboy_req:req()) -> uri(Req, #{}) uri(Req :: cowboy_req:req(), Opts) -> URI :: iodata() Opts :: #{ scheme => iodata() | undefined, host => iodata() | undefined, port => inet:port_number() | undefined, path => iodata() | undefined, qs => iodata() | undefined, fragment => iodata() | undefined } Reconstruct the effective request URI, optionally modifying components. By default Cowboy will build a URI using the components found in the request. cowboy_req:uri(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.uri/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.uri/ Name cowboy_req:uri - Reconstructed URI Description uri(Req :: cowboy_req:req()) -> uri(Req, #{}) uri(Req :: cowboy_req:req(), Opts) -> URI :: iodata() Opts :: #{ scheme => iodata() | undefined, host => iodata() | undefined, port => inet:port_number() | undefined, path => iodata() | undefined, qs => iodata() | undefined, fragment => iodata() | undefined } Reconstruct the effective request URI, optionally modifying components. By default Cowboy will build a URI using the components found in the request. cowboy_req:uri(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.uri/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.uri/ Name cowboy_req:uri - Reconstructed URI Description uri(Req :: cowboy_req:req()) -> uri(Req, #{}) uri(Req :: cowboy_req:req(), Opts) -> URI :: iodata() Opts :: #{ scheme => iodata() | undefined, host => iodata() | undefined, port => inet:port_number() | undefined, path => iodata() | undefined, qs => iodata() | undefined, fragment => iodata() | undefined } Reconstruct the effective request URI, optionally modifying components. By default Cowboy will build a URI using the components found in the request. cowboy_req:version(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.version/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_req.version/ Name cowboy_req:version - HTTP version Description version(Req :: cowboy_req:req()) -> Version :: cowboy:http_version() Return the HTTP version used for the request. The version can also be obtained using pattern matching: #{version := Version} = Req. Arguments Req The Req object. Return value The HTTP version used for the request is returned as an atom. It is provided for informative purposes only. cowboy_req:version(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.version/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_req.version/ Name cowboy_req:version - HTTP version Description version(Req :: cowboy_req:req()) -> Version :: cowboy:http_version() Return the HTTP version used for the request. The version can also be obtained using pattern matching: #{version := Version} = Req. Arguments Req The Req object. Return value The HTTP version used for the request is returned as an atom. It is provided for informative purposes only. cowboy_req:version(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.version/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_req.version/ Name cowboy_req:version - HTTP version Description version(Req :: cowboy_req:req()) -> Version :: cowboy:http_version() Return the HTTP version used for the request. The version can also be obtained using pattern matching: #{version := Version} = Req. Arguments Req The Req object. Return value The HTTP version used for the request is returned as an atom. It is provided for informative purposes only. cowboy_req:version(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.version/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_req.version/ Name cowboy_req:version - HTTP version Description version(Req :: cowboy_req:req()) -> Version :: cowboy:http_version() Return the HTTP version used for the request. The version can also be obtained using pattern matching: #{version := Version} = Req. Arguments Req The Req object. Return value The HTTP version used for the request is returned as an atom. It is provided for informative purposes only. cowboy_rest(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_rest/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_rest/ Name cowboy_rest - REST handlers Description The module cowboy_rest implements the HTTP state machine. Implementing REST handlers is not enough to provide a REST interface; this interface must also follow the REST constraints including HATEOAS (hypermedia as the engine of application state). Callbacks REST handlers implement the following interface: init(Req, State) -> {cowboy_rest, Req, State} Callback(Req, State) -> {Result, Req, State} | {stop, Req, State} terminate(Reason, Req, State) -> ok %% optional Req :: cowboy_req:req() State :: any() Reason :: normal | {crash, error | exit | throw, any()} Callback - see below Result - see below Default - see below The init/2 callback is common to all handlers. cowboy_rest(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_rest/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_rest/ Name cowboy_rest - REST handlers Description The module cowboy_rest implements the HTTP state machine. Implementing REST handlers is not enough to provide a REST interface; this interface must also follow the REST constraints including HATEOAS (hypermedia as the engine of application state). Callbacks REST handlers implement the following interface: init(Req, State) -> {cowboy_rest, Req, State} Callback(Req, State) -> {Result, Req, State} | {stop, Req, State} | {{switch_handler, Module}, Req, State} | {{switch_handler, Module, Opts}, Req, State} terminate(Reason, Req, State) -> ok %% optional Req :: cowboy_req:req() State :: any() Module :: module() Opts :: any() Reason :: normal | {crash, error | exit | throw, any()} Callback - see below Result - see below Default - see below The init/2 callback is common to all handlers. cowboy_rest(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_rest/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_rest/ Name cowboy_rest - REST handlers Description The module cowboy_rest implements the HTTP state machine. Implementing REST handlers is not enough to provide a REST interface; this interface must also follow the REST constraints including HATEOAS (hypermedia as the engine of application state). Callbacks REST handlers implement the following interface: init(Req, State) -> {cowboy_rest, Req, State} Callback(Req, State) -> {Result, Req, State} | {stop, Req, State} | {{switch_handler, Module}, Req, State} | {{switch_handler, Module, Opts}, Req, State} terminate(Reason, Req, State) -> ok %% optional Req :: cowboy_req:req() State :: any() Module :: module() Opts :: any() Reason :: normal | {crash, error | exit | throw, any()} Callback - see below Result - see below Default - see below The init/2 callback is common to all handlers. cowboy_rest(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_rest/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_rest/ Name cowboy_rest - REST handlers Description The module cowboy_rest implements the HTTP state machine. Implementing REST handlers is not enough to provide a REST interface; this interface must also follow the REST constraints including HATEOAS (hypermedia as the engine of application state). Callbacks REST handlers implement the following interface: init(Req, State) -> {cowboy_rest, Req, State} Callback(Req, State) -> {Result, Req, State} | {stop, Req, State} | {{switch_handler, Module}, Req, State} | {{switch_handler, Module, Opts}, Req, State} terminate(Reason, Req, State) -> ok %% optional Req :: cowboy_req:req() State :: any() Module :: module() Opts :: any() Reason :: normal | {crash, error | exit | throw, any()} Callback - see below Result - see below Default - see below The init/2 callback is common to all handlers. cowboy_router(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_router/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_router/ Name cowboy_router - Router middleware Description The cowboy_router middleware maps the requested host and path to the handler to be used for processing the request. The router takes the dispatch rules as input from the middleware environment. Dispatch rules are generated by calling the cowboy_router:compile(3) function. When a route matches, the router sets the handler and handler_opts middleware environment values containing the handler module and initial state, respectively. cowboy_router(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_router/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_router/ Name cowboy_router - Router middleware Description The cowboy_router middleware maps the requested host and path to the handler to be used for processing the request. The router takes the dispatch rules as input from the middleware environment. Dispatch rules are generated by calling the cowboy_router:compile(3) function. When a route matches, the router sets the handler and handler_opts middleware environment values containing the handler module and initial state, respectively. cowboy_router(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_router/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_router/ Name cowboy_router - Router middleware Description The cowboy_router middleware maps the requested host and path to the handler to be used for processing the request. The router takes the dispatch rules as input from the middleware environment. Dispatch rules are generated by calling the cowboy_router:compile(3) function. When a route matches, the router sets the handler and handler_opts middleware environment values containing the handler module and initial state, respectively. cowboy_router(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_router/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_router/ Name cowboy_router - Router middleware Description The cowboy_router middleware maps the requested host and path to the handler to be used for processing the request. The router takes the dispatch rules as input from the middleware environment. Dispatch rules are generated by calling the cowboy_router:compile(3) function. When a route matches, the router sets the handler and handler_opts middleware environment values containing the handler module and initial state, respectively. cowboy_router:compile(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_router.compile/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_router.compile/ Name cowboy_router:compile - Compile routes to the resources Description compile(cowboy_router:routes()) -> cowboy_router:dispatch_rules() Compile routes to the resources. Takes a human readable list of routes and transforms it into a form more efficient to process. Arguments Routes Human readable list of routes. Return value An opaque dispatch rules value is returned. This value must be given to Cowboy as a middleware environment value. cowboy_router:compile(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_router.compile/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_router.compile/ Name cowboy_router:compile - Compile routes to the resources Description compile(cowboy_router:routes()) -> cowboy_router:dispatch_rules() Compile routes to the resources. Takes a human readable list of routes and transforms it into a form more efficient to process. Arguments Routes Human readable list of routes. Return value An opaque dispatch rules value is returned. This value must be given to Cowboy as a middleware environment value. cowboy_router:compile(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_router.compile/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_router.compile/ Name cowboy_router:compile - Compile routes to the resources Description compile(cowboy_router:routes()) -> cowboy_router:dispatch_rules() Compile routes to the resources. Takes a human readable list of routes and transforms it into a form more efficient to process. Arguments Routes Human readable list of routes. Return value An opaque dispatch rules value is returned. This value must be given to Cowboy as a middleware environment value. cowboy_router:compile(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_router.compile/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_router.compile/ Name cowboy_router:compile - Compile routes to the resources Description compile(cowboy_router:routes()) -> cowboy_router:dispatch_rules() Compile routes to the resources. Takes a human readable list of routes and transforms it into a form more efficient to process. Arguments Routes Human readable list of routes. Return value An opaque dispatch rules value is returned. This value must be given to Cowboy as a middleware environment value. cowboy_static(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_static/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_static/ Name cowboy_static - Static file handler Description The module cowboy_static implements file serving capabilities using the REST semantics provided by cowboy_rest. The static file handler is a pre-written handler coming with Cowboy. To serve files, use it in your routes. Options opts() :: {priv_file, App, Path} | {priv_file, App, Path, Extra} | {file, Path} | {file, Path, Extra} | {priv_dir, App, Path} | {priv_dir, App, Path, Extra} | {dir, Path} | {dir, Path, Extra} App :: atom() Path :: binary() | string() Extra :: [Etag | Mimetypes] Etag :: {etag, module(), function()} | {etag, false} Mimetypes :: {mimetypes, module(), function()} | {mimetypes, binary() | ParsedMime} ParsedMime :: {Type :: binary(), SubType :: binary(), Params} Params :: [{Key :: binary(), Value :: binary()}] Static handler configuration. cowboy_static(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_static/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_static/ Name cowboy_static - Static file handler Description The module cowboy_static implements file serving capabilities using the REST semantics provided by cowboy_rest. The static file handler is a pre-written handler coming with Cowboy. To serve files, use it in your routes. Options opts() :: {priv_file, App, Path} | {priv_file, App, Path, Extra} | {file, Path} | {file, Path, Extra} | {priv_dir, App, Path} | {priv_dir, App, Path, Extra} | {dir, Path} | {dir, Path, Extra} App :: atom() Path :: binary() | string() Extra :: [Etag | Mimetypes] Etag :: {etag, module(), function()} | {etag, false} Mimetypes :: {mimetypes, module(), function()} | {mimetypes, binary() | ParsedMime} ParsedMime :: {Type :: binary(), SubType :: binary(), Params} Params :: [{Key :: binary(), Value :: binary()}] Static handler configuration. cowboy_static(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_static/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_static/ Name cowboy_static - Static file handler Description The module cowboy_static implements file serving capabilities using the REST semantics provided by cowboy_rest. The static file handler is a pre-written handler coming with Cowboy. To serve files, use it in your routes. Options opts() :: {priv_file, App, Path} | {priv_file, App, Path, Extra} | {file, Path} | {file, Path, Extra} | {priv_dir, App, Path} | {priv_dir, App, Path, Extra} | {dir, Path} | {dir, Path, Extra} App :: atom() Path :: binary() | string() Extra :: [Etag | Mimetypes] Etag :: {etag, module(), function()} | {etag, false} Mimetypes :: {mimetypes, module(), function()} | {mimetypes, binary() | ParsedMime} ParsedMime :: {Type :: binary(), SubType :: binary(), Params} Params :: [{Key :: binary(), Value :: binary()}] Static handler configuration. cowboy_static(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_static/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_static/ Name cowboy_static - Static file handler Description The module cowboy_static implements file serving capabilities using the REST semantics provided by cowboy_rest. The static file handler is a pre-written handler coming with Cowboy. To serve files, use it in your routes. Options opts() :: {priv_file, App, Path} | {priv_file, App, Path, Extra} | {file, Path} | {file, Path, Extra} | {priv_dir, App, Path} | {priv_dir, App, Path, Extra} | {dir, Path} | {dir, Path, Extra} App :: atom() Path :: binary() | string() Extra :: [Etag | Mimetypes] Etag :: {etag, module(), function()} | {etag, false} Mimetypes :: {mimetypes, module(), function()} | {mimetypes, binary() | ParsedMime} ParsedMime :: {Type :: binary(), SubType :: binary(), Params} Params :: [{Key :: binary(), Value :: binary()}] Static handler configuration. cowboy_stream(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_stream/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_stream/ Name cowboy_handler - Stream handlers Description The module cowboy_stream defines a callback interface and a protocol for handling HTTP streams. An HTTP request and its associated response is called a stream. A connection may have many streams. In HTTP/1.1 they are executed sequentially, while in HTTP/2 they are executed concurrently. Cowboy calls the stream handler for nearly all events related to a stream. Exceptions vary depending on the protocol. cowboy_stream(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_stream/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_stream/ Name cowboy_handler - Stream handlers Description The module cowboy_stream defines a callback interface and a protocol for handling HTTP streams. An HTTP request and its associated response is called a stream. A connection may have many streams. In HTTP/1.1 they are executed sequentially, while in HTTP/2 they are executed concurrently. Cowboy calls the stream handler for nearly all events related to a stream. Exceptions vary depending on the protocol. cowboy_stream(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_stream/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_stream/ Name cowboy_handler - Stream handlers Description The module cowboy_stream defines a callback interface and a protocol for handling HTTP streams. An HTTP request and its associated response is called a stream. A connection may have many streams. In HTTP/1.1 they are executed sequentially, while in HTTP/2 they are executed concurrently. Cowboy calls the stream handler for nearly all events related to a stream. Exceptions vary depending on the protocol. cowboy_stream(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_stream/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_stream/ Name cowboy_handler - Stream handlers Description The module cowboy_stream defines a callback interface and a protocol for handling HTTP streams. An HTTP request and its associated response is called a stream. A connection may have many streams. In HTTP/1.1 they are executed sequentially, while in HTTP/2 they are executed concurrently. Cowboy calls the stream handler for nearly all events related to a stream. Exceptions vary depending on the protocol. cowboy_websocket(3) https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_websocket/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.0/manual/cowboy_websocket/ Name cowboy_websocket - Websocket Description The module cowboy_websocket implements Websocket as a Ranch protocol. It also defines a callback interface for handling Websocket connections. Callbacks Websocket handlers must implement the following callback interface: init(Req, State) -> {cowboy_websocket, Req, State} | {cowboy_websocket, Req, State, Opts} websocket_init(State) -> CallResult %% optional websocket_handle(InFrame, State) -> CallResult websocket_info(Info, State) -> CallResult terminate(Reason, PartialReq, State) -> ok %% optional Req :: cowboy_req:req() PartialReq :: map() State :: any() Opts :: cowboy_websocket:opts() InFrame :: {text | binary | ping | pong, binary()} OutFrame :: cow_ws:frame() %% see types below Info :: any() CallResult :: {ok, State} | {ok, State, hibernate} | {reply, OutFrame | [OutFrame], State} | {reply, OutFrame | [OutFrame], State, hibernate} | {stop, State} Reason :: normal | stop | timeout | remote | {remote, cow_ws:close_code(), binary()} | {error, badencoding | badframe | closed | atom()} | {crash, error | exit | throw, any()} The init/2 callback is common to all handlers. cowboy_websocket(3) https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_websocket/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.1/manual/cowboy_websocket/ Name cowboy_websocket - Websocket Description The module cowboy_websocket implements Websocket as a Ranch protocol. It also defines a callback interface for handling Websocket connections. Callbacks Websocket handlers must implement the following callback interface: init(Req, State) -> {cowboy_websocket, Req, State} | {cowboy_websocket, Req, State, Opts} websocket_init(State) -> CallResult %% optional websocket_handle(InFrame, State) -> CallResult websocket_info(Info, State) -> CallResult terminate(Reason, PartialReq, State) -> ok %% optional Req :: cowboy_req:req() PartialReq :: map() State :: any() Opts :: cowboy_websocket:opts() InFrame :: {text | binary | ping | pong, binary()} OutFrame :: cow_ws:frame() %% see types below Info :: any() CallResult :: {ok, State} | {ok, State, hibernate} | {reply, OutFrame | [OutFrame], State} | {reply, OutFrame | [OutFrame], State, hibernate} | {stop, State} Reason :: normal | stop | timeout | remote | {remote, cow_ws:close_code(), binary()} | {error, badencoding | badframe | closed | atom()} | {crash, error | exit | throw, any()} The init/2 callback is common to all handlers. cowboy_websocket(3) https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_websocket/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.2/manual/cowboy_websocket/ Name cowboy_websocket - Websocket Description The module cowboy_websocket implements Websocket as a Ranch protocol. It also defines a callback interface for handling Websocket connections. Callbacks Websocket handlers must implement the following callback interface: init(Req, State) -> {cowboy_websocket, Req, State} | {cowboy_websocket, Req, State, Opts} websocket_init(State) -> CallResult %% optional websocket_handle(InFrame, State) -> CallResult websocket_info(Info, State) -> CallResult terminate(Reason, PartialReq, State) -> ok %% optional Req :: cowboy_req:req() PartialReq :: map() State :: any() Opts :: cowboy_websocket:opts() InFrame :: {text | binary | ping | pong, binary()} OutFrame :: cow_ws:frame() %% see types below Info :: any() CallResult :: {ok, State} | {ok, State, hibernate} | {reply, OutFrame | [OutFrame], State} | {reply, OutFrame | [OutFrame], State, hibernate} | {stop, State} Reason :: normal | stop | timeout | remote | {remote, cow_ws:close_code(), binary()} | {error, badencoding | badframe | closed | atom()} | {crash, error | exit | throw, any()} The init/2 callback is common to all handlers. cowboy_websocket(3) https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_websocket/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/cowboy/2.3/manual/cowboy_websocket/ Name cowboy_websocket - Websocket Description The module cowboy_websocket implements Websocket as a Ranch protocol. It also defines a callback interface for handling Websocket connections. Callbacks Websocket handlers must implement the following callback interface: init(Req, State) -> {cowboy_websocket, Req, State} | {cowboy_websocket, Req, State, Opts} websocket_init(State) -> CallResult %% optional websocket_handle(InFrame, State) -> CallResult websocket_info(Info, State) -> CallResult terminate(Reason, PartialReq, State) -> ok %% optional Req :: cowboy_req:req() PartialReq :: map() State :: any() Opts :: cowboy_websocket:opts() InFrame :: {text | binary | ping | pong, binary()} OutFrame :: cow_ws:frame() %% see types below Info :: any() CallResult :: {ok, State} | {ok, State, hibernate} | {reply, OutFrame | [OutFrame], State} | {reply, OutFrame | [OutFrame], State, hibernate} | {stop, State} Reason :: normal | stop | timeout | remote | {remote, cow_ws:close_code(), binary()} | {error, badencoding | badframe | closed | atom()} | {crash, error | exit | throw, any()} The init/2 callback is common to all handlers. gun(3) https://ninenines.eu/docs/en/gun/1.0/manual/gun/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/manual/gun/ Name gun - asynchronous HTTP client Description The gun module provides an asynchronous interface for connecting and communicating with Web servers over HTTP, HTTP/2 or Websocket. Types opts() = map() Configuration for the connection. The following keys are defined: connect_timeout ⇒ timeout() Connection timeout. Defaults to infinity. http_opts ⇒ http_opts() Options specific to the HTTP protocol. gun(7) https://ninenines.eu/docs/en/gun/1.0/manual/gun_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/gun/1.0/manual/gun_app/ Name gun - Erlang HTTP client with support for HTTP/1.1, HTTP/2 and Websocket. Dependencies The gun application uses the Erlang applications ranch for abstracting TCP and TLS over a common interface, and the ssl application for TLS support, required for HTTPS and secure HTTP/2 support. In addition, Gun requires the crypto application (a dependency of ssl) for Websocket. These dependencies must be started for the gun application to work. ranch(3) https://ninenines.eu/docs/en/ranch/1.2/manual/ranch/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ranch/ Name ranch - socket acceptor pool Description The ranch module provides functions for starting and manipulating Ranch listeners. Types max_conns() = non_neg_integer() | infinity Maximum number of connections allowed on this listener. This is a soft limit. The actual number of connections might be slightly above the limit due to concurrency when accepting new connections. Some connections may also be removed from this count explicitly by the user code. ranch(3) https://ninenines.eu/docs/en/ranch/1.3/manual/ranch/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ranch/ Name ranch - socket acceptor pool Description The ranch module provides functions for starting and manipulating Ranch listeners. Types max_conns() = non_neg_integer() | infinity Maximum number of connections allowed on this listener. This is a soft limit. The actual number of connections might be slightly above the limit due to concurrency when accepting new connections. Some connections may also be removed from this count explicitly by the user code. ranch(3) https://ninenines.eu/docs/en/ranch/1.4/manual/ranch/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ranch/ Name ranch - socket acceptor pool Description The ranch module provides functions for starting and manipulating Ranch listeners. Types max_conns() = non_neg_integer() | infinity Maximum number of connections allowed on this listener. This is a soft limit. The actual number of connections might be slightly above the limit due to concurrency when accepting new connections. Some connections may also be removed from this count explicitly by the user code. ranch(7) https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_app/ Name ranch - Socket acceptor pool for TCP protocols. Dependencies The ranch application has no particular dependency required to start. It has optional dependencies that are only required when listening for SSL connections. The dependencies are crypto, asn1, public_key and ssl. They are started automatically if they weren’t before. Environment The ranch application defines one application environment configuration parameter. profile (false) When enabled, Ranch will start eprof profiling automatically. ranch(7) https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_app/ Name ranch - Socket acceptor pool for TCP protocols. Dependencies The ranch application depends on the ssl application to start. It is used for handling secure connections, when the transport is ranch_ssl. It can be disabled if SSL is not used. Environment The ranch application defines one application environment configuration parameter. profile (false) When enabled, Ranch will start eprof profiling automatically. ranch(7) https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_app/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_app/ Name ranch - Socket acceptor pool for TCP protocols. Dependencies The ranch application depends on the ssl application to start. It is used for handling secure connections, when the transport is ranch_ssl. It can be disabled if SSL is not used. Environment The ranch application defines one application environment configuration parameter. profile (false) When enabled, Ranch will start eprof profiling automatically. ranch_protocol(3) https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_protocol/ Name ranch_protocol - behaviour for protocol modules Description The ranch_protocol behaviour defines the interface used by Ranch protocols. Types None. Callbacks start_link(Ref, Socket, Transport, ProtoOpts) → {ok, pid()} | {ok, pid(), pid()} Ref = ranch:ref() Listener name. Socket = any() Socket for this connection. Transport = module() Transport module for this socket. ranch_protocol(3) https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_protocol/ Name ranch_protocol - behaviour for protocol modules Description The ranch_protocol behaviour defines the interface used by Ranch protocols. Types None. Callbacks start_link(Ref, Socket, Transport, ProtoOpts) → {ok, pid()} | {ok, pid(), pid()} Ref = ranch:ref() Listener name. Socket = any() Socket for this connection. Transport = module() Transport module for this socket. ranch_protocol(3) https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_protocol/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_protocol/ Name ranch_protocol - behaviour for protocol modules Description The ranch_protocol behaviour defines the interface used by Ranch protocols. Types None. Callbacks start_link(Ref, Socket, Transport, ProtoOpts) → {ok, pid()} | {ok, pid(), pid()} Ref = ranch:ref() Listener name. Socket = any() Socket for this connection. Transport = module() Transport module for this socket. ranch_ssl(3) https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_ssl/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_ssl/ Name ranch_ssl - SSL transport module Description The ranch_ssl module implements an SSL Ranch transport. Types ssl_opt() ssl_opt() = {alpn_preferred_protocols, [binary()]} | {cacertfile, string()} | {cacerts, [public_key:der_encoded()]} | {cert, public_key:der_encoded()} | {certfile, string()} | {ciphers, [ssl:erl_cipher_suite()] | string()} | {client_renegotiation, boolean()} | {crl_cache, {module(), {internal | any(), list()}}} | {crl_check, boolean() | peer | best_effort} | {depth, 0..255} | {dh, public_key:der_encoded()} | {dhfile, string()} | {fail_if_no_peer_cert, boolean()} | {hibernate_after, integer() | undefined} | {honor_cipher_order, boolean()} | {key, {'RSAPrivateKey' | 'DSAPrivateKey' | 'PrivateKeyInfo', public_key:der_encoded()}} | {keyfile, string()} | {log_alert, boolean()} | {next_protocols_advertised, [binary()]} | {partial_chain, fun(([public_key:der_encoded()]) -> {trusted_ca, public_key:der_encoded()} | unknown_ca)} | {password, string()} | {psk_identity, string()} | {reuse_session, fun()} | {reuse_sessions, boolean()} | {secure_renegotiate, boolean()} | {sni_fun, fun()} | {sni_hosts, [{string(), ssl_opt()}]} | {user_lookup_fun, {fun(), any()}} | {verify, ssl:verify_type()} | {verify_fun, {fun(), any()}} | {versions, [atom()]}. ranch_ssl(3) https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_ssl/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_ssl/ Name ranch_ssl - SSL transport module Description The ranch_ssl module implements an SSL Ranch transport. Types ssl_opt() ssl_opt() = {alpn_preferred_protocols, [binary()]} | {beast_mitigation, one_n_minus_one | zero_n | disabled} | {cacertfile, string()} | {cacerts, [public_key:der_encoded()]} | {cert, public_key:der_encoded()} | {certfile, string()} | {ciphers, [ssl:erl_cipher_suite()] | string()} | {client_renegotiation, boolean()} | {crl_cache, {module(), {internal | any(), list()}}} | {crl_check, boolean() | peer | best_effort} | {depth, 0. ranch_ssl(3) https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_ssl/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_ssl/ Name ranch_ssl - SSL transport module Description The ranch_ssl module implements an SSL Ranch transport. Types ssl_opt() ssl_opt() = {alpn_preferred_protocols, [binary()]} | {beast_mitigation, one_n_minus_one | zero_n | disabled} | {cacertfile, string()} | {cacerts, [public_key:der_encoded()]} | {cert, public_key:der_encoded()} | {certfile, string()} | {ciphers, [ssl:erl_cipher_suite()] | string()} | {client_renegotiation, boolean()} | {crl_cache, {module(), {internal | any(), list()}}} | {crl_check, boolean() | peer | best_effort} | {depth, 0. ranch_tcp(3) https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_tcp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_tcp/ Name ranch_tcp - TCP transport module Description The ranch_tcp module implements a TCP Ranch transport. Note that due to bugs in OTP up to at least R16B02, it is recommended to disable async threads when using the sendfile function of this transport, as it can make the threads stuck indefinitely. Types opt() opt() = {backlog, non_neg_integer()} | {buffer, non_neg_integer()} | {delay_send, boolean()} | {dontroute, boolean()} | {exit_on_close, boolean()} | {fd, non_neg_integer()} | {high_msgq_watermark, non_neg_integer()} | {high_watermark, non_neg_integer()} | inet | inet6 | {ip, inet:ip_address()} | {keepalive, boolean()} | {linger, {boolean(), non_neg_integer()}} | {low_msgq_watermark, non_neg_integer()} | {low_watermark, non_neg_integer()} | {nodelay, boolean()} | {port, inet:port_number()} | {priority, integer()} | {raw, non_neg_integer(), non_neg_integer(), binary()} | {recbuf, non_neg_integer()} | {send_timeout, timeout()} | {send_timeout_close, boolean()} | {sndbuf, non_neg_integer()} | {tos, integer()} Listen options. ranch_tcp(3) https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_tcp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_tcp/ Name ranch_tcp - TCP transport module Description The ranch_tcp module implements a TCP Ranch transport. Note that due to bugs in OTP up to at least R16B02, it is recommended to disable async threads when using the sendfile function of this transport, as it can make the threads stuck indefinitely. Types opt() opt() = {backlog, non_neg_integer()} | {buffer, non_neg_integer()} | {delay_send, boolean()} | {dontroute, boolean()} | {exit_on_close, boolean()} | {fd, non_neg_integer()} | {high_msgq_watermark, non_neg_integer()} | {high_watermark, non_neg_integer()} | inet | inet6 | {ip, inet:ip_address()} | {ipv6_v6only, boolean()} | {keepalive, boolean()} | {linger, {boolean(), non_neg_integer()}} | {low_msgq_watermark, non_neg_integer()} | {low_watermark, non_neg_integer()} | {nodelay, boolean()} | {port, inet:port_number()} | {priority, integer()} | {raw, non_neg_integer(), non_neg_integer(), binary()} | {recbuf, non_neg_integer()} | {send_timeout, timeout()} | {send_timeout_close, boolean()} | {sndbuf, non_neg_integer()} | {tos, integer()} Listen options. ranch_tcp(3) https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_tcp/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_tcp/ Name ranch_tcp - TCP transport module Description The ranch_tcp module implements a TCP Ranch transport. Note that due to bugs in OTP up to at least R16B02, it is recommended to disable async threads when using the sendfile function of this transport, as it can make the threads stuck indefinitely. Types opt() opt() = {backlog, non_neg_integer()} | {buffer, non_neg_integer()} | {delay_send, boolean()} | {dontroute, boolean()} | {exit_on_close, boolean()} | {fd, non_neg_integer()} | {high_msgq_watermark, non_neg_integer()} | {high_watermark, non_neg_integer()} | inet | inet6 | {ip, inet:ip_address()} | {ipv6_v6only, boolean()} | {keepalive, boolean()} | {linger, {boolean(), non_neg_integer()}} | {low_msgq_watermark, non_neg_integer()} | {low_watermark, non_neg_integer()} | {nodelay, boolean()} | {port, inet:port_number()} | {priority, integer()} | {raw, non_neg_integer(), non_neg_integer(), binary()} | {recbuf, non_neg_integer()} | {send_timeout, timeout()} | {send_timeout_close, boolean()} | {sndbuf, non_neg_integer()} | {tos, integer()} Listen options. ranch_transport(3) https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_transport/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.2/manual/ranch_transport/ Name ranch_transport - behaviour for transport modules Description The ranch_transport behaviour defines the interface used by Ranch transports. Types sendfile_opts() = [{chunk_size, non_neg_integer()}] Options used by the sendfile function and callbacks. Allows configuring the chunk size, in bytes. Defaults to 8191 bytes. Callbacks accept(LSocket, Timeout) → {ok, CSocket} | {error, closed | timeout | atom()} LSocket = CSocket = any() Listening socket. ranch_transport(3) https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_transport/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.3/manual/ranch_transport/ Name ranch_transport - behaviour for transport modules Description The ranch_transport behaviour defines the interface used by Ranch transports. Types sendfile_opts() = [{chunk_size, non_neg_integer()}] Options used by the sendfile function and callbacks. Allows configuring the chunk size, in bytes. Defaults to 8191 bytes. Callbacks accept(LSocket, Timeout) → {ok, CSocket} | {error, closed | timeout | atom()} LSocket = CSocket = any() Listening socket. ranch_transport(3) https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_transport/ Mon, 01 Jan 0001 00:00:00 +0000 https://ninenines.eu/docs/en/ranch/1.4/manual/ranch_transport/ Name ranch_transport - behaviour for transport modules Description The ranch_transport behaviour defines the interface used by Ranch transports. Types sendfile_opts() = [{chunk_size, non_neg_integer()}] Options used by the sendfile function and callbacks. Allows configuring the chunk size, in bytes. Defaults to 8191 bytes. Callbacks accept(LSocket, Timeout) → {ok, CSocket} | {error, closed | timeout | atom()} LSocket = CSocket = any() Listening socket.