Project

General

Profile

Revision 38df0012

ID38df0012f633020a07bd9eeed77e76d83228b7e8
Parent 15928a3d
Child e0657267

Added by Thomas Mullins about 11 years ago

Event submissions from ./tooltron tested and working

View differences:

mainbox/query.c
135 135
      CURLFORM_COPYCONTENTS, tooltron_password,
136 136
      CURLFORM_END);
137 137

  
138
  curl_formadd(&formpost, &lastptr,
139
      CURLFORM_COPYNAME, "type",
140
      CURLFORM_COPYCONTENTS, "usage",
141
      CURLFORM_END);
142

  
143 138
  timeinfo = localtime(&event->tstart);
144 139
  strftime(buf, sizeof(buf), "%F %T", timeinfo);
145 140
  curl_formadd(&formpost, &lastptr,
......
156 151

  
157 152
  sprintf(buf, "%08x", event->user);
158 153
  curl_formadd(&formpost, &lastptr,
159
      CURLFORM_COPYNAME, "user",
154
      CURLFORM_COPYNAME, "user_id",
160 155
      CURLFORM_COPYCONTENTS, buf,
161 156
      CURLFORM_END);
162 157

  
163 158
  sprintf(buf, "%d", event->tool_id);
164 159
  curl_formadd(&formpost, &lastptr,
165
      CURLFORM_COPYNAME, "machine",
160
      CURLFORM_COPYNAME, "machine_id",
166 161
      CURLFORM_COPYCONTENTS, buf,
167 162
      CURLFORM_END);
168 163

  
169
  sprintf(buf, "https://%s/add_event/", server);
164
  curl_formadd(&formpost, &lastptr,
165
      CURLFORM_COPYNAME, "succ",
166
      CURLFORM_COPYCONTENTS, event->succ? "1" : "0",
167
      CURLFORM_END);
168

  
169
  sprintf(buf, "https://%s/add_card_event/", server);
170
  //sprintf(buf, "http://%s/add_card_event/", server);
170 171
  error_code = curl_easy_setopt(handle, CURLOPT_URL, buf);
171 172
  if (error_code) goto error;
172 173

  
173 174
  error_code = curl_easy_setopt(handle, CURLOPT_SSL_VERIFYHOST, 0L);
174 175
  if (error_code) goto error;
175 176

  
177
  /* TODO TEMPORARY */
178
  FILE *tmp = fopen("temp.html", "w");
179
  error_code = curl_easy_setopt(handle, CURLOPT_WRITEDATA, tmp);
180
  if (error_code) goto error;
181

  
182
  /*
176 183
  error_code = curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_ignore);
177 184
  if (error_code) goto error;
185
  */
178 186

  
179 187
  error_code = curl_easy_setopt(handle, CURLOPT_HTTPPOST, formpost);
180 188
  if (error_code) goto error;
......
191 199

  
192 200
  curl_easy_cleanup(handle);
193 201
  curl_formfree(formpost);
202
  fclose(tmp);
194 203
  return response >= 300;
195 204

  
196 205
error:

Also available in: Unified diff