Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
8e935b58
Commit
8e935b58
authored
20 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
TommyTam made a patch to handle stdin redirection for win32.
parent
c93e9725
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/telnet.c
+58
-8
58 additions, 8 deletions
lib/telnet.c
with
58 additions
and
8 deletions
lib/telnet.c
+
58
−
8
View file @
8e935b58
...
...
@@ -1089,7 +1089,9 @@ CURLcode Curl_telnet(struct connectdata *conn)
WSAEVENT
event_handle
;
WSANETWORKEVENTS
events
;
HANDLE
stdin_handle
;
HANDLE
objs
[
2
];
HANDLE
objs
[
2
];
DWORD
obj_count
;
DWORD
wait_timeout
;
DWORD
waitret
;
DWORD
readfile_read
;
#else
...
...
@@ -1181,8 +1183,8 @@ CURLcode Curl_telnet(struct connectdata *conn)
stdin_handle
=
GetStdHandle
(
STD_INPUT_HANDLE
);
/* Create the list of objects to wait for */
objs
[
0
]
=
stdin
_handle
;
objs
[
1
]
=
event
_handle
;
objs
[
0
]
=
event
_handle
;
objs
[
1
]
=
stdin
_handle
;
/* Tell winsock what events we want to listen to */
if
(
event_select_func
(
sockfd
,
event_handle
,
FD_READ
|
FD_CLOSE
)
==
SOCKET_ERROR
)
{
...
...
@@ -1190,12 +1192,60 @@ CURLcode Curl_telnet(struct connectdata *conn)
FreeLibrary
(
wsock2
);
return
0
;
}
/* If stdin_handle is a pipe, use PeekNamedPipe() method to check it,
else use the old WaitForMultipleObjects() way */
if
(
GetFileType
(
stdin_handle
)
==
FILE_TYPE_PIPE
)
{
/* Don't wait for stdin_handle, just wait for event_handle */
obj_count
=
1
;
/* Check stdin_handle per 100 milliseconds */
wait_timeout
=
100
;
}
else
{
obj_count
=
2
;
wait_timeout
=
INFINITE
;
}
/* Keep on listening and act on events */
while
(
keepon
)
{
waitret
=
WaitForMultipleObjects
(
2
,
objs
,
FALSE
,
INFINITE
);
switch
(
waitret
-
WAIT_OBJECT_0
)
{
case
0
:
waitret
=
WaitForMultipleObjects
(
obj_count
,
objs
,
FALSE
,
wait_timeout
);
switch
(
waitret
)
{
case
WAIT_TIMEOUT
:
{
unsigned
char
outbuf
[
2
];
int
out_count
=
0
;
ssize_t
bytes_written
;
char
*
buffer
=
buf
;
for
(;;)
{
if
(
!
PeekNamedPipe
(
stdin_handle
,
NULL
,
0
,
NULL
,
&
nread
,
NULL
))
{
keepon
=
FALSE
;
break
;
}
if
(
!
nread
)
break
;
if
(
!
ReadFile
(
stdin_handle
,
buf
,
sizeof
(
data
->
state
.
buffer
),
&
readfile_read
,
NULL
))
{
keepon
=
FALSE
;
break
;
}
nread
=
readfile_read
;
while
(
nread
--
)
{
outbuf
[
0
]
=
*
buffer
++
;
out_count
=
1
;
if
(
outbuf
[
0
]
==
CURL_IAC
)
outbuf
[
out_count
++
]
=
CURL_IAC
;
Curl_write
(
conn
,
conn
->
sock
[
FIRSTSOCKET
],
outbuf
,
out_count
,
&
bytes_written
);
}
}
}
break
;
case
WAIT_OBJECT_0
+
1
:
{
unsigned
char
outbuf
[
2
];
int
out_count
=
0
;
...
...
@@ -1221,7 +1271,7 @@ CURLcode Curl_telnet(struct connectdata *conn)
}
break
;
case
1
:
case
WAIT_OBJECT_0
:
if
(
enum_netevents_func
(
sockfd
,
event_handle
,
&
events
)
!=
SOCKET_ERROR
)
{
if
(
events
.
lNetworkEvents
&
FD_READ
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment