summaryrefslogtreecommitdiff
path: root/sapi/webjames
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:37:27 -0400
commit2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch)
tree41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /sapi/webjames
parentd29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff)
downloadphp-upstream/5.2.2.tar.gz
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'sapi/webjames')
-rw-r--r--sapi/webjames/php_webjames.h2
-rw-r--r--sapi/webjames/webjames.c46
2 files changed, 34 insertions, 14 deletions
diff --git a/sapi/webjames/php_webjames.h b/sapi/webjames/php_webjames.h
index 9b9c037c1..99a55efb4 100644
--- a/sapi/webjames/php_webjames.h
+++ b/sapi/webjames/php_webjames.h
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
diff --git a/sapi/webjames/webjames.c b/sapi/webjames/webjames.c
index 3068d8fcc..e7eea9e0b 100644
--- a/sapi/webjames/webjames.c
+++ b/sapi/webjames/webjames.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2006 The PHP Group |
+ | Copyright (c) 1997-2007 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -27,7 +27,7 @@
#include <unixlib/local.h>
-#define WEBJAMES_SAPI_VERSION "1.0.1"
+#define WEBJAMES_SAPI_VERSION "1.0.2"
typedef struct {
struct connection *conn; /*structure holding all the details of the current request*/
@@ -42,24 +42,44 @@ static php_webjames_globals webjames_globals;
static int sapi_webjames_ub_write(const char *str, uint str_length TSRMLS_DC)
/*unbuffered write - send data straight out to socket*/
{
- int bytes;
-
- bytes = webjames_writebuffer(WG(conn),str,str_length);
- if (bytes<0) {
- PG(connection_status) = PHP_CONNECTION_ABORTED;
- if (!PG(ignore_user_abort)) {
- zend_bailout();
+ int totalbytes = 0;
+
+ do {
+ int bytes;
+ bytes = webjames_writebuffer(WG(conn),str,str_length);
+ if (bytes<0) {
+ PG(connection_status) = PHP_CONNECTION_ABORTED;
+ if (!PG(ignore_user_abort)) {
+ zend_bailout();
+ }
+ return bytes;
}
- }
- return bytes;
+ str += bytes;
+ str_length -= bytes;
+ totalbytes += bytes;
+ } while (str_length);
+ return totalbytes;
}
static void sapi_webjames_send_header(sapi_header_struct *sapi_header, void *server_context TSRMLS_DC)
/*send an HTTP header*/
{
+ char *header = sapi_header->header;
+ int len = sapi_header->header_len;
if (WG(conn)->flags.outputheaders) {
- if (sapi_header)
- webjames_writebuffer(WG(conn), sapi_header->header, sapi_header->header_len);
+ while (sapi_header && len > 0) {
+ int bytes;
+ bytes = webjames_writebuffer(WG(conn), header, len);
+ if (bytes<0) {
+ PG(connection_status) = PHP_CONNECTION_ABORTED;
+ if (!PG(ignore_user_abort)) {
+ zend_bailout();
+ }
+ return;
+ }
+ header += bytes;
+ len -= bytes;
+ }
webjames_writestring(WG(conn), "\r\n");
}
}