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
92008978
Commit
92008978
authored
Nov 03, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http.sys: Allow receiving entity body data.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6360ea89
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
3 deletions
+60
-3
http.c
dlls/http.sys/http.c
+53
-3
http.h
include/wine/http.h
+7
-0
No files found.
dlls/http.sys/http.c
View file @
92008978
...
...
@@ -411,9 +411,9 @@ static NTSTATUS complete_irp(struct connection *conn, IRP *irp)
const
struct
http_receive_request_params
params
=
*
(
struct
http_receive_request_params
*
)
irp
->
AssociatedIrp
.
SystemBuffer
;
DWORD
irp_size
=
(
params
.
bits
==
32
)
?
sizeof
(
struct
http_request_32
)
:
sizeof
(
struct
http_request_64
);
ULONG
cooked_len
,
host_len
,
abs_path_len
,
query_len
,
chunk_len
=
0
,
offset
,
processed
;
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
const
DWORD
output_len
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
ULONG
cooked_len
,
host_len
,
abs_path_len
,
query_len
,
chunk_len
=
0
,
offset
;
const
char
*
p
,
*
name
,
*
value
,
*
host
,
*
abs_path
,
*
query
;
USHORT
unk_headers_count
=
0
,
unk_header_idx
;
int
name_len
,
value_len
,
len
;
...
...
@@ -758,8 +758,10 @@ static NTSTATUS complete_irp(struct connection *conn, IRP *irp)
assert
(
offset
==
irp
->
IoStatus
.
Information
);
conn
->
available
=
FALSE
;
memmove
(
conn
->
buffer
,
conn
->
buffer
+
conn
->
req_len
,
conn
->
len
-
conn
->
req_len
);
conn
->
len
-=
conn
->
req_len
;
processed
=
conn
->
req_len
-
(
conn
->
content_len
-
chunk_len
);
memmove
(
conn
->
buffer
,
conn
->
buffer
+
processed
,
conn
->
len
-
processed
);
conn
->
content_len
-=
chunk_len
;
conn
->
len
-=
processed
;
return
STATUS_SUCCESS
;
}
...
...
@@ -1216,6 +1218,13 @@ static NTSTATUS http_send_response(struct request_queue *queue, IRP *irp)
{
if
(
send
(
conn
->
socket
,
response
->
buffer
,
response
->
len
,
0
)
>=
0
)
{
if
(
conn
->
content_len
)
{
/* Discard whatever entity body is left. */
memmove
(
conn
->
buffer
,
conn
->
buffer
+
conn
->
content_len
,
conn
->
len
-
conn
->
content_len
);
conn
->
len
-=
conn
->
content_len
;
}
conn
->
queue
=
NULL
;
conn
->
req_id
=
HTTP_NULL_ID
;
WSAEventSelect
(
conn
->
socket
,
request_event
,
FD_READ
|
FD_CLOSE
);
...
...
@@ -1242,6 +1251,44 @@ static NTSTATUS http_send_response(struct request_queue *queue, IRP *irp)
return
STATUS_CONNECTION_INVALID
;
}
static
NTSTATUS
http_receive_body
(
struct
request_queue
*
queue
,
IRP
*
irp
)
{
const
struct
http_receive_body_params
*
params
=
irp
->
AssociatedIrp
.
SystemBuffer
;
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
const
DWORD
output_len
=
stack
->
Parameters
.
DeviceIoControl
.
OutputBufferLength
;
struct
connection
*
conn
;
NTSTATUS
ret
;
TRACE
(
"id %s, bits %u.
\n
"
,
wine_dbgstr_longlong
(
params
->
id
),
params
->
bits
);
EnterCriticalSection
(
&
http_cs
);
if
((
conn
=
get_connection
(
params
->
id
)))
{
TRACE
(
"%u bits remaining.
\n
"
,
conn
->
content_len
);
if
(
conn
->
content_len
)
{
ULONG
len
=
min
(
conn
->
content_len
,
output_len
);
memcpy
(
irp
->
AssociatedIrp
.
SystemBuffer
,
conn
->
buffer
,
len
);
memmove
(
conn
->
buffer
,
conn
->
buffer
+
len
,
conn
->
len
-
len
);
conn
->
content_len
-=
len
;
conn
->
len
-=
len
;
irp
->
IoStatus
.
Information
=
len
;
ret
=
STATUS_SUCCESS
;
}
else
ret
=
STATUS_END_OF_FILE
;
}
else
ret
=
STATUS_CONNECTION_INVALID
;
LeaveCriticalSection
(
&
http_cs
);
return
ret
;
}
static
NTSTATUS
WINAPI
dispatch_ioctl
(
DEVICE_OBJECT
*
device
,
IRP
*
irp
)
{
IO_STACK_LOCATION
*
stack
=
IoGetCurrentIrpStackLocation
(
irp
);
...
...
@@ -1262,6 +1309,9 @@ static NTSTATUS WINAPI dispatch_ioctl(DEVICE_OBJECT *device, IRP *irp)
case
IOCTL_HTTP_SEND_RESPONSE
:
ret
=
http_send_response
(
queue
,
irp
);
break
;
case
IOCTL_HTTP_RECEIVE_BODY
:
ret
=
http_receive_body
(
queue
,
irp
);
break
;
default:
FIXME
(
"Unhandled ioctl %#x.
\n
"
,
stack
->
Parameters
.
DeviceIoControl
.
IoControlCode
);
ret
=
STATUS_NOT_IMPLEMENTED
;
...
...
include/wine/http.h
View file @
92008978
...
...
@@ -27,6 +27,7 @@
#define IOCTL_HTTP_REMOVE_URL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_BUFFERED, 0)
#define IOCTL_HTTP_RECEIVE_REQUEST CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_BUFFERED, 0)
#define IOCTL_HTTP_SEND_RESPONSE CTL_CODE(FILE_DEVICE_UNKNOWN, 0x803, METHOD_BUFFERED, 0)
#define IOCTL_HTTP_RECEIVE_BODY CTL_CODE(FILE_DEVICE_UNKNOWN, 0x804, METHOD_BUFFERED, 0)
struct
http_add_url_params
{
...
...
@@ -49,4 +50,10 @@ struct http_response
char
buffer
[
1
];
};
struct
http_receive_body_params
{
HTTP_REQUEST_ID
id
;
ULONG
bits
;
};
#endif
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