https://github.com/hrbrmstr/construe
🧰 HTTP Request, Response and URL Parser
https://github.com/hrbrmstr/construe
http-parser r rstats
Last synced: 9 days ago
JSON representation
🧰 HTTP Request, Response and URL Parser
- Host: GitHub
- URL: https://github.com/hrbrmstr/construe
- Owner: hrbrmstr
- License: other
- Created: 2020-08-28T15:18:58.000Z (about 5 years ago)
- Default Branch: batman
- Last Pushed: 2020-09-01T03:02:17.000Z (about 5 years ago)
- Last Synced: 2025-02-01T20:51:13.683Z (9 months ago)
- Topics: http-parser, r, rstats
- Language: C++
- Homepage: https://cinc.rud.is/web/packages/construe/
- Size: 81.1 KB
- Stars: 6
- Watchers: 3
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - hrbrmstr/construe - 🧰 HTTP Request, Response and URL Parser (C++)
README
---
output: rmarkdown::github_document
editor_options:
chunk_output_type: console
---
```{r pkg-knitr-opts, include=FALSE}
hrbrpkghelpr::global_opts()
```
```{r badges, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::stinking_badges(branch = "batman")
```
```{r description, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::yank_title_and_description()
```
## What's Inside The Tin
The following functions are implemented:
```{r ingredients, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::describe_ingredients()
```
## Installation
```{r install-ex, results='asis', echo=FALSE, cache=FALSE}
hrbrpkghelpr::install_block()
```
## Usage
```{r lib-ex}
library(construe)
# current version
packageVersion("construe")
```
### Requests
```{r ex01}
paste0(c(
"GET /uri.cgi HTTP/1.1\r\n",
"User-Agent: Mozilla/5.0\r\n",
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n",
"Host: 127.0.0.1\r\n", "\r\n"
), collapse = "") -> req
req_raw <- charToRaw(req)
parse_request(req)
parse_request_raw(req_raw)
microbenchmark::microbenchmark(
parse_request = parse_request(req),
parse_request_raw = parse_request_raw(req_raw)
)
```
### Responses
```{r ex02}
paste0(c(
"HTTP/1.1 200 OK\r\n",
"Server: nginx/1.2.1\r\n",
"Content-Type: text/html\r\n",
"Content-Length: 8\r\n",
"Connection: keep-alive\r\n",
"\r\n",
"