aboutsummaryrefslogtreecommitdiffhomepage
path: root/uzbl.h
diff options
context:
space:
mode:
authorGravatar Laurence Withers <lwithers@amethyst.(none)>2009-07-22 19:46:43 +0000
committerGravatar Laurence Withers <lwithers@amethyst.(none)>2009-07-22 19:46:43 +0000
commit353472953ada54d5e1b5d235ca472254478d17ad (patch)
treea761128a993525d30acc5950fb133e31e3302aff /uzbl.h
parente0a3e5e4ff2b2d038df52936c5ccd4b3b40e198d (diff)
Add talk_to_socket handler
This handler talks directly to a daemon using a Unix SOCK_SEQPACKET socket, allowing e.g. cookie handlers to be implemented without having to fork and and execute an external program or script interpreter. A little explanation of the functioning of talk_to_socket(): 1. We receive our argument as a string in the format of "HANDLER EXTRA_ARGS". 2. Copy "HANDLER" into our Unix socket address structure and connect to that address (blocking). Error out if connection fails. 3. Write "EXTRA_ARGS" to the socket. Error out if writing fails. 4. Use poll() to wait for a response, timing out after 500ms of inactivity. 5. Use ioctl(FIONREAD) to find out how long the pending datagram is. 6. Allocate an appropriately sized buffer (len+1) and write a null at the end, so our output is always null-terminated no matter what. 7. Read from socket into buffer. Error out if read fails. 8. Close socket.
Diffstat (limited to 'uzbl.h')
-rw-r--r--uzbl.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/uzbl.h b/uzbl.h
index c9d81b2..4b0a98b 100644
--- a/uzbl.h
+++ b/uzbl.h
@@ -338,6 +338,9 @@ char*
build_progressbar_ascii(int percent);
void
+talk_to_socket(WebKitWebView *web_view, GArray *argv, GString *result);
+
+void
spawn(WebKitWebView *web_view, GArray *argv, GString *result);
void