Revision 25e7b43f

b/lib/http/__init__.py
124 124
class HttpBadRequest(HttpException):
125 125
  """400 Bad Request
126 126

  
127
  RFC2616, 10.4.1: The request could not be understood by the server due to
128
  malformed syntax. The client SHOULD NOT repeat the request without
129
  modifications.
127
  RFC2616, 10.4.1: The request could not be understood by the server
128
  due to malformed syntax. The client SHOULD NOT repeat the request
129
  without modifications.
130 130

  
131 131
  """
132 132
  code = 400
......
135 135
class HttpUnauthorized(HttpException):
136 136
  """401 Unauthorized
137 137

  
138
  RFC2616, section 10.4.2: The request requires user authentication. The
139
  response MUST include a WWW-Authenticate header field (section 14.47)
140
  containing a challenge applicable to the requested resource.
138
  RFC2616, section 10.4.2: The request requires user
139
  authentication. The response MUST include a WWW-Authenticate header
140
  field (section 14.47) containing a challenge applicable to the
141
  requested resource.
141 142

  
142 143
  """
143 144
  code = 401
......
146 147
class HttpForbidden(HttpException):
147 148
  """403 Forbidden
148 149

  
149
  RFC2616, 10.4.4: The server understood the request, but is refusing to
150
  fulfill it.  Authorization will not help and the request SHOULD NOT be
151
  repeated.
150
  RFC2616, 10.4.4: The server understood the request, but is refusing
151
  to fulfill it.  Authorization will not help and the request SHOULD
152
  NOT be repeated.
152 153

  
153 154
  """
154 155
  code = 403
......
157 158
class HttpNotFound(HttpException):
158 159
  """404 Not Found
159 160

  
160
  RFC2616, 10.4.5: The server has not found anything matching the Request-URI.
161
  No indication is given of whether the condition is temporary or permanent.
161
  RFC2616, 10.4.5: The server has not found anything matching the
162
  Request-URI.  No indication is given of whether the condition is
163
  temporary or permanent.
162 164

  
163 165
  """
164 166
  code = 404
......
167 169
class HttpMethodNotAllowed(HttpException):
168 170
  """405 Method Not Allowed
169 171

  
170
  RFC2616, 10.4.6: The method specified in the Request-Line is not allowed for
171
  the resource identified by the Request-URI. The response MUST include an
172
  Allow header containing a list of valid methods for the requested resource.
172
  RFC2616, 10.4.6: The method specified in the Request-Line is not
173
  allowed for the resource identified by the Request-URI. The response
174
  MUST include an Allow header containing a list of valid methods for
175
  the requested resource.
173 176

  
174 177
  """
175 178
  code = 405
......
178 181
class HttpRequestTimeout(HttpException):
179 182
  """408 Request Timeout
180 183

  
181
  RFC2616, 10.4.9: The client did not produce a request within the time that
182
  the server was prepared to wait. The client MAY repeat the request without
183
  modifications at any later time.
184
  RFC2616, 10.4.9: The client did not produce a request within the
185
  time that the server was prepared to wait. The client MAY repeat the
186
  request without modifications at any later time.
184 187

  
185 188
  """
186 189
  code = 408
......
189 192
class HttpConflict(HttpException):
190 193
  """409 Conflict
191 194

  
192
  RFC2616, 10.4.10: The request could not be completed due to a conflict with
193
  the current state of the resource. This code is only allowed in situations
194
  where it is expected that the user might be able to resolve the conflict and
195
  resubmit the request.
195
  RFC2616, 10.4.10: The request could not be completed due to a
196
  conflict with the current state of the resource. This code is only
197
  allowed in situations where it is expected that the user might be
198
  able to resolve the conflict and resubmit the request.
196 199

  
197 200
  """
198 201
  code = 409
......
201 204
class HttpGone(HttpException):
202 205
  """410 Gone
203 206

  
204
  RFC2616, 10.4.11: The requested resource is no longer available at the server
205
  and no forwarding address is known. This condition is expected to be
206
  considered permanent.
207
  RFC2616, 10.4.11: The requested resource is no longer available at
208
  the server and no forwarding address is known. This condition is
209
  expected to be considered permanent.
207 210

  
208 211
  """
209 212
  code = 410
......
212 215
class HttpLengthRequired(HttpException):
213 216
  """411 Length Required
214 217

  
215
  RFC2616, 10.4.12: The server refuses to accept the request without a defined
216
  Content-Length. The client MAY repeat the request if it adds a valid
217
  Content-Length header field containing the length of the message-body in the
218
  request message.
218
  RFC2616, 10.4.12: The server refuses to accept the request without a
219
  defined Content-Length. The client MAY repeat the request if it adds
220
  a valid Content-Length header field containing the length of the
221
  message-body in the request message.
219 222

  
220 223
  """
221 224
  code = 411
......
224 227
class HttpPreconditionFailed(HttpException):
225 228
  """412 Precondition Failed
226 229

  
227
  RFC2616, 10.4.13: The precondition given in one or more of the request-header
228
  fields evaluated to false when it was tested on the server.
230
  RFC2616, 10.4.13: The precondition given in one or more of the
231
  request-header fields evaluated to false when it was tested on the
232
  server.
229 233

  
230 234
  """
231 235
  code = 412
......
234 238
class HttpInternalServerError(HttpException):
235 239
  """500 Internal Server Error
236 240

  
237
  RFC2616, 10.5.1: The server encountered an unexpected condition which
238
  prevented it from fulfilling the request.
241
  RFC2616, 10.5.1: The server encountered an unexpected condition
242
  which prevented it from fulfilling the request.
239 243

  
240 244
  """
241 245
  code = 500
......
244 248
class HttpNotImplemented(HttpException):
245 249
  """501 Not Implemented
246 250

  
247
  RFC2616, 10.5.2: The server does not support the functionality required to
248
  fulfill the request.
251
  RFC2616, 10.5.2: The server does not support the functionality
252
  required to fulfill the request.
249 253

  
250 254
  """
251 255
  code = 501
......
254 258
class HttpServiceUnavailable(HttpException):
255 259
  """503 Service Unavailable
256 260

  
257
  RFC2616, 10.5.4: The server is currently unable to handle the request due to
258
  a temporary overloading or maintenance of the server.
261
  RFC2616, 10.5.4: The server is currently unable to handle the
262
  request due to a temporary overloading or maintenance of the server.
259 263

  
260 264
  """
261 265
  code = 503
......
264 268
class HttpVersionNotSupported(HttpException):
265 269
  """505 HTTP Version Not Supported
266 270

  
267
  RFC2616, 10.5.6: The server does not support, or refuses to support, the HTTP
268
  protocol version that was used in the request message.
271
  RFC2616, 10.5.6: The server does not support, or refuses to support,
272
  the HTTP protocol version that was used in the request message.
269 273

  
270 274
  """
271 275
  code = 505
......
467 471
  @type sock: socket
468 472
  @param sock: Socket to be shut down
469 473
  @type close_timeout: float
470
  @param close_timeout: How long to wait for the peer to close the connection
474
  @param close_timeout: How long to wait for the peer to close
475
      the connection
471 476
  @type write_timeout: float
472 477
  @param write_timeout: Write timeout for shutdown
473 478
  @type msgreader: http.HttpMessageReader
474
  @param msgreader: Request message reader, used to determine whether peer
475
                    should close connection
479
  @param msgreader: Request message reader, used to determine whether
480
      peer should close connection
476 481
  @type force: bool
477
  @param force: Whether to forcibly close the connection without waiting
478
                for peer
482
  @param force: Whether to forcibly close the connection without
483
      waiting for peer
479 484

  
480 485
  """
481 486
  #print msgreader.peer_will_close, force
......
529 534
    @type ssl_key_path: string
530 535
    @param ssl_key_path: Path to file containing SSL key in PEM format
531 536
    @type ssl_cert_path: string
532
    @param ssl_cert_path: Path to file containing SSL certificate in PEM format
537
    @param ssl_cert_path: Path to file containing SSL certificate
538
        in PEM format
533 539

  
534 540
    """
535 541
    self.ssl_key_pem = utils.ReadFile(ssl_key_path)
......
560 566
    @type ssl_params: HttpSslParams
561 567
    @param ssl_params: SSL key and certificate
562 568
    @type ssl_verify_peer: bool
563
    @param ssl_verify_peer: Whether to require client certificate and compare
564
                            it with our certificate
569
    @param ssl_verify_peer: Whether to require client certificate
570
        and compare it with our certificate
565 571

  
566 572
    """
567 573
    self._ssl_params = ssl_params
......
959 965

  
960 966
    This function also adjusts internal variables based on header values.
961 967

  
962
    RFC2616, section 4.3: "The presence of a message-body in a request is
968
    RFC2616, section 4.3: The presence of a message-body in a request is
963 969
    signaled by the inclusion of a Content-Length or Transfer-Encoding header
964
    field in the request's message-headers."
970
    field in the request's message-headers.
965 971

  
966 972
    """
967 973
    # Parse headers
b/lib/http/auth.py
125 125
    raise http.HttpUnauthorized(headers=headers)
126 126

  
127 127
  def _CheckAuthorization(self, req):
128
    """Checks "Authorization" header sent by client.
128
    """Checks 'Authorization' header sent by client.
129 129

  
130 130
    @type req: L{http.server._HttpServerRequest}
131 131
    @param req: HTTP request context
132
    @type credentials: str
133
    @param credentials: Credentials sent
134 132
    @rtype: bool
135 133
    @return: Whether user is allowed to execute request
136 134

  
......
212 210
def ReadPasswordFile(file_name):
213 211
  """Reads a password file.
214 212

  
215
  Lines in the password file are of the following format:
213
  Lines in the password file are of the following format::
216 214

  
217
    <username> <password> [options]
215
      <username> <password> [options]
218 216

  
219 217
  Fields are separated by whitespace. Username and password are mandatory,
220
  options are optional and separated by comma (","). Empty lines and comments
221
  ("#") are ignored.
218
  options are optional and separated by comma (','). Empty lines and comments
219
  ('#') are ignored.
222 220

  
223 221
  @type file_name: str
224 222
  @param file_name: Path to password file
b/lib/http/client.py
65 65
    @type ssl_params: HttpSslParams
66 66
    @param ssl_params: SSL key and certificate
67 67
    @type ssl_verify_peer: bool
68
    @param ssl_verify_peer: Whether to compare our certificate with server's
69
                            certificate
68
    @param ssl_verify_peer: Whether to compare our certificate with
69
        server's certificate
70 70

  
71 71
    """
72 72
    if post_data is not None:
b/lib/http/server.py
102 102
    @param sock: Target socket
103 103
    @type request_msg: http.HttpMessage
104 104
    @param request_msg: Request message, required to determine whether
105
                        response may have a message body
105
        response may have a message body
106 106
    @type response_msg: http.HttpMessage
107 107
    @param response_msg: Response message
108 108
    @type write_timeout: float
......
210 210
class _HttpServerRequestExecutor(object):
211 211
  """Implements server side of HTTP.
212 212

  
213
  This class implements the server side of HTTP. It's based on code of Python's
214
  BaseHTTPServer, from both version 2.4 and 3k. It does not support non-ASCII
215
  character encodings. Keep-alive connections are not supported.
213
  This class implements the server side of HTTP. It's based on code of
214
  Python's BaseHTTPServer, from both version 2.4 and 3k. It does not
215
  support non-ASCII character encodings. Keep-alive connections are
216
  not supported.
216 217

  
217 218
  """
218 219
  # The default request version.  This only affects responses up until
......
428 429
    @type ssl_params: HttpSslParams
429 430
    @param ssl_params: SSL key and certificate
430 431
    @type ssl_verify_peer: bool
431
    @param ssl_verify_peer: Whether to require client certificate and compare
432
                            it with our certificate
432
    @param ssl_verify_peer: Whether to require client certificate
433
        and compare it with our certificate
433 434

  
434 435
    """
435 436
    http.HttpBase.__init__(self)
b/lib/jqueue.py
1127 1127
    """Archives jobs.
1128 1128

  
1129 1129
    @type jobs: list of L{_QueuedJob}
1130
    @param job: Job objects
1130
    @param jobs: Job objects
1131 1131
    @rtype: int
1132 1132
    @return: Number of archived jobs
1133 1133

  
......
1160 1160
  def ArchiveJob(self, job_id):
1161 1161
    """Archives a job.
1162 1162

  
1163
    This is just a wrapper over L{_ArchiveJobUnlocked}.
1163
    This is just a wrapper over L{_ArchiveJobsUnlocked}.
1164 1164

  
1165 1165
    @type job_id: string
1166 1166
    @param job_id: Job ID of job to be archived.

Also available in: Unified diff