Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mongoose
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ganil-acq
GANILinux
linux-service
library
mongoose
Commits
0fb2f38c
Commit
0fb2f38c
authored
10 years ago
by
Sergey Lyubka
Browse files
Options
Downloads
Patches
Plain Diff
Fixed mg_connect() call
parent
aa007f12
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/http_client/http_client.c
+3
-4
3 additions, 4 deletions
examples/http_client/http_client.c
with
3 additions
and
4 deletions
examples/http_client/http_client.c
+
3
−
4
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
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment