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
0fb2f38c
Commit
0fb2f38c
authored
Sep 14, 2014
by
Sergey Lyubka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed mg_connect() call
parent
aa007f12
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
http_client.c
examples/http_client/http_client.c
+3
-4
No files found.
examples/http_client/http_client.c
View file @
0fb2f38c
...
...
@@ -11,8 +11,7 @@
static
int
s_received_signal
=
0
;
static
struct
mg_server
*
s_server
=
NULL
;
static
const
char
*
s_remote_host
=
"glosbe.com"
;
static
int
s_remote_port
=
80
;
static
const
char
*
s_remote_addr
=
"glosbe.com:80"
;
static
void
signal_handler
(
int
sig_num
)
{
signal
(
sig_num
,
signal_handler
);
...
...
@@ -31,7 +30,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
// TODO(lsm): handle connect error here.
mg_printf
(
conn
,
"GET %s HTTP/1.0
\r\n
Host: %s
\r\n\r\n
"
,
"/gapi/translate?from=eng&dest=fra&format=json&phrase=cat"
,
s_remote_
host
);
s_remote_
addr
);
return
MG_TRUE
;
case
MG_REPLY
:
...
...
@@ -47,7 +46,7 @@ static int ev_handler(struct mg_connection *conn, enum mg_event ev) {
return
MG_TRUE
;
case
MG_REQUEST
:
if
((
client
=
mg_connect
(
s_server
,
s_remote_
host
,
s_remote_port
,
0
))
!=
NULL
)
{
if
((
client
=
mg_connect
(
s_server
,
s_remote_
addr
))
!=
NULL
)
{
// Interconnect requests
client
->
connection_param
=
conn
;
conn
->
connection_param
=
client
;
...
...
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