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
85f5338e
Commit
85f5338e
authored
Aug 23, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Aug 26, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http.sys: Find a request queue to assign new HTTP requests to.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
20ab0dac
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
0 deletions
+29
-0
http.c
dlls/http.sys/http.c
+29
-0
No files found.
dlls/http.sys/http.c
View file @
85f5338e
...
...
@@ -54,6 +54,7 @@ struct connection
unsigned
int
len
,
size
;
BOOL
available
;
struct
request_queue
*
queue
;
/* Things we already parsed out of the request header in parse_request().
* These are valid only if "available" is TRUE. */
...
...
@@ -180,12 +181,20 @@ static int parse_number(const char *str, const char **endptr, const char *end)
return
n
;
}
static
BOOL
host_matches
(
const
struct
connection
*
conn
,
const
struct
request_queue
*
queue
)
{
const
char
*
conn_host
=
(
conn
->
url
[
0
]
==
'/'
)
?
conn
->
host
:
conn
->
url
+
7
;
return
!
memicmp
(
queue
->
url
+
7
,
conn_host
,
strlen
(
queue
->
url
)
-
8
/* strip final slash */
);
}
/* Upon receiving a request, parse it to ensure that it is a valid HTTP request,
* and mark down some information that we will use later. Returns 1 if we parsed
* a complete request, 0 if incomplete, -1 if invalid. */
static
int
parse_request
(
struct
connection
*
conn
)
{
const
char
*
const
req
=
conn
->
buffer
,
*
const
end
=
conn
->
buffer
+
conn
->
len
;
struct
request_queue
*
queue
;
const
char
*
p
=
req
,
*
q
;
int
len
,
ret
;
...
...
@@ -275,6 +284,18 @@ static int parse_request(struct connection *conn)
TRACE
(
"Received a full request, length %u bytes.
\n
"
,
conn
->
req_len
);
conn
->
queue
=
NULL
;
/* Find a queue which can receive this request. */
LIST_FOR_EACH_ENTRY
(
queue
,
&
request_queues
,
struct
request_queue
,
entry
)
{
if
(
host_matches
(
conn
,
queue
))
{
TRACE
(
"Assigning request to queue %p.
\n
"
,
queue
);
conn
->
queue
=
queue
;
break
;
}
}
/* Stop selecting on incoming data until a response is queued. */
WSAEventSelect
(
conn
->
socket
,
request_event
,
FD_CLOSE
);
...
...
@@ -376,6 +397,7 @@ static NTSTATUS http_add_url(struct request_queue *queue, IRP *irp)
{
const
struct
http_add_url_params
*
params
=
irp
->
AssociatedIrp
.
SystemBuffer
;
struct
sockaddr_in
addr
;
struct
connection
*
conn
;
char
*
url
,
*
endptr
;
int
s
,
count
=
0
;
ULONG
true
=
1
;
...
...
@@ -453,6 +475,13 @@ static NTSTATUS http_add_url(struct request_queue *queue, IRP *irp)
queue
->
url
=
url
;
queue
->
context
=
params
->
context
;
/* See if any pending requests now match this queue. */
LIST_FOR_EACH_ENTRY
(
conn
,
&
connections
,
struct
connection
,
entry
)
{
if
(
conn
->
available
&&
!
conn
->
queue
&&
host_matches
(
conn
,
queue
))
conn
->
queue
=
queue
;
}
LeaveCriticalSection
(
&
http_cs
);
return
STATUS_SUCCESS
;
...
...
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