~ubuntu-branches/ubuntu/quantal/elinks/quantal

« back to all changes in this revision

Viewing changes to src/protocol/fsp/fsp.c

  • Committer: Bazaar Package Importer
  • Author(s): Siegfried-Angel Gevatter Pujals (RainCT)
  • Date: 2008-02-01 16:29:06 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080201162906-xdourui5tyjva0al
Tags: 0.11.3-5ubuntu1
 
* Merge from Debian unstable (LP: #187936); remaining changes:
  - Add X-Ubuntu-Gettext-Domain to .desktop files.
  - debian/control: Maintainer field update.
* Improve the text in the .desktop file and add some translations.
 

Show diffs side-by-side

added added

removed removed

Lines of Context:
63
63
);
64
64
 
65
65
 
 
66
/* FSP synchronous connection management: */
 
67
 
 
68
/* FIXME: Although it is probably not so much an issue, check if writes to
 
69
 * stdout fails for directory listing like we do for file fetching. */
 
70
 
66
71
static void
67
72
fsp_error(unsigned char *error)
68
73
{
140
145
        fclose(stderr);
141
146
        add_html_to_string(&buf, uristring, strlen(uristring));
142
147
 
143
 
        printf("<html><head><title>%s</title><base href=\"%s\">"
144
 
               "</head><body><h2>FSP directory %s</h2><pre>",
145
 
               buf.source, uristring, buf.source);
 
148
        printf("<html><head><title>%s</title><base href=\"%s", buf.source,
 
149
                uristring);
 
150
        if (buf.source[buf.length - 1] != '/') printf("/");
 
151
        printf("\"></head><body><h2>FSP directory %s</h2><pre>", buf.source);
146
152
 
147
153
        dir = fsp_opendir(ses, data);
148
154
        if (!dir) goto end;
213
219
                fclose(stderr);
214
220
 
215
221
                while ((r = fsp_fread(buf, 1, READ_SIZE, file)) > 0)
216
 
                        fwrite(buf, 1, r, stdout);
 
222
                        if (safe_write(STDOUT_FILENO, buf, r) <= 0)
 
223
                                break;
217
224
 
218
225
                fsp_fclose(file);
219
226
                fsp_close_session(ses);
221
228
        }
222
229
}
223
230
 
 
231
#undef READ_SIZE
 
232
 
 
233
 
 
234
/* FSP asynchronous connection management: */
 
235
 
224
236
static void
225
237
fsp_got_data(struct socket *socket, struct read_buffer *rb)
226
238
{
283
295
        read_from_socket(conn->data_socket, buf, S_CONN, fsp_got_data); 
284
296
}
285
297
 
286
 
#undef READ_SIZE
287
 
 
288
298
 
289
299
void
290
300
fsp_protocol_handler(struct connection *conn)