MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / MimeWriter

Class MimeWriter

thirdparty/clientform/clientform.py:305–446  ·  view source on GitHub ↗

Generic MIME writer. Methods: __init__() addheader() flushheaders() startbody() startmultipartbody() nextpart() lastpart() A MIME writer is much more primitive than a MIME parser. It doesn't seek around on the output file, and it doesn't use large amou

Source from the content-addressed store, hash-verified

303# to HTTP headers rather than message body when appropriate. It also uses
304# \r\n in place of \n. This is a bit nasty.
305class MimeWriter:
306
307 """Generic MIME writer.
308
309 Methods:
310
311 __init__()
312 addheader()
313 flushheaders()
314 startbody()
315 startmultipartbody()
316 nextpart()
317 lastpart()
318
319 A MIME writer is much more primitive than a MIME parser. It
320 doesn't seek around on the output file, and it doesn't use large
321 amounts of buffer space, so you have to write the parts in the
322 order they should occur on the output file. It does buffer the
323 headers you add, allowing you to rearrange their order.
324
325 General usage is:
326
327 f = <open the output file>
328 w = MimeWriter(f)
329 ...call w.addheader(key, value) 0 or more times...
330
331 followed by either:
332
333 f = w.startbody(content_type)
334 ...call f.write(data) for body data...
335
336 or:
337
338 w.startmultipartbody(subtype)
339 for each part:
340 subwriter = w.nextpart()
341 ...use the subwriter&#x27;s methods to create the subpart...
342 w.lastpart()
343
344 The subwriter is another MimeWriter instance, and should be
345 treated in the same way as the toplevel MimeWriter. This way,
346 writing recursive body parts is easy.
347
348 Warning: don&#x27;t forget to call lastpart()!
349
350 XXX There should be more state so calls made in the wrong order
351 are detected.
352
353 Some special cases:
354
355 - startbody() just returns the file passed to the constructor;
356 but don&#x27;t use this knowledge, as it may be changed.
357
358 - startmultipartbody() actually returns a file as well;
359 this can be used to write the initial &#x27;if you can read this your
360 mailer is not MIME-aware&#x27; message.
361
362 - If you call flushheaders(), the headers accumulated so far are

Callers 1

_request_dataMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…