Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
ca0f5793
Commit
ca0f5793
authored
Mar 19, 2004
by
Ferenc Wagner
Committed by
Alexandre Julliard
Mar 19, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Refactor and fix connection opening.
- Target test.winehq.org.
parent
5983223b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
23 deletions
+25
-23
send.c
programs/winetest/send.c
+22
-22
util.c
programs/winetest/util.c
+3
-1
No files found.
programs/winetest/send.c
View file @
ca0f5793
...
...
@@ -33,25 +33,29 @@ open_http (const char *server)
report
(
R_STATUS
,
"Opening HTTP connection to %s"
,
server
);
if
(
WSAStartup
(
MAKEWORD
(
2
,
2
),
&
wsad
))
return
INVALID_SOCKET
;
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
s
!=
INVALID_SOCKET
)
{
unsigned
long
addr
=
inet_addr
(
server
);
sa
.
sin_family
=
AF_INET
;
sa
.
sin_port
=
htons
(
80
);
if
(
addr
!=
INADDR_NONE
)
sa
.
sin_addr
.
s_addr
=
addr
;
else
{
struct
hostent
*
host
;
if
((
host
=
gethostbyname
(
server
))
!=
NULL
)
addr
=
((
struct
in_addr
*
)
host
->
h_addr
)
->
s_addr
;
sa
.
sin_addr
.
s_addr
=
inet_addr
(
server
);
if
(
sa
.
sin_addr
.
s_addr
==
INADDR_NONE
)
{
struct
hostent
*
host
=
gethostbyname
(
server
);
if
(
!
host
)
{
report
(
R_ERROR
,
"Hostname lookup failed for %s"
,
server
);
goto
failure
;
}
if
(
!
connect
(
s
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
struct
sockaddr_in
)))
return
s
;
sa
.
sin_addr
.
s_addr
=
((
struct
in_addr
*
)
host
->
h_addr
)
->
s_addr
;
}
s
=
socket
(
AF_INET
,
SOCK_STREAM
,
IPPROTO_TCP
);
if
(
s
==
INVALID_SOCKET
)
{
report
(
R_ERROR
,
"Can't open network socket: %d"
,
WSAGetLastError
());
goto
failure
;
}
if
(
!
connect
(
s
,
(
struct
sockaddr
*
)
&
sa
,
sizeof
(
struct
sockaddr_in
)))
return
s
;
report
(
R_ERROR
,
"Can't connect: %d"
,
WSAGetLastError
());
closesocket
(
s
);
failure:
WSACleanup
();
return
INVALID_SOCKET
;
}
...
...
@@ -110,7 +114,7 @@ send_file (const char *name)
/* RFC 2068 */
#define SEP "-"
const
char
head
[]
=
"POST /submit HTTP/1.0
\r\n
"
"Host:
afavant
\r\n
"
"Host:
test.winehq.org
\r\n
"
"User-Agent: Winetest Shell
\r\n
"
"Content-Type: multipart/form-data; boundary="
SEP
"
\r\n
"
"Content-Length: %u
\r\n\r\n
"
;
...
...
@@ -123,12 +127,8 @@ send_file (const char *name)
"--"
SEP
"--
\r\n
"
;
buffer
=
xmalloc
(
BUFLEN
+
1
);
s
=
open_http
(
"www.winehq.org"
);
if
(
s
==
INVALID_SOCKET
)
{
report
(
R_WARNING
,
"Can't open network connection: %d"
,
WSAGetLastError
());
return
1
;
}
s
=
open_http
(
"test.winehq.org"
);
if
(
s
==
INVALID_SOCKET
)
return
1
;
f
=
fopen
(
name
,
"rb"
);
if
(
!
f
)
{
...
...
programs/winetest/util.c
View file @
ca0f5793
...
...
@@ -19,6 +19,7 @@
*
*/
#include <windows.h>
#include <errno.h>
#include "winetest.h"
...
...
@@ -43,7 +44,8 @@ void xprintf (const char *fmt, ...)
va_list
ap
;
va_start
(
ap
,
fmt
);
if
(
vprintf
(
fmt
,
ap
)
<
0
)
report
(
R_FATAL
,
"Can't write logs."
);
if
(
vprintf
(
fmt
,
ap
)
<
0
)
report
(
R_FATAL
,
"Can't write logs: %d"
,
errno
);
va_end
(
ap
);
}
...
...
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