Skip to content

Commit

Permalink
copyediting
Browse files Browse the repository at this point in the history
  • Loading branch information
pramsey committed Dec 5, 2024
1 parent 5fc2dca commit 07494a1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ SELECT content::json->'headers'->>'Authorization'
(1 row)
```

Read the `status` and `content` fields out of a `http_response` object.
Read the `status` and `content_type` fields out of a `http_response` object.

```sql
SELECT status, content_type
Expand Down Expand Up @@ -308,21 +308,20 @@ ALTER ROLE myapp IN mydb SET http.curlopt_tlsauth_password = 'secret';

Using this extension as a background automated process without supervision (e.g as a trigger) may have unintended consequences for other servers. It is considered a best practice to share contact information with your requests, so that administrators can reach you in case your HTTP calls get out of control.

Certain API policies (e.g. [Wikimedia User-Agent policy](https://meta.wikimedia.org/wiki/User-Agent_policy)) may even require sharing specific contact information
with each request. Others may disallow (via `robots.txt`) certain agents they don't recognize.
Certain API policies (e.g. [Wikimedia User-Agent policy](https://meta.wikimedia.org/wiki/User-Agent_policy)) may even require sharing specific contact information with each request. Others may disallow (via `robots.txt`) certain agents they don't recognize.

For such cases you can set the `CURLOPT_USERAGENT` option

```sql
SET http.curlopt_useragent = 'PgBot/2.1 (+http://www.example.com/bot.html) Contact abuse@pgbot.com';
SET http.curlopt_useragent = 'PgBot/2.1 (+http://pgbot.com/bot.html) Contact abuse@pgbot.com';

SELECT status, content::json->'headers'->>'User-Agent'
FROM http_get('http://httpbun.com/headers');
```
```
status | user_agent
--------+-----------------------------------------------------------
200 | PgBot/2.1 (+http://www.example.com/bot.html) Contact abuse@pgbot.com
200 | PgBot/2.1 (+http://pgbot.com/bot.html) Contact abuse@pgbot.com
```

## Keep-Alive & Timeouts
Expand Down Expand Up @@ -395,5 +394,5 @@ docker run -p 9080:80 kennethreitz/httpbin

## To Do

- The new http://www.postgresql.org/docs/9.3/static/bgworker.html background worker support could be used to set up an HTTP request queue, so that pgsql-http can register a request and callback and then return immediately.
- The [background worker](https://www.postgresql.org/docs/current/bgworker.html) support could be used to set up an HTTP request queue, so that pgsql-http can register a request and callback and then return immediately.

0 comments on commit 07494a1

Please sign in to comment.