projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added socket stream and socket into SilcClientConnection context.
[silc.git]
/
lib
/
silchttp
/
silchttpphp.c
diff --git
a/lib/silchttp/silchttpphp.c
b/lib/silchttp/silchttpphp.c
index 02f95e2c89350b30e0faa51416e9872faa109bf9..d1cb24e09d968ef098c3c388d6b2dd651eeb8aa6 100644
(file)
--- a/
lib/silchttp/silchttpphp.c
+++ b/
lib/silchttp/silchttpphp.c
@@
-4,7
+4,7
@@
Author: Pekka Riikonen <priikone@silcnet.org>
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2006 Pekka Riikonen
+ Copyright (C) 2006
- 2007
Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-34,7
+34,7
@@
SilcBuffer silc_http_php(char *php_data)
return NULL;
#else
memset(tmp, 0, sizeof(tmp));
return NULL;
#else
memset(tmp, 0, sizeof(tmp));
- snprintf(tmp, sizeof(tmp) - 1, "/tmp/silchttpphpXXXXXX");
+ s
ilc_s
nprintf(tmp, sizeof(tmp) - 1, "/tmp/silchttpphpXXXXXX");
if (mkstemp(tmp) == -1)
return NULL;
name = tmp;
if (mkstemp(tmp) == -1)
return NULL;
name = tmp;
@@
-61,12
+61,12
@@
SilcBuffer silc_http_php_file(const char *filename)
SilcBuffer ret = NULL;
unsigned char tmp[8192];
FILE *fd;
SilcBuffer ret = NULL;
unsigned char tmp[8192];
FILE *fd;
- int len
, off = 0
;
+ int len;
SILC_LOG_DEBUG(("Executing PHP"));
memset(tmp, 0, sizeof(tmp));
SILC_LOG_DEBUG(("Executing PHP"));
memset(tmp, 0, sizeof(tmp));
- snprintf(tmp, sizeof(tmp) - 1, "php -f %s", filename);
+ s
ilc_s
nprintf(tmp, sizeof(tmp) - 1, "php -f %s", filename);
#ifdef SILC_WIN32
fd = _popen(tmp, "r");
#ifdef SILC_WIN32
fd = _popen(tmp, "r");
@@
-81,7
+81,11
@@
SilcBuffer silc_http_php_file(const char *filename)
len = fread(tmp, 1, sizeof(tmp), fd);
if (len < 0) {
silc_buffer_free(ret);
len = fread(tmp, 1, sizeof(tmp), fd);
if (len < 0) {
silc_buffer_free(ret);
- pclose(fd);
+#ifdef SILC_WIN32
\r
+ _pclose(fd);
+#else
\r
+ pclose(fd);
\r
+#endif /* SILC_WIN32 */
\r
return NULL;
}
return NULL;
}
@@
-89,21
+93,29
@@
SilcBuffer silc_http_php_file(const char *filename)
if (!ret) {
ret = silc_buffer_alloc(0);
if (!ret) {
if (!ret) {
ret = silc_buffer_alloc(0);
if (!ret) {
- pclose(fd);
+#ifdef SILC_WIN32
\r
+ _pclose(fd);
\r
+#else
\r
+ pclose(fd);
\r
+#endif /* SILC_WIN32 */
\r
return NULL;
}
}
silc_buffer_format(ret,
return NULL;
}
}
silc_buffer_format(ret,
- SILC_STR_
OFFSET(off)
,
- SILC_STR_
UI_XNSTRING
(tmp, len),
+ SILC_STR_
ADVANCE
,
+ SILC_STR_
DATA
(tmp, len),
SILC_STR_END);
SILC_STR_END);
- off += len;
}
} while (len);
}
} while (len);
- if (ret)
- silc_buffer_strformat(ret, "\0", SILC_STRFMT_END);
+ if (ret) {
+ silc_buffer_format(ret,
+ SILC_STR_ADVANCE,
+ SILC_STR_DATA('\0', 1),
+ SILC_STR_END);
+ silc_buffer_push(ret, silc_buffer_truelen(ret));
+ }
return ret;
}
return ret;
}