@@ -55,13 +55,25 @@ namespace VSGI.FastCGI {
5555 return " Unknown error code '%d '" . printf (error);
5656 }
5757
58- private class StreamInputStream : UnixInputStream {
58+ private class StreamInputStream :
59+ #if GIO_UNIX
60+ UnixInputStream
61+ #else
62+ InputStream
63+ #endif
64+ {
5965
6066 public unowned global:: FastCGI . Stream @in { construct; get ; }
6167
68+ #if GIO_UNIX
6269 public StreamInputStream (int fd , global ::FastCGI .Stream @in ) {
6370 Object (fd: fd, close_fd: false , @in: @in );
6471 }
72+ #else
73+ public StreamInputStream (global ::FastCGI .Stream @in ) {
74+ Object (@in: @in );
75+ }
76+ #endif
6577
6678 public override ssize_t read (uint8 [] buffer , Cancellable ? cancellable = null ) throws IOError {
6779 var read = this . in . read (buffer);
@@ -84,15 +96,27 @@ namespace VSGI.FastCGI {
8496 }
8597 }
8698
87- private class StreamOutputStream : UnixOutputStream {
99+ private class StreamOutputStream :
100+ #if GIO_UNIX
101+ UnixOutputStream
102+ #else
103+ OutputStream
104+ #endif
105+ {
88106
89107 public unowned global:: FastCGI . Stream @out { construct; get ; }
90108
91109 public unowned global:: FastCGI . Stream err { construct; get ; }
92110
111+ #if GIO_UNIX
93112 public StreamOutputStream (int fd , global ::FastCGI .Stream @out , global ::FastCGI .Stream err ) {
94113 Object (fd: fd, close_fd: false , @out : @out , err: err);
95114 }
115+ #else
116+ public StreamOutputStream (global ::FastCGI .Stream @out , global ::FastCGI .Stream err ) {
117+ Object (@out : @out , err: err);
118+ }
119+ #endif
96120
97121 public override ssize_t write (uint8 [] buffer , Cancellable ? cancellable = null ) throws IOError {
98122 var written = this . out . put_str (buffer);
@@ -191,7 +215,10 @@ namespace VSGI.FastCGI {
191215 if (address == null ) {
192216 fd = global:: FastCGI . LISTENSOCK_FILENO ;
193217 _uris. append (new Soup .URI (" fcgi+fd://%d /" . printf (fd)));
194- } else if (address is UnixSocketAddress ) {
218+ }
219+
220+ #if GIO_UNIX
221+ else if (address is UnixSocketAddress ) {
195222 var socket_address = address as UnixSocketAddress ;
196223
197224 fd = global:: FastCGI . open_socket (socket_address. path, backlog);
@@ -201,7 +228,10 @@ namespace VSGI.FastCGI {
201228 }
202229
203230 _uris. append (new Soup .URI (" fcgi+unix://%s /" . printf (socket_address. path)));
204- } else if (address is InetSocketAddress ) {
231+ }
232+ #endif
233+
234+ else if (address is InetSocketAddress ) {
205235 var inet_address = address as InetSocketAddress ;
206236
207237 if (inet_address. get_family () == SocketFamily . IPV6 ) {
@@ -311,8 +341,13 @@ namespace VSGI.FastCGI {
311341
312342 yield ;
313343
344+ #if GIO_UNIX
314345 this . _input_stream = new StreamInputStream (fd, request. in );
315346 this . _output_stream = new StreamOutputStream (fd, request. out , request. err);
347+ #else
348+ this . _input_stream = new StreamInputStream (request. in );
349+ this . _output_stream = new StreamOutputStream (request. out , request. err);
350+ #endif
316351
317352 return true ;
318353 }
0 commit comments