Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Zach Beane
zacl
Commits
268433c7
Commit
268433c7
authored
Nov 25, 2016
by
Zach Beane
Browse files
Implement STREAM-READ-CHAR-NO-HANG on sockets.
This allows POST requests to work.
parent
81c21a0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
package-socket.lisp
View file @
268433c7
...
...
@@ -56,6 +56,11 @@
:eof
(
code-char
byte
))))
(
defmethod
stream-read-char-no-hang
((
stream
zacl-socket
))
(
let
((
ready
(
wait-for-input
(
socket
stream
)
:timeout
0
:ready-only
t
)))
(
when
ready
(
stream-read-char
stream
))))
(
defmethod
stream-read-sequence
((
stream
zacl-socket
)
sequence
start
end
&key
&allow-other-keys
)
(
when
(
stringp
sequence
)
...
...
@@ -68,7 +73,17 @@
(
defmethod
ccl:stream-read-vector
((
stream
zacl-socket
)
sequence
start
end
)
(
unless
start
(
setf
start
0
))
(
unless
end
(
setf
end
(
length
sequence
)))
(
read-sequence
sequence
(
real-stream
stream
)
:start
start
:end
end
))
(
if
(
stringp
sequence
)
(
let
((
offset
start
)
(
buffer
(
make-array
(
-
end
start
)
:element-type
'
(
unsigned-byte
8
))))
(
let*
((
after-index
(
read-sequence
buffer
(
real-stream
stream
)))
(
string
(
octets-to-string
buffer
:start
0
:end
after-index
:external-format
:latin-1
)))
(
replace
sequence
string
:start1
start
:end1
end
:start2
0
:end2
after-index
)
(
print
(
list
:stream-read-vector
"Is this working?"
))
(
+
offset
after-index
)))
(
read-sequence
sequence
(
real-stream
stream
)
:start
start
:end
end
)))
(
defmethod
stream-force-output
((
stream
zacl-socket
))
(
force-output
(
socket-stream
(
socket
stream
))))
...
...
package.lisp
View file @
268433c7
...
...
@@ -68,7 +68,8 @@
#:usocket
#:stream-usocket
#:socket-stream
#:socket-close
)
#:socket-close
#:wait-for-input
)
(
:import-from
#:bordeaux-threads
#:make-thread
#:current-thread
...
...
@@ -91,6 +92,7 @@
#:stream-write-string
#:stream-write-sequence
#:stream-read-char
#:stream-read-char-no-hang
#:stream-read-byte
#:stream-read-sequence
#:stream-force-output
)
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment