static PyObject* create_status(PyObject *bytes, int bytelen, int http_minor) { buffer_result r; buffer_t *b = new_buffer(256, 0); if(b == NULL){ return NULL; } if(http_minor == 1){ r = write2buf(b, "HTTP/1.1 ", 9); }else{ r = write2buf(b, "HTTP/1.0 ", 9); } if(r != WRITE_OK){ goto error; } r = write2buf(b, PyBytes_AS_STRING(bytes), bytelen); if(r != WRITE_OK){ goto error; } r = write2buf(b, "\r\n", 2); if(r != WRITE_OK){ goto error; } return getPyString(b); error: free_buffer(b); return NULL; }
void ConsoleWindow::enter() { QString cmd = getPyString(); multilineCmd += "\n"+cmd; if(cmd.isEmpty() && scope) scope--; if(cmd.endsWith(":")) scope++; if(matchingParen(cmd) &&!scope &&!cmd.startsWith("@") &&!cmd.endsWith("\\")){ Q_EMIT execCmd(multilineCmd); multilineCmd = ""; prompt->setText(">>> "); return; } if(!cmd.isEmpty())prompt->setText("... "); }