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
b1c6f41d
Commit
b1c6f41d
authored
Aug 03, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 04, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mshtml: Moved getting HTTP header to separated function.
parent
dd0894c7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
25 deletions
+53
-25
mshtml_private.h
dlls/mshtml/mshtml_private.h
+13
-0
nsio.c
dlls/mshtml/nsio.c
+40
-25
No files found.
dlls/mshtml/mshtml_private.h
View file @
b1c6f41d
...
...
@@ -943,6 +943,19 @@ static inline LPWSTR heap_strdupW(LPCWSTR str)
return
ret
;
}
static
inline
LPWSTR
heap_strndupW
(
LPCWSTR
str
,
unsigned
len
)
{
LPWSTR
ret
=
NULL
;
if
(
str
)
{
ret
=
heap_alloc
((
len
+
1
)
*
sizeof
(
WCHAR
));
memcpy
(
ret
,
str
,
len
*
sizeof
(
WCHAR
));
ret
[
len
]
=
0
;
}
return
ret
;
}
static
inline
char
*
heap_strdupA
(
const
char
*
str
)
{
char
*
ret
=
NULL
;
...
...
dlls/mshtml/nsio.c
View file @
b1c6f41d
...
...
@@ -311,6 +311,45 @@ static inline BOOL is_http_channel(nsChannel *This)
return
This
->
url_scheme
==
URL_SCHEME_HTTP
||
This
->
url_scheme
==
URL_SCHEME_HTTPS
;
}
static
http_header_t
*
find_http_header
(
struct
list
*
headers
,
const
WCHAR
*
name
,
int
len
)
{
http_header_t
*
iter
;
LIST_FOR_EACH_ENTRY
(
iter
,
headers
,
http_header_t
,
entry
)
{
if
(
!
strcmpiW
(
iter
->
header
,
name
))
return
iter
;
}
return
NULL
;
}
static
nsresult
get_channel_http_header
(
struct
list
*
headers
,
const
nsACString
*
header_name_str
,
nsACString
*
_retval
)
{
const
char
*
header_namea
;
http_header_t
*
header
;
WCHAR
*
header_name
;
char
*
data
;
nsACString_GetData
(
header_name_str
,
&
header_namea
);
header_name
=
heap_strdupAtoW
(
header_namea
);
if
(
!
header_name
)
return
NS_ERROR_UNEXPECTED
;
header
=
find_http_header
(
headers
,
header_name
,
strlenW
(
header_name
));
heap_free
(
header_name
);
if
(
!
header
)
return
NS_ERROR_NOT_AVAILABLE
;
data
=
heap_strdupWtoA
(
header
->
data
);
if
(
!
data
)
return
NS_ERROR_UNEXPECTED
;
nsACString_SetData
(
_retval
,
data
);
heap_free
(
data
);
return
NS_OK
;
}
static
void
free_http_headers
(
struct
list
*
list
)
{
http_header_t
*
iter
,
*
iter_next
;
...
...
@@ -1079,34 +1118,10 @@ static nsresult NSAPI nsChannel_GetResponseHeader(nsIHttpChannel *iface,
const
nsACString
*
header
,
nsACString
*
_retval
)
{
nsChannel
*
This
=
NSCHANNEL_THIS
(
iface
);
const
char
*
header_str
;
WCHAR
*
header_wstr
;
struct
ResponseHeader
*
this_header
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_nsacstr
(
header
),
_retval
);
nsACString_GetData
(
header
,
&
header_str
);
header_wstr
=
heap_strdupAtoW
(
header_str
);
if
(
!
header_wstr
)
return
NS_ERROR_UNEXPECTED
;
LIST_FOR_EACH_ENTRY
(
this_header
,
&
This
->
response_headers
,
struct
ResponseHeader
,
entry
)
{
if
(
!
strcmpW
(
this_header
->
header
,
header_wstr
))
{
char
*
data
=
heap_strdupWtoA
(
this_header
->
data
);
if
(
!
data
)
{
heap_free
(
header_wstr
);
return
NS_ERROR_UNEXPECTED
;
}
nsACString_SetData
(
_retval
,
data
);
heap_free
(
data
);
heap_free
(
header_wstr
);
return
NS_OK
;
}
}
heap_free
(
header_wstr
);
return
NS_ERROR_NOT_AVAILABLE
;
return
get_channel_http_header
(
&
This
->
response_headers
,
header
,
_retval
);
}
static
nsresult
NSAPI
nsChannel_SetResponseHeader
(
nsIHttpChannel
*
iface
,
...
...
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