Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
ce00aa01
Commit
ce00aa01
authored
Aug 15, 2008
by
Hans Leidekker
Committed by
Alexandre Julliard
Aug 19, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winhttp: Implement WinHttpOpenRequest.
parent
770ee204
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
125 additions
and
21 deletions
+125
-21
main.c
dlls/winhttp/main.c
+0
-14
session.c
dlls/winhttp/session.c
+87
-0
winhttp.c
dlls/winhttp/tests/winhttp.c
+6
-7
winhttp_private.h
dlls/winhttp/winhttp_private.h
+32
-0
No files found.
dlls/winhttp/main.c
View file @
ce00aa01
...
...
@@ -117,20 +117,6 @@ BOOL WINAPI WinHttpGetIEProxyConfigForCurrentUser(WINHTTP_CURRENT_USER_IE_PROXY_
}
/***********************************************************************
* WinHttpOpenRequest (winhttp.@)
*/
HINTERNET
WINAPI
WinHttpOpenRequest
(
HINTERNET
hConnect
,
LPCWSTR
pwszVerb
,
LPCWSTR
pwszObjectName
,
LPCWSTR
pwszVersion
,
LPCWSTR
pwszReferrer
,
LPCWSTR
*
ppwszAcceptTypes
,
DWORD
dwFlags
)
{
FIXME
(
"(%s, %s, %s, %s, 0x%x): stub
\n
"
,
debugstr_w
(
pwszVerb
),
debugstr_w
(
pwszObjectName
),
debugstr_w
(
pwszVersion
),
debugstr_w
(
pwszReferrer
),
dwFlags
);
SetLastError
(
ERROR_NOT_SUPPORTED
);
return
NULL
;
}
/***********************************************************************
* WinHttpSendRequest (winhttp.@)
*/
BOOL
WINAPI
WinHttpSendRequest
(
HINTERNET
hRequest
,
LPCWSTR
pwszHeaders
,
DWORD
dwHeadersLength
,
...
...
dlls/winhttp/session.c
View file @
ce00aa01
...
...
@@ -183,6 +183,93 @@ end:
}
/***********************************************************************
* request_destroy (internal)
*/
static
void
request_destroy
(
object_header_t
*
hdr
)
{
request_t
*
request
=
(
request_t
*
)
hdr
;
int
i
;
TRACE
(
"%p
\n
"
,
request
);
release_object
(
&
request
->
connect
->
hdr
);
heap_free
(
request
->
verb
);
heap_free
(
request
->
path
);
heap_free
(
request
->
version
);
heap_free
(
request
->
raw_headers
);
heap_free
(
request
->
status_text
);
for
(
i
=
0
;
i
<
request
->
num_headers
;
i
++
)
{
heap_free
(
request
->
headers
[
i
].
field
);
heap_free
(
request
->
headers
[
i
].
value
);
}
heap_free
(
request
->
headers
);
heap_free
(
request
);
}
static
const
object_vtbl_t
request_vtbl
=
{
request_destroy
,
NULL
,
NULL
};
/***********************************************************************
* WinHttpOpenRequest (winhttp.@)
*/
HINTERNET
WINAPI
WinHttpOpenRequest
(
HINTERNET
hconnect
,
LPCWSTR
verb
,
LPCWSTR
object
,
LPCWSTR
version
,
LPCWSTR
referrer
,
LPCWSTR
*
types
,
DWORD
flags
)
{
request_t
*
request
;
connect_t
*
connect
;
HINTERNET
hrequest
=
NULL
;
TRACE
(
"%p, %s, %s, %s, %s, %p, 0x%08x
\n
"
,
hconnect
,
debugstr_w
(
verb
),
debugstr_w
(
object
),
debugstr_w
(
version
),
debugstr_w
(
referrer
),
types
,
flags
);
if
(
!
(
connect
=
(
connect_t
*
)
grab_object
(
hconnect
)))
{
set_last_error
(
ERROR_INVALID_HANDLE
);
return
NULL
;
}
if
(
connect
->
hdr
.
type
!=
WINHTTP_HANDLE_TYPE_CONNECT
)
{
release_object
(
&
connect
->
hdr
);
set_last_error
(
ERROR_WINHTTP_INCORRECT_HANDLE_TYPE
);
return
NULL
;
}
if
(
!
(
request
=
heap_alloc_zero
(
sizeof
(
request_t
)
)))
{
release_object
(
&
connect
->
hdr
);
return
NULL
;
}
request
->
hdr
.
type
=
WINHTTP_HANDLE_TYPE_REQUEST
;
request
->
hdr
.
vtbl
=
&
request_vtbl
;
request
->
hdr
.
refs
=
1
;
request
->
hdr
.
flags
=
flags
;
request
->
hdr
.
callback
=
connect
->
hdr
.
callback
;
request
->
hdr
.
notify_mask
=
connect
->
hdr
.
notify_mask
;
addref_object
(
&
connect
->
hdr
);
request
->
connect
=
connect
;
list_add_head
(
&
connect
->
hdr
.
children
,
&
request
->
hdr
.
entry
);
if
(
verb
&&
!
(
request
->
verb
=
strdupW
(
verb
)))
goto
end
;
if
(
object
&&
!
(
request
->
path
=
strdupW
(
object
)))
goto
end
;
if
(
version
&&
!
(
request
->
version
=
strdupW
(
version
)))
goto
end
;
if
(
!
(
hrequest
=
alloc_handle
(
&
request
->
hdr
)))
goto
end
;
request
->
hdr
.
handle
=
hrequest
;
end:
release_object
(
&
request
->
hdr
);
TRACE
(
"returning %p
\n
"
,
hrequest
);
return
hrequest
;
}
/***********************************************************************
* WinHttpCloseHandle (winhttp.@)
*/
BOOL
WINAPI
WinHttpCloseHandle
(
HINTERNET
handle
)
...
...
dlls/winhttp/tests/winhttp.c
View file @
ce00aa01
...
...
@@ -55,13 +55,12 @@ static void test_OpenRequest (void)
skip
(
"Network unreachable, skipping.
\n
"
);
goto
done
;
}
todo_wine
ok
(
request
!=
NULL
,
"WinHttpOpenrequest failed to open a request, error: %u.
\n
"
,
GetLastError
());
ok
(
request
!=
NULL
,
"WinHttpOpenrequest failed to open a request, error: %u.
\n
"
,
GetLastError
());
ret
=
WinHttpSendRequest
(
request
,
WINHTTP_NO_ADDITIONAL_HEADERS
,
0
,
NULL
,
0
,
0
,
0
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpSendRequest failed: %u
\n
"
,
GetLastError
());
ret
=
WinHttpCloseHandle
(
request
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing request, got %d.
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing request, got %d.
\n
"
,
ret
);
done:
ret
=
WinHttpCloseHandle
(
connection
);
...
...
@@ -108,7 +107,7 @@ static void test_SendRequest (void)
skip
(
"Network unreachable, skipping.
\n
"
);
goto
done
;
}
todo_wine
ok
(
request
!=
NULL
,
"WinHttpOpenrequest failed to open a request, error: %u.
\n
"
,
GetLastError
());
ok
(
request
!=
NULL
,
"WinHttpOpenrequest failed to open a request, error: %u.
\n
"
,
GetLastError
());
ret
=
WinHttpSendRequest
(
request
,
content_type
,
header_len
,
post_data
,
optional_len
,
total_len
,
0
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpSendRequest failed: %u
\n
"
,
GetLastError
());
...
...
@@ -134,7 +133,7 @@ static void test_SendRequest (void)
"Data read did not match, got '%s'.
\n
"
,
buffer
);
ret
=
WinHttpCloseHandle
(
request
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing request, got %d.
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing request, got %d.
\n
"
,
ret
);
done:
ret
=
WinHttpCloseHandle
(
connection
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing connection, got %d.
\n
"
,
ret
);
...
...
@@ -236,7 +235,7 @@ static void test_WinHttpAddHeaders(void)
skip
(
"Network unreachable, skipping.
\n
"
);
goto
done
;
}
todo_wine
ok
(
request
!=
NULL
,
"WinHttpOpenRequest failed to open a request, error: %u.
\n
"
,
GetLastError
());
ok
(
request
!=
NULL
,
"WinHttpOpenRequest failed to open a request, error: %u.
\n
"
,
GetLastError
());
index
=
0
;
len
=
sizeof
(
buffer
);
...
...
@@ -540,7 +539,7 @@ static void test_WinHttpAddHeaders(void)
ok
(
ret
==
FALSE
,
"WinHttpQueryHeaders succeeded unexpectedly, found third header.
\n
"
);
ret
=
WinHttpCloseHandle
(
request
);
todo_wine
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing request, got %d.
\n
"
,
ret
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing request, got %d.
\n
"
,
ret
);
done:
ret
=
WinHttpCloseHandle
(
connection
);
ok
(
ret
==
TRUE
,
"WinHttpCloseHandle failed on closing connection, got %d.
\n
"
,
ret
);
...
...
dlls/winhttp/winhttp_private.h
View file @
ce00aa01
...
...
@@ -78,6 +78,38 @@ typedef struct
struct
sockaddr_in
sockaddr
;
}
connect_t
;
typedef
struct
{
int
socket
;
char
*
peek_msg
;
char
*
peek_msg_mem
;
size_t
peek_len
;
}
netconn_t
;
typedef
struct
{
LPWSTR
field
;
LPWSTR
value
;
WORD
flags
;
WORD
count
;
}
header_t
;
typedef
struct
{
object_header_t
hdr
;
connect_t
*
connect
;
LPWSTR
verb
;
LPWSTR
path
;
LPWSTR
version
;
LPWSTR
raw_headers
;
netconn_t
netconn
;
LPWSTR
status_text
;
DWORD
content_length
;
/* total number of bytes to be read (per chunk) */
DWORD
content_read
;
/* bytes read so far */
header_t
*
headers
;
DWORD
num_headers
;
}
request_t
;
object_header_t
*
addref_object
(
object_header_t
*
);
object_header_t
*
grab_object
(
HINTERNET
);
void
release_object
(
object_header_t
*
);
...
...
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