[geeklog-cvs] Geeklog-1.x/system lib-webservices.php,1.24,1.25

Dirk Haun dhaun at qs1489.pair.com
Wed Jan 2 06:44:11 EST 2008


Update of /cvsroot/geeklog/Geeklog-1.x/system
In directory qs1489.pair.com:/tmp/cvs-serv39486/system

Modified Files:
	lib-webservices.php 
Log Message:
Our errors are really only plain text (not HTML); also make sure our errors have at least a minimal content


Index: lib-webservices.php
===================================================================
RCS file: /cvsroot/geeklog/Geeklog-1.x/system/lib-webservices.php,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** lib-webservices.php	31 Dec 2007 16:49:03 -0000	1.24
--- lib-webservices.php	2 Jan 2008 11:44:09 -0000	1.25
***************
*** 9,13 ****
  // | WS-related functions needed in more than one place.                       |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2007 by the following authors:                              |
  // |                                                                           |
  // | Authors: Ramnath R Iyer        - rri AT silentyak DOT com                 |
--- 9,13 ----
  // | WS-related functions needed in more than one place.                       |
  // +---------------------------------------------------------------------------+
! // | Copyright (C) 2007-2008 by the following authors:                         |
  // |                                                                           |
  // | Authors: Ramnath R Iyer        - rri AT silentyak DOT com                 |
***************
*** 65,83 ****
      global $WS_VERBOSE;
  
!     header('Content-type: ' . 'text/html' . '; charset=UTF-8');
      switch ($error_code) {
      case PLG_RET_PRECONDITION_FAILED:
          header($_SERVER['SERVER_PROTOCOL'] . ' 412 Precondition Failed');
          break;
      case PLG_RET_PERMISSION_DENIED:
          header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
          break;
      case PLG_RET_AUTH_FAILED:
          header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized');
          header('WWW-Authenticate: Basic realm="www.geeklog.net"');
          break;
      case PLG_RET_ERROR:
          header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
          break;
      }
  
--- 65,99 ----
      global $WS_VERBOSE;
  
!     header('Content-type: text/plain');
      switch ($error_code) {
      case PLG_RET_PRECONDITION_FAILED:
          header($_SERVER['SERVER_PROTOCOL'] . ' 412 Precondition Failed');
+         if (empty($error_desc)) {
+             $error_desc = 'Precondition Failed';
+         }
          break;
      case PLG_RET_PERMISSION_DENIED:
          header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden');
+         if (empty($error_desc)) {
+             $error_desc = 'Forbidden';
+         }
          break;
      case PLG_RET_AUTH_FAILED:
          header($_SERVER['SERVER_PROTOCOL'] . ' 401 Unauthorized');
          header('WWW-Authenticate: Basic realm="www.geeklog.net"');
+         if (empty($error_desc)) {
+             $error_desc = 'Unauthorized';
+         }
          break;
      case PLG_RET_ERROR:
          header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request');
+         if (empty($error_desc)) {
+             $error_desc = 'Bad Request';
+         }
          break;
+     }
+ 
+     if (empty($error_desc)) {
+         $error_desc = 'Error';
      }
  




More information about the geeklog-cvs mailing list