Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
mongoose
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
esp
mongoose
Commits
afa5e3f4
Commit
afa5e3f4
authored
9 years ago
by
Alexander Alashkin
Committed by
rojer
9 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable SSL in SJ/WS
PUBLISHED_FROM=d7b3e083c7a7d5095c8e61bb6183ae7e6e068858
parent
f57fcbcb
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
73 deletions
+28
-73
items.json
docs/c-api/http.h/items.json
+0
-8
mg_connect_http.md
docs/c-api/http.h/mg_connect_http.md
+0
-35
mg_connect_ws.md
docs/c-api/http.h/mg_connect_ws.md
+0
-30
mongoose.h
mongoose.h
+28
-0
No files found.
docs/c-api/http.h/items.json
View file @
afa5e3f4
...
...
@@ -16,10 +16,6 @@
"type"
:
"markdown"
,
"name"
:
"mg_send_websocket_handshake2.md"
},
{
"type"
:
"markdown"
,
"name"
:
"mg_connect_ws.md"
},
{
"type"
:
"markdown"
,
"name"
:
"mg_send_websocket_frame.md"
...
...
@@ -80,10 +76,6 @@
"type"
:
"markdown"
,
"name"
:
"mg_http_create_digest_auth_header.md"
},
{
"type"
:
"markdown"
,
"name"
:
"mg_connect_http.md"
},
{
"type"
:
"markdown"
,
"name"
:
"mg_serve_http.md"
...
...
This diff is collapsed.
Click to expand it.
docs/c-api/http.h/mg_connect_http.md
deleted
100644 → 0
View file @
f57fcbcb
---
title
:
"
mg_connect_http()"
decl_name
:
"
mg_connect_http"
symbol_kind
:
"
func"
signature
:
|
struct mg_connection *mg_connect_http(struct mg_mgr *mgr,
mg_event_handler_t event_handler,
const char *url,
const char *extra_headers,
const char *post_data);
---
Helper function that creates outbound HTTP connection.
`url`
is a URL to fetch. It must be properly URL-encoded, e.g. have
no spaces, etc. By default,
`mg_connect_http()`
sends Connection and
Host headers.
`extra_headers`
is an extra HTTP headers to send, e.g.
`"User-Agent: my-app\r\n"`
.
If
`post_data`
is NULL, then GET request is created. Otherwise, POST request
is created with the specified POST data. Note that if the data being posted
is a form submission, the
`Content-Type`
header should be set accordingly
(see example below).
Examples:
```
c
nc1
=
mg_connect_http
(
mgr
,
ev_handler_1
,
"http://www.google.com"
,
NULL
,
NULL
);
nc2
=
mg_connect_http
(
mgr
,
ev_handler_1
,
"https://github.com"
,
NULL
,
NULL
);
nc3
=
mg_connect_http
(
mgr
,
ev_handler_1
,
"my_server:8000/form_submit/"
,
"Content-Type: application/x-www-form-urlencoded
\r\n
"
,
"var_1=value_1&var_2=value_2"
);
```
This diff is collapsed.
Click to expand it.
docs/c-api/http.h/mg_connect_ws.md
deleted
100644 → 0
View file @
f57fcbcb
---
title
:
"
mg_connect_ws()"
decl_name
:
"
mg_connect_ws"
symbol_kind
:
"
func"
signature
:
|
struct mg_connection *mg_connect_ws(struct mg_mgr *mgr,
mg_event_handler_t event_handler,
const char *url, const char *protocol,
const char *extra_headers);
---
Helper function that creates an outbound WebSocket connection.
`url`
is a URL to connect to. It must be properly URL-encoded, e.g. have
no spaces, etc. By default,
`mg_connect_ws()`
sends Connection and
Host headers.
`extra_headers`
is an extra HTTP headers to send, e.g.
`"User-Agent: my-app\r\n"`
.
If
`protocol`
is not NULL, then a
`Sec-WebSocket-Protocol`
header is sent.
Examples:
```
c
nc1
=
mg_connect_ws
(
mgr
,
ev_handler_1
,
"ws://echo.websocket.org"
,
NULL
,
NULL
);
nc2
=
mg_connect_ws
(
mgr
,
ev_handler_1
,
"wss://echo.websocket.org"
,
NULL
,
NULL
);
nc3
=
mg_connect_ws
(
mgr
,
ev_handler_1
,
"ws://api.cesanta.com"
,
"clubby.cesanta.com"
,
NULL
);
```
This diff is collapsed.
Click to expand it.
mongoose.h
View file @
afa5e3f4
...
...
@@ -2147,11 +2147,25 @@ void mg_send_websocket_handshake2(struct mg_connection *nc, const char *path,
* "clubby.cesanta.com", NULL);
* ```
*/
struct
mg_connection
*
mg_connect_ws
(
struct
mg_mgr
*
mgr
,
mg_event_handler_t
event_handler
,
const
char
*
url
,
const
char
*
protocol
,
const
char
*
extra_headers
);
/*
* Helper function that creates an outbound WebSocket connection
*
* Mostly identical to mg_connect_ws, but allows to provide extra parameters
* (for example, SSL parameters
*/
struct
mg_connection
*
mg_connect_ws_opt
(
struct
mg_mgr
*
mgr
,
mg_event_handler_t
ev_handler
,
struct
mg_connect_opts
opts
,
const
char
*
url
,
const
char
*
protocol
,
const
char
*
extra_headers
);
/*
* Send websocket frame to the remote end.
*
...
...
@@ -2405,12 +2419,26 @@ int mg_http_create_digest_auth_header(char *buf, size_t buf_len,
* "var_1=value_1&var_2=value_2");
* ```
*/
struct
mg_connection
*
mg_connect_http
(
struct
mg_mgr
*
mgr
,
mg_event_handler_t
event_handler
,
const
char
*
url
,
const
char
*
extra_headers
,
const
char
*
post_data
);
/*
* Helper function that creates outbound HTTP connection.
*
* Mostly identical to mg_connect_http, but allows to provide extra parameters
* (for example, SSL parameters
*/
struct
mg_connection
*
mg_connect_http_opt
(
struct
mg_mgr
*
mgr
,
mg_event_handler_t
ev_handler
,
struct
mg_connect_opts
opts
,
const
char
*
url
,
const
char
*
extra_headers
,
const
char
*
post_data
);
/*
* This structure defines how `mg_serve_http()` works.
* Best practice is to set only required settings, and leave the rest as NULL.
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment